diff options
| author | tony mancill <tmancill@debian.org> | 2026-04-12 08:46:47 -0700 |
|---|---|---|
| committer | tony mancill <tmancill@debian.org> | 2026-04-12 08:46:47 -0700 |
| commit | cd2dad3bc7ae0ee0a18b7b20a945009362ec3851 (patch) | |
| tree | 5a622ec4193e9bc899f6499f936848a661be29cb /widgets | |
| parent | 558c0b9d6ecf70c5222e2069ece1fea3656c75d7 (diff) | |
| parent | 291b3817bf0c7a742e9e17d42c94fc8c9530e40d (diff) | |
Merge branch 'debian/latest' into debian/trixie-backports
Diffstat (limited to 'widgets')
| -rw-r--r--[-rwxr-xr-x] | widgets/AbstractLogWindow.cpp | 352 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/AbstractLogWindow.hpp | 86 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/BandComboBox.cpp | 54 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/BandComboBox.hpp | 32 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/CabrilloLogWindow.cpp | 198 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/CabrilloLogWindow.hpp | 56 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/CabrilloLogWindow.ui | 106 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/CheckableItemComboBox.cpp | 186 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/CheckableItemComboBox.hpp | 74 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/DateTimeEdit.hpp | 46 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/DecodeHighlightingListView.cpp | 148 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/DecodeHighlightingListView.hpp | 56 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/DoubleClickablePushButton.cpp | 28 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/DoubleClickablePushButton.hpp | 54 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/DoubleClickableRadioButton.cpp | 28 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/DoubleClickableRadioButton.hpp | 54 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/ExportCabrillo.cpp | 234 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/ExportCabrillo.h | 72 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/ExportCabrillo.ui | 662 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/FoxLogWindow.cpp | 258 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/FoxLogWindow.hpp | 72 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/FoxLogWindow.ui | 250 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/FrequencyDeltaLineEdit.cpp | 108 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/FrequencyDeltaLineEdit.hpp | 58 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/FrequencyLineEdit.cpp | 106 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/FrequencyLineEdit.hpp | 58 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/HelpTextWindow.cpp | 42 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/HelpTextWindow.hpp | 36 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/HintedSpinBox.cpp | 110 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/HintedSpinBox.hpp | 106 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/LazyFillComboBox.cpp | 6 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/LazyFillComboBox.hpp | 108 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/LettersSpinBox.cpp | 50 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/LettersSpinBox.hpp | 62 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/MessageBox.cpp | 204 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/MessageBox.hpp | 116 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/MultiGeometryWidget.hpp | 184 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/QSYMessage.cpp | 730 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/QSYMessage.h | 94 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/QSYMessage.ui | 198 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/QSYMessageCreator.cpp | 3086 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/QSYMessageCreator.h | 262 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/QSYMessageCreator.ui | 4424 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/RestrictedSpinBox.cpp | 66 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/RestrictedSpinBox.hpp | 52 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/SplashScreen.cpp | 96 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/SplashScreen.hpp | 48 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/about.cpp | 85 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/about.h | 46 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/about.ui | 200 | ||||
| -rw-r--r-- | widgets/about_wsjtx.cpp | 42 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/activeStations.cpp | 472 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/activeStations.h | 124 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/activeStations.ui | 448 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/astro.cpp | 854 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/astro.h | 241 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/astro.ui | 836 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/colorhighlighting.cpp | 260 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/colorhighlighting.h | 66 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/colorhighlighting.ui | 676 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/displaytext.cpp | 2410 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/displaytext.h | 156 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/echograph.cpp | 252 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/echograph.h | 88 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/echograph.ui | 634 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/echoplot.cpp | 676 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/echoplot.h | 196 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/fastgraph.cpp | 252 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/fastgraph.h | 104 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/fastgraph.ui | 492 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/fastplot.cpp | 580 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/fastplot.h | 182 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/itoneAndicw.h | 46 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/logqso.cpp | 1186 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/logqso.h | 146 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/logqso.ui | 1336 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/mainwindow.cpp | 34433 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/mainwindow.h | 2169 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/mainwindow.ui | 12489 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/messageaveraging.cpp | 146 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/messageaveraging.h | 68 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/messageaveraging.ui | 84 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/meterwidget.cpp | 166 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/meterwidget.h | 66 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/plotter.cpp | 2182 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/plotter.h | 438 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/qsymonitor.cpp | 694 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/qsymonitor.h | 82 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/qsymonitor.ui | 140 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/signalmeter.cpp | 214 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/signalmeter.h | 54 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/widegraph.cpp | 1216 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/widegraph.h | 266 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/widegraph.ui | 1416 | ||||
| -rw-r--r--[-rwxr-xr-x] | widgets/widgets.pri | 96 |
95 files changed, 41777 insertions, 41244 deletions
diff --git a/widgets/AbstractLogWindow.cpp b/widgets/AbstractLogWindow.cpp index 03423701..667573ce 100755..100644 --- a/widgets/AbstractLogWindow.cpp +++ b/widgets/AbstractLogWindow.cpp @@ -1,176 +1,176 @@ -#include "AbstractLogWindow.hpp"
-
-#include <algorithm>
-#include <QSettings>
-#include <QObject>
-#include <QString>
-#include <QTableView>
-#include <QHeaderView>
-#include <QAction>
-#include <QSqlTableModel>
-#include <QItemSelectionModel>
-#include <QItemSelection>
-#include <QTimer>
-#include "Configuration.hpp"
-#include "SettingsGroup.hpp"
-#include "MessageBox.hpp"
-#include "models/FontOverrideModel.hpp"
-#include "pimpl_impl.hpp"
-
-class AbstractLogWindow::impl final
- : public QObject
-{
- Q_OBJECT
-
-public:
- impl (AbstractLogWindow * self, QString const& settings_key, QSettings * settings
- , Configuration const * configuration)
- : self_ {self}
- , settings_key_ {settings_key}
- , settings_ {settings}
- , configuration_ {configuration}
- , log_view_ {nullptr}
- {
- }
-
- void delete_QSOs ();
-
- AbstractLogWindow * self_;
- QString settings_key_;
- QSettings * settings_;
- Configuration const * configuration_;
- QTableView * log_view_;
- FontOverrideModel model_;
-};
-
-#include "moc_AbstractLogWindow.cpp"
-#include "AbstractLogWindow.moc"
-
-namespace
-{
- bool row_is_higher (QModelIndex const& lhs, QModelIndex const& rhs)
- {
- return lhs.row () > rhs.row ();
- }
-}
-
-void AbstractLogWindow::impl::delete_QSOs ()
-{
- auto selection_model = log_view_->selectionModel ();
- selection_model->select (selection_model->selection (), QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows);
- auto row_indexes = selection_model->selectedRows ();
-
- if (row_indexes.size ()
- && MessageBox::Yes == MessageBox::query_message (self_
- , tr ("Confirm Delete")
- , tr ("Are you sure you want to delete the %n "
- "selected QSO(s) from the log?", ""
- , row_indexes.size ())
- , QString {}
- , MessageBox::Yes | MessageBox::No
- , MessageBox::No))
- {
- // We must work with source model indexes because we don't want row
- // removes to invalidate model indexes we haven't yet processed. We
- // achieve that by processing them in descending row order.
- for (auto& row_index : row_indexes)
- {
- row_index = model_.mapToSource (row_index);
- }
-
- // reverse sort by row
- std::sort (row_indexes.begin (), row_indexes.end (), row_is_higher);
-
- for (auto index : row_indexes)
- {
- auto row = model_.mapFromSource(index).row();
- model_.removeRow(row);
- self_->log_model_changed();
- }
- }
-}
-
-
-AbstractLogWindow::AbstractLogWindow (QString const& settings_key, QSettings * settings
- , Configuration const * configuration
- , QWidget * parent)
- : QWidget {parent}
- , m_ {this, settings_key, settings, configuration} {
- // when we're viewing the log by contact ID (visually, up/down chevron in the column heading),
- // when we add a contact, scroll the list to the top or bottom, depending on the sort order.
- // If the table is sorted by some other criteria, don't change anything.
-
- connect(&m_->model_, &QAbstractItemModel::rowsInserted, this,
- [this](QModelIndex const &parent, int first, int last) {
- (void) (parent); // UNUSED
- (void) (first); // UNUSED
- (void) (last); // UNUSED
- QTimer::singleShot(0, [=] {
- // if we're sorting by the date, then show the most-recently logged contact.
- // Otherwise, leave the scroll alone
- auto horizontal_header = m_->log_view_->horizontalHeader ();
- if (horizontal_header->sortIndicatorSection() == 3) { // sorting on date?
- if (horizontal_header->sortIndicatorOrder() == Qt::AscendingOrder) {
- // we're sorting oldes->newest, so go to bottom
- m_->log_view_->scrollToBottom();
- } else {
- m_->log_view_->scrollToTop();
- }
- }
-
- });
- }
- );
-}
-
-AbstractLogWindow::~AbstractLogWindow ()
-{
- SettingsGroup g {m_->settings_, m_->settings_key_};
- m_->settings_->setValue ("window/geometry", saveGeometry ());
-}
-
-void AbstractLogWindow::set_log_view (QTableView * log_view)
-{
- // do this here because we know the UI must be setup before this
- SettingsGroup g {m_->settings_, m_->settings_key_};
- restoreGeometry (m_->settings_->value ("window/geometry").toByteArray ());
- m_->log_view_ = log_view;
- set_log_view_font (m_->configuration_->decoded_text_font ());
- log_view->setSortingEnabled (true);
- log_view->setContextMenuPolicy (Qt::ActionsContextMenu);
- log_view->setAlternatingRowColors (true);
- log_view->setSelectionBehavior (QAbstractItemView::SelectRows);
- log_view->setSelectionMode (QAbstractItemView::ExtendedSelection);
- log_view->setVerticalScrollMode (QAbstractItemView::ScrollPerPixel);
- m_->model_.setSourceModel (log_view->model ());
- log_view->setModel (&m_->model_);
- log_view->setColumnHidden (0, true); // hide the ID column
- auto horizontal_header = log_view->horizontalHeader ();
-
- horizontal_header->setResizeContentsPrecision (0); // visible region only
- horizontal_header->setSectionResizeMode (QHeaderView::ResizeToContents);
- horizontal_header->setSectionsMovable (true);
- horizontal_header->setSortIndicator(3, Qt::AscendingOrder); // sort by the contact datetime oldest->newest
-
- auto vertical_header = log_view->horizontalHeader ();
- vertical_header->setResizeContentsPrecision (0); // visible region only
- vertical_header->setSectionResizeMode (QHeaderView::ResizeToContents);
-
- // actions
- auto delete_action = new QAction {tr ("&Delete ..."), log_view};
- log_view->insertAction (nullptr, delete_action);
- connect (delete_action, &QAction::triggered, [this] (bool /*checked*/) {
- m_->delete_QSOs ();
- });
-
- // scroll to bottom, since we're showing 1-N
- log_view->scrollToBottom();
-}
-
-void AbstractLogWindow::set_log_view_font (QFont const& font)
-{
- m_->log_view_->setFont (font);
- m_->log_view_->horizontalHeader ()->setFont (font);
- m_->log_view_->verticalHeader ()->setFont (font);
- m_->model_.set_font (font);
-}
+#include "AbstractLogWindow.hpp" + +#include <algorithm> +#include <QSettings> +#include <QObject> +#include <QString> +#include <QTableView> +#include <QHeaderView> +#include <QAction> +#include <QSqlTableModel> +#include <QItemSelectionModel> +#include <QItemSelection> +#include <QTimer> +#include "Configuration.hpp" +#include "SettingsGroup.hpp" +#include "MessageBox.hpp" +#include "models/FontOverrideModel.hpp" +#include "pimpl_impl.hpp" + +class AbstractLogWindow::impl final + : public QObject +{ + Q_OBJECT + +public: + impl (AbstractLogWindow * self, QString const& settings_key, QSettings * settings + , Configuration const * configuration) + : self_ {self} + , settings_key_ {settings_key} + , settings_ {settings} + , configuration_ {configuration} + , log_view_ {nullptr} + { + } + + void delete_QSOs (); + + AbstractLogWindow * self_; + QString settings_key_; + QSettings * settings_; + Configuration const * configuration_; + QTableView * log_view_; + FontOverrideModel model_; +}; + +#include "moc_AbstractLogWindow.cpp" +#include "AbstractLogWindow.moc" + +namespace +{ + bool row_is_higher (QModelIndex const& lhs, QModelIndex const& rhs) + { + return lhs.row () > rhs.row (); + } +} + +void AbstractLogWindow::impl::delete_QSOs () +{ + auto selection_model = log_view_->selectionModel (); + selection_model->select (selection_model->selection (), QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows); + auto row_indexes = selection_model->selectedRows (); + + if (row_indexes.size () + && MessageBox::Yes == MessageBox::query_message (self_ + , tr ("Confirm Delete") + , tr ("Are you sure you want to delete the %n " + "selected QSO(s) from the log?", "" + , row_indexes.size ()) + , QString {} + , MessageBox::Yes | MessageBox::No + , MessageBox::No)) + { + // We must work with source model indexes because we don't want row + // removes to invalidate model indexes we haven't yet processed. We + // achieve that by processing them in descending row order. + for (auto& row_index : row_indexes) + { + row_index = model_.mapToSource (row_index); + } + + // reverse sort by row + std::sort (row_indexes.begin (), row_indexes.end (), row_is_higher); + + for (auto index : row_indexes) + { + auto row = model_.mapFromSource(index).row(); + model_.removeRow(row); + self_->log_model_changed(); + } + } +} + + +AbstractLogWindow::AbstractLogWindow (QString const& settings_key, QSettings * settings + , Configuration const * configuration + , QWidget * parent) + : QWidget {parent} + , m_ {this, settings_key, settings, configuration} { + // when we're viewing the log by contact ID (visually, up/down chevron in the column heading), + // when we add a contact, scroll the list to the top or bottom, depending on the sort order. + // If the table is sorted by some other criteria, don't change anything. + + connect(&m_->model_, &QAbstractItemModel::rowsInserted, this, + [this](QModelIndex const &parent, int first, int last) { + (void) (parent); // UNUSED + (void) (first); // UNUSED + (void) (last); // UNUSED + QTimer::singleShot(0, [=] { + // if we're sorting by the date, then show the most-recently logged contact. + // Otherwise, leave the scroll alone + auto horizontal_header = m_->log_view_->horizontalHeader (); + if (horizontal_header->sortIndicatorSection() == 3) { // sorting on date? + if (horizontal_header->sortIndicatorOrder() == Qt::AscendingOrder) { + // we're sorting oldes->newest, so go to bottom + m_->log_view_->scrollToBottom(); + } else { + m_->log_view_->scrollToTop(); + } + } + + }); + } + ); +} + +AbstractLogWindow::~AbstractLogWindow () +{ + SettingsGroup g {m_->settings_, m_->settings_key_}; + m_->settings_->setValue ("window/geometry", saveGeometry ()); +} + +void AbstractLogWindow::set_log_view (QTableView * log_view) +{ + // do this here because we know the UI must be setup before this + SettingsGroup g {m_->settings_, m_->settings_key_}; + restoreGeometry (m_->settings_->value ("window/geometry").toByteArray ()); + m_->log_view_ = log_view; + set_log_view_font (m_->configuration_->decoded_text_font ()); + log_view->setSortingEnabled (true); + log_view->setContextMenuPolicy (Qt::ActionsContextMenu); + log_view->setAlternatingRowColors (true); + log_view->setSelectionBehavior (QAbstractItemView::SelectRows); + log_view->setSelectionMode (QAbstractItemView::ExtendedSelection); + log_view->setVerticalScrollMode (QAbstractItemView::ScrollPerPixel); + m_->model_.setSourceModel (log_view->model ()); + log_view->setModel (&m_->model_); + log_view->setColumnHidden (0, true); // hide the ID column + auto horizontal_header = log_view->horizontalHeader (); + + horizontal_header->setResizeContentsPrecision (0); // visible region only + horizontal_header->setSectionResizeMode (QHeaderView::ResizeToContents); + horizontal_header->setSectionsMovable (true); + horizontal_header->setSortIndicator(3, Qt::AscendingOrder); // sort by the contact datetime oldest->newest + + auto vertical_header = log_view->horizontalHeader (); + vertical_header->setResizeContentsPrecision (0); // visible region only + vertical_header->setSectionResizeMode (QHeaderView::ResizeToContents); + + // actions + auto delete_action = new QAction {tr ("&Delete ..."), log_view}; + log_view->insertAction (nullptr, delete_action); + connect (delete_action, &QAction::triggered, [this] (bool /*checked*/) { + m_->delete_QSOs (); + }); + + // scroll to bottom, since we're showing 1-N + log_view->scrollToBottom(); +} + +void AbstractLogWindow::set_log_view_font (QFont const& font) +{ + m_->log_view_->setFont (font); + m_->log_view_->horizontalHeader ()->setFont (font); + m_->log_view_->verticalHeader ()->setFont (font); + m_->model_.set_font (font); +} diff --git a/widgets/AbstractLogWindow.hpp b/widgets/AbstractLogWindow.hpp index 47d331c5..476ff62f 100755..100644 --- a/widgets/AbstractLogWindow.hpp +++ b/widgets/AbstractLogWindow.hpp @@ -1,43 +1,43 @@ -#ifndef ABSTRACT_LOG_WINDOW_HPP_
-#define ABSTRACT_LOG_WINDOW_HPP_
-
-#include <QWidget>
-#include "pimpl_h.hpp"
-
-class QString;
-class QSettings;
-class Configuration;
-class QTableView;
-class QFont;
-
-//
-// AbstractLogWindow - Base class for log view windows
-//
-// QWidget that manages the common functionality shared by windows
-// that include a QSO log view.
-//
-class AbstractLogWindow
- : public QWidget
-{
- Q_OBJECT
-
-public:
- AbstractLogWindow (QString const& settings_key, QSettings * settings
- , Configuration const * configuration
- , QWidget * parent = nullptr);
- virtual ~AbstractLogWindow () = 0;
-
- // set the QTableView that shows the log records, must have its
- // model set before calling this
- void set_log_view (QTableView *);
-
- void set_log_view_font (QFont const&);
-
-private:
- virtual void log_model_changed (int row = -1) = 0;
-
- class impl;
- pimpl<impl> m_;
-};
-
-#endif
+#ifndef ABSTRACT_LOG_WINDOW_HPP_ +#define ABSTRACT_LOG_WINDOW_HPP_ + +#include <QWidget> +#include "pimpl_h.hpp" + +class QString; +class QSettings; +class Configuration; +class QTableView; +class QFont; + +// +// AbstractLogWindow - Base class for log view windows +// +// QWidget that manages the common functionality shared by windows +// that include a QSO log view. +// +class AbstractLogWindow + : public QWidget +{ + Q_OBJECT + +public: + AbstractLogWindow (QString const& settings_key, QSettings * settings + , Configuration const * configuration + , QWidget * parent = nullptr); + virtual ~AbstractLogWindow () = 0; + + // set the QTableView that shows the log records, must have its + // model set before calling this + void set_log_view (QTableView *); + + void set_log_view_font (QFont const&); + +private: + virtual void log_model_changed (int row = -1) = 0; + + class impl; + pimpl<impl> m_; +}; + +#endif diff --git a/widgets/BandComboBox.cpp b/widgets/BandComboBox.cpp index c34ec7e7..7dfb77e0 100755..100644 --- a/widgets/BandComboBox.cpp +++ b/widgets/BandComboBox.cpp @@ -1,27 +1,27 @@ -#include "BandComboBox.hpp"
-
-#include <QAbstractItemView>
-#include <QScrollBar>
-#include <QDebug>
-#include "models/FrequencyList.hpp"
-
-BandComboBox::BandComboBox (QWidget * parent)
- : QComboBox {parent}
-{
-}
-
-// Fix up broken QComboBox item view rendering which doesn't allow for
-// a vertical scroll bar in width calculations and ends up eliding the
-// item text.
-void BandComboBox::showPopup ()
-{
- auto minimum_width = view ()->sizeHintForColumn (FrequencyList_v2_101::frequency_mhz_column);
- if (count () > maxVisibleItems ())
- {
- // for some as yet unknown reason, in FT8 mode the scrollbar
- // width is oversize on the first call here
- minimum_width += view ()->verticalScrollBar ()->width ();
- }
- view ()->setMinimumWidth (minimum_width);
- QComboBox::showPopup ();
-}
+#include "BandComboBox.hpp" + +#include <QAbstractItemView> +#include <QScrollBar> +#include <QDebug> +#include "models/FrequencyList.hpp" + +BandComboBox::BandComboBox (QWidget * parent) + : QComboBox {parent} +{ +} + +// Fix up broken QComboBox item view rendering which doesn't allow for +// a vertical scroll bar in width calculations and ends up eliding the +// item text. +void BandComboBox::showPopup () +{ + auto minimum_width = view ()->sizeHintForColumn (FrequencyList_v2_101::frequency_mhz_column); + if (count () > maxVisibleItems ()) + { + // for some as yet unknown reason, in FT8 mode the scrollbar + // width is oversize on the first call here + minimum_width += view ()->verticalScrollBar ()->width (); + } + view ()->setMinimumWidth (minimum_width); + QComboBox::showPopup (); +} diff --git a/widgets/BandComboBox.hpp b/widgets/BandComboBox.hpp index 8916891d..aaad114c 100755..100644 --- a/widgets/BandComboBox.hpp +++ b/widgets/BandComboBox.hpp @@ -1,16 +1,16 @@ -#ifndef BAND_COMBO_BOX_HPP__
-#define BAND_COMBO_BOX_HPP__
-
-#include <QComboBox>
-
-class BandComboBox
- : public QComboBox
-{
-public:
- explicit BandComboBox (QWidget * = nullptr);
-
-private:
- void showPopup () override;
-};
-
-#endif
+#ifndef BAND_COMBO_BOX_HPP__ +#define BAND_COMBO_BOX_HPP__ + +#include <QComboBox> + +class BandComboBox + : public QComboBox +{ +public: + explicit BandComboBox (QWidget * = nullptr); + +private: + void showPopup () override; +}; + +#endif diff --git a/widgets/CabrilloLogWindow.cpp b/widgets/CabrilloLogWindow.cpp index 54e626b1..89aba0cb 100755..100644 --- a/widgets/CabrilloLogWindow.cpp +++ b/widgets/CabrilloLogWindow.cpp @@ -1,99 +1,99 @@ -#include "CabrilloLogWindow.hpp"
-
-#include <stdexcept>
-#include <QApplication>
-#include <QIdentityProxyModel>
-#include <QSqlTableModel>
-#include "Configuration.hpp"
-#include "models/Bands.hpp"
-#include "item_delegates/FrequencyDelegate.hpp"
-#include "item_delegates/ForeignKeyDelegate.hpp"
-#include "item_delegates/CallsignDelegate.hpp"
-#include "item_delegates/SQLiteDateTimeDelegate.hpp"
-#include "pimpl_impl.hpp"
-
-#include "ui_CabrilloLogWindow.h"
-
-namespace
-{
- class FormatProxyModel final
- : public QIdentityProxyModel
- {
- public:
- explicit FormatProxyModel (QObject * parent = nullptr)
- : QIdentityProxyModel {parent}
- {
- }
-
- QVariant data (QModelIndex const& index, int role) const override
- {
- if (Qt::TextAlignmentRole == role && index.isValid ())
- {
- switch (index.column ())
- {
- case 1:
- case 7:
- return Qt::AlignRight + Qt::AlignVCenter;
- default:
- break;
- }
- }
- return QIdentityProxyModel::data (index, role);
- }
- };
-}
-
-class CabrilloLogWindow::impl final
-{
-public:
- explicit impl (QSqlTableModel * log_model)
- : log_model_ {log_model}
- {
- }
-
- QSqlTableModel * log_model_;
- FormatProxyModel format_model_;
- Ui::CabrilloLogWindow ui_;
-};
-
-CabrilloLogWindow::CabrilloLogWindow (QSettings * settings, Configuration const * configuration
- , QSqlTableModel * cabrillo_log_model, QWidget * parent)
- : AbstractLogWindow {"Cabrillo Log Window", settings, configuration, parent}
- , m_{cabrillo_log_model}
-{
- setWindowTitle (QApplication::applicationName () + " - Cabrillo Log");
- m_->ui_.setupUi (this);
- m_->format_model_.setSourceModel (m_->log_model_);
- m_->ui_.log_table_view->setModel (&m_->format_model_);
- set_log_view (m_->ui_.log_table_view);
- m_->ui_.log_table_view->setItemDelegateForColumn (1, new FrequencyDelegate {this});
- m_->ui_.log_table_view->setItemDelegateForColumn (3, new SQLiteDateTimeDelegate {this});
- m_->ui_.log_table_view->setItemDelegateForColumn (4, new CallsignDelegate {this});
- auto h_header = m_->ui_.log_table_view->horizontalHeader ();
- m_->ui_.log_table_view->verticalHeader()->setVisible(false); // turn off line numbers for the table view
- h_header->moveSection (7, 1); // band to first column
-
-}
-
-CabrilloLogWindow::~CabrilloLogWindow ()
-{
-}
-
-void CabrilloLogWindow::log_model_changed (int row)
-{
- if (row >= 0)
- {
- m_->log_model_->selectRow (row);
- }
- else
- {
- m_->log_model_->select ();
- }
-}
-
-void CabrilloLogWindow::set_nQSO(int n)
-{
- QString t;
- t=t.asprintf("%d QSOs",n);
- m_->ui_.nQSO_lineEdit->setText(t);
-}
+#include "CabrilloLogWindow.hpp" + +#include <stdexcept> +#include <QApplication> +#include <QIdentityProxyModel> +#include <QSqlTableModel> +#include "Configuration.hpp" +#include "models/Bands.hpp" +#include "item_delegates/FrequencyDelegate.hpp" +#include "item_delegates/ForeignKeyDelegate.hpp" +#include "item_delegates/CallsignDelegate.hpp" +#include "item_delegates/SQLiteDateTimeDelegate.hpp" +#include "pimpl_impl.hpp" + +#include "ui_CabrilloLogWindow.h" + +namespace +{ + class FormatProxyModel final + : public QIdentityProxyModel + { + public: + explicit FormatProxyModel (QObject * parent = nullptr) + : QIdentityProxyModel {parent} + { + } + + QVariant data (QModelIndex const& index, int role) const override + { + if (Qt::TextAlignmentRole == role && index.isValid ()) + { + switch (index.column ()) + { + case 1: + case 7: + return Qt::AlignRight + Qt::AlignVCenter; + default: + break; + } + } + return QIdentityProxyModel::data (index, role); + } + }; +} + +class CabrilloLogWindow::impl final +{ +public: + explicit impl (QSqlTableModel * log_model) + : log_model_ {log_model} + { + } + + QSqlTableModel * log_model_; + FormatProxyModel format_model_; + Ui::CabrilloLogWindow ui_; +}; + +CabrilloLogWindow::CabrilloLogWindow (QSettings * settings, Configuration const * configuration + , QSqlTableModel * cabrillo_log_model, QWidget * parent) + : AbstractLogWindow {"Cabrillo Log Window", settings, configuration, parent} + , m_{cabrillo_log_model} +{ + setWindowTitle (QApplication::applicationName () + " - Cabrillo Log"); + m_->ui_.setupUi (this); + m_->format_model_.setSourceModel (m_->log_model_); + m_->ui_.log_table_view->setModel (&m_->format_model_); + set_log_view (m_->ui_.log_table_view); + m_->ui_.log_table_view->setItemDelegateForColumn (1, new FrequencyDelegate {this}); + m_->ui_.log_table_view->setItemDelegateForColumn (3, new SQLiteDateTimeDelegate {this}); + m_->ui_.log_table_view->setItemDelegateForColumn (4, new CallsignDelegate {this}); + auto h_header = m_->ui_.log_table_view->horizontalHeader (); + m_->ui_.log_table_view->verticalHeader()->setVisible(false); // turn off line numbers for the table view + h_header->moveSection (7, 1); // band to first column + +} + +CabrilloLogWindow::~CabrilloLogWindow () +{ +} + +void CabrilloLogWindow::log_model_changed (int row) +{ + if (row >= 0) + { + m_->log_model_->selectRow (row); + } + else + { + m_->log_model_->select (); + } +} + +void CabrilloLogWindow::set_nQSO(int n) +{ + QString t; + t=t.asprintf("%d QSOs",n); + m_->ui_.nQSO_lineEdit->setText(t); +} diff --git a/widgets/CabrilloLogWindow.hpp b/widgets/CabrilloLogWindow.hpp index aa221e91..25780bc5 100755..100644 --- a/widgets/CabrilloLogWindow.hpp +++ b/widgets/CabrilloLogWindow.hpp @@ -1,28 +1,28 @@ -#ifndef CABRILLO_LOG_WINDOW_HPP_
-#define CABRILLO_LOG_WINDOW_HPP_
-
-#include "AbstractLogWindow.hpp"
-#include "pimpl_h.hpp"
-
-class QSettings;
-class Configuration;
-class QFont;
-class QSqlTableModel;
-
-class CabrilloLogWindow final
- : public AbstractLogWindow
-{
-public:
- explicit CabrilloLogWindow (QSettings *, Configuration const *, QSqlTableModel * cabrillo_log_model
- , QWidget * parent = nullptr);
- ~CabrilloLogWindow ();
- Q_SLOT void set_nQSO(int n);
-
-private:
- void log_model_changed (int row) override;
-
- class impl;
- pimpl<impl> m_;
-};
-
-#endif
+#ifndef CABRILLO_LOG_WINDOW_HPP_ +#define CABRILLO_LOG_WINDOW_HPP_ + +#include "AbstractLogWindow.hpp" +#include "pimpl_h.hpp" + +class QSettings; +class Configuration; +class QFont; +class QSqlTableModel; + +class CabrilloLogWindow final + : public AbstractLogWindow +{ +public: + explicit CabrilloLogWindow (QSettings *, Configuration const *, QSqlTableModel * cabrillo_log_model + , QWidget * parent = nullptr); + ~CabrilloLogWindow (); + Q_SLOT void set_nQSO(int n); + +private: + void log_model_changed (int row) override; + + class impl; + pimpl<impl> m_; +}; + +#endif diff --git a/widgets/CabrilloLogWindow.ui b/widgets/CabrilloLogWindow.ui index b1391910..5f31b068 100755..100644 --- a/widgets/CabrilloLogWindow.ui +++ b/widgets/CabrilloLogWindow.ui @@ -1,53 +1,53 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>CabrilloLogWindow</class>
- <widget class="QWidget" name="CabrilloLogWindow">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>493</width>
- <height>210</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Contest Log</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QTableView" name="log_table_view">
- <property name="toolTip">
- <string><html><head/><body><p>Right-click here for available actions.</p></body></html></string>
- </property>
- <property name="accessibleDescription">
- <string>Right-click here for available actions.</string>
- </property>
- <attribute name="horizontalHeaderStretchLastSection">
- <bool>true</bool>
- </attribute>
- </widget>
- </item>
- <item>
- <widget class="QLineEdit" name="nQSO_lineEdit">
- <property name="maximumSize">
- <size>
- <width>100</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="readOnly">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>0 QSOs</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
+<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>CabrilloLogWindow</class> + <widget class="QWidget" name="CabrilloLogWindow"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>493</width> + <height>210</height> + </rect> + </property> + <property name="windowTitle"> + <string>Contest Log</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QTableView" name="log_table_view"> + <property name="toolTip"> + <string><html><head/><body><p>Right-click here for available actions.</p></body></html></string> + </property> + <property name="accessibleDescription"> + <string>Right-click here for available actions.</string> + </property> + <attribute name="horizontalHeaderStretchLastSection"> + <bool>true</bool> + </attribute> + </widget> + </item> + <item> + <widget class="QLineEdit" name="nQSO_lineEdit"> + <property name="maximumSize"> + <size> + <width>100</width> + <height>16777215</height> + </size> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + <property name="text"> + <string>0 QSOs</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/widgets/CheckableItemComboBox.cpp b/widgets/CheckableItemComboBox.cpp index d3af4f49..13115c99 100755..100644 --- a/widgets/CheckableItemComboBox.cpp +++ b/widgets/CheckableItemComboBox.cpp @@ -1,93 +1,93 @@ -#include "CheckableItemComboBox.hpp"
-
-#include <QStyledItemDelegate>
-#include <QStandardItemModel>
-#include <QStandardItem>
-#include <QLineEdit>
-#include <QEvent>
-#include <QListView>
-
-class CheckableItemComboBoxStyledItemDelegate
- : public QStyledItemDelegate
-{
-public:
- explicit CheckableItemComboBoxStyledItemDelegate (QObject * parent = nullptr)
- : QStyledItemDelegate {parent}
- {
- }
-
- void paint (QPainter * painter, QStyleOptionViewItem const& option, QModelIndex const& index) const override
- {
- QStyleOptionViewItem& mutable_option = const_cast<QStyleOptionViewItem&> (option);
- mutable_option.showDecorationSelected = false;
- QStyledItemDelegate::paint (painter, mutable_option, index);
- }
-};
-
-CheckableItemComboBox::CheckableItemComboBox (QWidget * parent)
- : LazyFillComboBox {parent}
- , model_ {new QStandardItemModel()}
-{
- setModel (model_.data ());
-
- setEditable (true);
- lineEdit ()->setReadOnly (true);
- lineEdit ()->installEventFilter (this);
- setItemDelegate (new CheckableItemComboBoxStyledItemDelegate {this});
-
- connect (lineEdit(), &QLineEdit::selectionChanged, lineEdit(), &QLineEdit::deselect);
- connect (static_cast<QListView *> (view ()), &QListView::pressed, this, &CheckableItemComboBox::item_pressed);
- connect (model_.data (), &QStandardItemModel::dataChanged, this, &CheckableItemComboBox::model_data_changed);
-}
-
-QStandardItem * CheckableItemComboBox::addCheckItem (QString const& label, QVariant const& data
- , Qt::CheckState checkState)
-{
- auto * item = new QStandardItem {label};
- item->setCheckState (checkState);
- item->setData (data);
- item->setFlags (Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
- model_->appendRow (item);
- update_text ();
- return item;
-}
-
-bool CheckableItemComboBox::eventFilter (QObject * object, QEvent * event)
-{
- if (object == lineEdit() && event->type () == QEvent::MouseButtonPress)
- {
- showPopup();
- return true;
- }
- return false;
-}
-
-void CheckableItemComboBox::update_text()
-{
- QString text;
- for (int i = 0; i < model_->rowCount (); ++i)
- {
- if (model_->item (i)->checkState () == Qt::Checked)
- {
- if (text.size ())
- {
- text+= ", ";
- }
- text += model_->item (i)->data ().toString ();
- }
- }
- lineEdit ()->setText (text);
-}
-
-void CheckableItemComboBox::model_data_changed ()
-{
- update_text ();
-}
-
-void CheckableItemComboBox::item_pressed (QModelIndex const& index)
-{
- QStandardItem * item = model_->itemFromIndex (index);
- item->setCheckState (item->checkState () == Qt::Checked ? Qt::Unchecked : Qt::Checked);
-}
-
-#include "widgets/moc_CheckableItemComboBox.cpp"
+#include "CheckableItemComboBox.hpp" + +#include <QStyledItemDelegate> +#include <QStandardItemModel> +#include <QStandardItem> +#include <QLineEdit> +#include <QEvent> +#include <QListView> + +class CheckableItemComboBoxStyledItemDelegate + : public QStyledItemDelegate +{ +public: + explicit CheckableItemComboBoxStyledItemDelegate (QObject * parent = nullptr) + : QStyledItemDelegate {parent} + { + } + + void paint (QPainter * painter, QStyleOptionViewItem const& option, QModelIndex const& index) const override + { + QStyleOptionViewItem& mutable_option = const_cast<QStyleOptionViewItem&> (option); + mutable_option.showDecorationSelected = false; + QStyledItemDelegate::paint (painter, mutable_option, index); + } +}; + +CheckableItemComboBox::CheckableItemComboBox (QWidget * parent) + : LazyFillComboBox {parent} + , model_ {new QStandardItemModel()} +{ + setModel (model_.data ()); + + setEditable (true); + lineEdit ()->setReadOnly (true); + lineEdit ()->installEventFilter (this); + setItemDelegate (new CheckableItemComboBoxStyledItemDelegate {this}); + + connect (lineEdit(), &QLineEdit::selectionChanged, lineEdit(), &QLineEdit::deselect); + connect (static_cast<QListView *> (view ()), &QListView::pressed, this, &CheckableItemComboBox::item_pressed); + connect (model_.data (), &QStandardItemModel::dataChanged, this, &CheckableItemComboBox::model_data_changed); +} + +QStandardItem * CheckableItemComboBox::addCheckItem (QString const& label, QVariant const& data + , Qt::CheckState checkState) +{ + auto * item = new QStandardItem {label}; + item->setCheckState (checkState); + item->setData (data); + item->setFlags (Qt::ItemIsUserCheckable | Qt::ItemIsEnabled); + model_->appendRow (item); + update_text (); + return item; +} + +bool CheckableItemComboBox::eventFilter (QObject * object, QEvent * event) +{ + if (object == lineEdit() && event->type () == QEvent::MouseButtonPress) + { + showPopup(); + return true; + } + return false; +} + +void CheckableItemComboBox::update_text() +{ + QString text; + for (int i = 0; i < model_->rowCount (); ++i) + { + if (model_->item (i)->checkState () == Qt::Checked) + { + if (text.size ()) + { + text+= ", "; + } + text += model_->item (i)->data ().toString (); + } + } + lineEdit ()->setText (text); +} + +void CheckableItemComboBox::model_data_changed () +{ + update_text (); +} + +void CheckableItemComboBox::item_pressed (QModelIndex const& index) +{ + QStandardItem * item = model_->itemFromIndex (index); + item->setCheckState (item->checkState () == Qt::Checked ? Qt::Unchecked : Qt::Checked); +} + +#include "widgets/moc_CheckableItemComboBox.cpp" diff --git a/widgets/CheckableItemComboBox.hpp b/widgets/CheckableItemComboBox.hpp index 21223536..21e75116 100755..100644 --- a/widgets/CheckableItemComboBox.hpp +++ b/widgets/CheckableItemComboBox.hpp @@ -1,37 +1,37 @@ -#ifndef CHECKABLE_ITEM_COMBO_BOX_HPP__
-#define CHECKABLE_ITEM_COMBO_BOX_HPP__
-
-#include <QScopedPointer>
-
-#include "LazyFillComboBox.hpp"
-
-class QStandardItemModel;
-class QStandardItem;
-
-/**
- * @brief QComboBox with support of checkboxes
- * http://stackoverflow.com/questions/8422760/combobox-of-checkboxes
- */
-class CheckableItemComboBox
- : public LazyFillComboBox
-{
- Q_OBJECT
-
-public:
- explicit CheckableItemComboBox (QWidget * parent = nullptr);
- QStandardItem * addCheckItem (QString const& label, QVariant const& data, Qt::CheckState checkState);
-
-protected:
- bool eventFilter (QObject *, QEvent *) override;
-
-private:
- void update_text();
-
- Q_SLOT void model_data_changed ();
- Q_SLOT void item_pressed (QModelIndex const&);
-
-private:
- QScopedPointer<QStandardItemModel> model_;
-};
-
-#endif
+#ifndef CHECKABLE_ITEM_COMBO_BOX_HPP__ +#define CHECKABLE_ITEM_COMBO_BOX_HPP__ + +#include <QScopedPointer> + +#include "LazyFillComboBox.hpp" + +class QStandardItemModel; +class QStandardItem; + +/** + * @brief QComboBox with support of checkboxes + * http://stackoverflow.com/questions/8422760/combobox-of-checkboxes + */ +class CheckableItemComboBox + : public LazyFillComboBox +{ + Q_OBJECT + +public: + explicit CheckableItemComboBox (QWidget * parent = nullptr); + QStandardItem * addCheckItem (QString const& label, QVariant const& data, Qt::CheckState checkState); + +protected: + bool eventFilter (QObject *, QEvent *) override; + +private: + void update_text(); + + Q_SLOT void model_data_changed (); + Q_SLOT void item_pressed (QModelIndex const&); + +private: + QScopedPointer<QStandardItemModel> model_; +}; + +#endif diff --git a/widgets/DateTimeEdit.hpp b/widgets/DateTimeEdit.hpp index 2e7ed614..ad767a55 100755..100644 --- a/widgets/DateTimeEdit.hpp +++ b/widgets/DateTimeEdit.hpp @@ -1,23 +1,23 @@ -#ifndef DATE_TIME_EDIT_HPP_
-#define DATE_TIME_EDIT_HPP_
-
-#include <QDateTimeEdit>
-
-class QWidget;
-
-//
-// DateTimeEdit - format includes seconds
-//
-class DateTimeEdit final
- : public QDateTimeEdit
-{
-public:
- explicit DateTimeEdit (QWidget * parent = nullptr)
- : QDateTimeEdit {parent}
- {
- setDisplayFormat (locale ().dateFormat (QLocale::ShortFormat) + " hh:mm:ss");
- setTimeSpec (Qt::UTC);
- }
-};
-
-#endif
+#ifndef DATE_TIME_EDIT_HPP_ +#define DATE_TIME_EDIT_HPP_ + +#include <QDateTimeEdit> + +class QWidget; + +// +// DateTimeEdit - format includes seconds +// +class DateTimeEdit final + : public QDateTimeEdit +{ +public: + explicit DateTimeEdit (QWidget * parent = nullptr) + : QDateTimeEdit {parent} + { + setDisplayFormat (locale ().dateFormat (QLocale::ShortFormat) + " hh:mm:ss"); + setTimeSpec (Qt::UTC); + } +}; + +#endif diff --git a/widgets/DecodeHighlightingListView.cpp b/widgets/DecodeHighlightingListView.cpp index 4847f1e6..cfb14fc5 100755..100644 --- a/widgets/DecodeHighlightingListView.cpp +++ b/widgets/DecodeHighlightingListView.cpp @@ -1,74 +1,74 @@ -#include "DecodeHighlightingListView.hpp"
-
-#include <QAction>
-#include <QColorDialog>
-
-#include "models/DecodeHighlightingModel.hpp"
-#include "MessageBox.hpp"
-
-#include "moc_DecodeHighlightingListView.cpp"
-
-DecodeHighlightingListView::DecodeHighlightingListView (QWidget * parent)
- : QListView {parent}
-{
- auto * fg_colour_action = new QAction {tr ("&Foreground color ..."), this};
- addAction (fg_colour_action);
- connect (fg_colour_action, &QAction::triggered, [this] (bool /*checked*/) {
- auto const& index = currentIndex ();
- auto colour = QColorDialog::getColor (model ()->data (index, Qt::ForegroundRole).value<QBrush> ().color ()
- , this
- , tr ("Choose %1 Foreground Color")
- .arg (model ()->data (index).toString ()));
- if (colour.isValid ())
- {
- model ()->setData (index, QBrush {colour}, Qt::ForegroundRole);
- }
- });
-
- auto * unset_fg_colour_action = new QAction {tr ("&Unset foreground color"), this};
- addAction (unset_fg_colour_action);
- connect (unset_fg_colour_action, &QAction::triggered, [this] (bool /*checked*/) {
- model ()->setData (currentIndex (), QBrush {}, Qt::ForegroundRole);
- });
-
- auto * bg_colour_action = new QAction {tr ("&Background color ..."), this};
- addAction (bg_colour_action);
- connect (bg_colour_action, &QAction::triggered, [this] (bool /*checked*/) {
- auto const& index = currentIndex ();
- auto colour = QColorDialog::getColor (model ()->data (index, Qt::BackgroundRole).value<QBrush> ().color ()
- , this
- , tr ("Choose %1 Background Color")
- .arg (model ()->data (index).toString ()));
- if (colour.isValid ())
- {
- model ()->setData (index, QBrush {colour}, Qt::BackgroundRole);
- }
- });
-
- auto * unset_bg_colour_action = new QAction {tr ("U&nset background color"), this};
- addAction (unset_bg_colour_action);
- connect (unset_bg_colour_action, &QAction::triggered, [this] (bool /*checked*/) {
- model ()->setData (currentIndex (), QBrush {}, Qt::BackgroundRole);
- });
-
- auto * defaults_action = new QAction {tr ("&Reset this item to defaults"), this};
- addAction (defaults_action);
- connect (defaults_action, &QAction::triggered, [this] (bool /*checked*/) {
- auto const& index = currentIndex ();
- model ()->setData (index, model ()->data (index, DecodeHighlightingModel::EnabledDefaultRole).toBool () ? Qt::Checked : Qt::Unchecked, Qt::CheckStateRole);
- model ()->setData (index, model ()->data (index, DecodeHighlightingModel::ForegroundDefaultRole), Qt::ForegroundRole);
- model ()->setData (index, model ()->data (index, DecodeHighlightingModel::BackgroundDefaultRole), Qt::BackgroundRole);
- });
-}
-
-QSize DecodeHighlightingListView::sizeHint () const
-{
- auto item_height = sizeHintForRow (0);
- if (item_height >= 0)
- {
- // set the height hint to exactly the space required for all the
- // items
- return {width (), (model ()->rowCount () * (item_height + 2 * spacing ())) + 2 * frameWidth ()};
- }
- return QListView::sizeHint ();
-}
+#include "DecodeHighlightingListView.hpp" + +#include <QAction> +#include <QColorDialog> + +#include "models/DecodeHighlightingModel.hpp" +#include "MessageBox.hpp" + +#include "moc_DecodeHighlightingListView.cpp" + +DecodeHighlightingListView::DecodeHighlightingListView (QWidget * parent) + : QListView {parent} +{ + auto * fg_colour_action = new QAction {tr ("&Foreground color ..."), this}; + addAction (fg_colour_action); + connect (fg_colour_action, &QAction::triggered, [this] (bool /*checked*/) { + auto const& index = currentIndex (); + auto colour = QColorDialog::getColor (model ()->data (index, Qt::ForegroundRole).value<QBrush> ().color () + , this + , tr ("Choose %1 Foreground Color") + .arg (model ()->data (index).toString ())); + if (colour.isValid ()) + { + model ()->setData (index, QBrush {colour}, Qt::ForegroundRole); + } + }); + + auto * unset_fg_colour_action = new QAction {tr ("&Unset foreground color"), this}; + addAction (unset_fg_colour_action); + connect (unset_fg_colour_action, &QAction::triggered, [this] (bool /*checked*/) { + model ()->setData (currentIndex (), QBrush {}, Qt::ForegroundRole); + }); + + auto * bg_colour_action = new QAction {tr ("&Background color ..."), this}; + addAction (bg_colour_action); + connect (bg_colour_action, &QAction::triggered, [this] (bool /*checked*/) { + auto const& index = currentIndex (); + auto colour = QColorDialog::getColor (model ()->data (index, Qt::BackgroundRole).value<QBrush> ().color () + , this + , tr ("Choose %1 Background Color") + .arg (model ()->data (index).toString ())); + if (colour.isValid ()) + { + model ()->setData (index, QBrush {colour}, Qt::BackgroundRole); + } + }); + + auto * unset_bg_colour_action = new QAction {tr ("U&nset background color"), this}; + addAction (unset_bg_colour_action); + connect (unset_bg_colour_action, &QAction::triggered, [this] (bool /*checked*/) { + model ()->setData (currentIndex (), QBrush {}, Qt::BackgroundRole); + }); + + auto * defaults_action = new QAction {tr ("&Reset this item to defaults"), this}; + addAction (defaults_action); + connect (defaults_action, &QAction::triggered, [this] (bool /*checked*/) { + auto const& index = currentIndex (); + model ()->setData (index, model ()->data (index, DecodeHighlightingModel::EnabledDefaultRole).toBool () ? Qt::Checked : Qt::Unchecked, Qt::CheckStateRole); + model ()->setData (index, model ()->data (index, DecodeHighlightingModel::ForegroundDefaultRole), Qt::ForegroundRole); + model ()->setData (index, model ()->data (index, DecodeHighlightingModel::BackgroundDefaultRole), Qt::BackgroundRole); + }); +} + +QSize DecodeHighlightingListView::sizeHint () const +{ + auto item_height = sizeHintForRow (0); + if (item_height >= 0) + { + // set the height hint to exactly the space required for all the + // items + return {width (), (model ()->rowCount () * (item_height + 2 * spacing ())) + 2 * frameWidth ()}; + } + return QListView::sizeHint (); +} diff --git a/widgets/DecodeHighlightingListView.hpp b/widgets/DecodeHighlightingListView.hpp index 9d0b94b5..76fd507b 100755..100644 --- a/widgets/DecodeHighlightingListView.hpp +++ b/widgets/DecodeHighlightingListView.hpp @@ -1,28 +1,28 @@ -#ifndef DECODE_HIGHLIGHTING_LIST_VIEW_HPP_
-#define DECODE_HIGHLIGHTING_LIST_VIEW_HPP_
-
-#include <QListView>
-
-class QWidget;
-
-// Class Decode Highlighting List View
-//
-// Sub-class of a QListView that adds a context menu to adjust the
-// foreground and background colour roles of the the underlying model
-// item that lies at the context menu right-click position. It also
-// constrains the vertical size hint to limit the height to exactly
-// that of the sum of the items.
-//
-class DecodeHighlightingListView final
- : public QListView
-{
- Q_OBJECT
-
-public:
- explicit DecodeHighlightingListView (QWidget * parent = nullptr);
-
-private:
- QSize sizeHint () const override;
-};
-
-#endif
+#ifndef DECODE_HIGHLIGHTING_LIST_VIEW_HPP_ +#define DECODE_HIGHLIGHTING_LIST_VIEW_HPP_ + +#include <QListView> + +class QWidget; + +// Class Decode Highlighting List View +// +// Sub-class of a QListView that adds a context menu to adjust the +// foreground and background colour roles of the the underlying model +// item that lies at the context menu right-click position. It also +// constrains the vertical size hint to limit the height to exactly +// that of the sum of the items. +// +class DecodeHighlightingListView final + : public QListView +{ + Q_OBJECT + +public: + explicit DecodeHighlightingListView (QWidget * parent = nullptr); + +private: + QSize sizeHint () const override; +}; + +#endif diff --git a/widgets/DoubleClickablePushButton.cpp b/widgets/DoubleClickablePushButton.cpp index b1602cea..2c37a55e 100755..100644 --- a/widgets/DoubleClickablePushButton.cpp +++ b/widgets/DoubleClickablePushButton.cpp @@ -1,14 +1,14 @@ -#include "DoubleClickablePushButton.hpp"
-
-#include "moc_DoubleClickablePushButton.cpp"
-
-DoubleClickablePushButton::DoubleClickablePushButton (QWidget * parent)
- : QPushButton {parent}
-{
-}
-
-void DoubleClickablePushButton::mouseDoubleClickEvent (QMouseEvent * event)
-{
- Q_EMIT doubleClicked ();
- QPushButton::mouseDoubleClickEvent (event);
-}
+#include "DoubleClickablePushButton.hpp" + +#include "moc_DoubleClickablePushButton.cpp" + +DoubleClickablePushButton::DoubleClickablePushButton (QWidget * parent) + : QPushButton {parent} +{ +} + +void DoubleClickablePushButton::mouseDoubleClickEvent (QMouseEvent * event) +{ + Q_EMIT doubleClicked (); + QPushButton::mouseDoubleClickEvent (event); +} diff --git a/widgets/DoubleClickablePushButton.hpp b/widgets/DoubleClickablePushButton.hpp index 178748f7..ebc1ab84 100755..100644 --- a/widgets/DoubleClickablePushButton.hpp +++ b/widgets/DoubleClickablePushButton.hpp @@ -1,27 +1,27 @@ -#ifndef DOUBLE_CLICKABLE_PUSH_BUTTON_HPP_
-#define DOUBLE_CLICKABLE_PUSH_BUTTON_HPP_
-
-#include <QPushButton>
-
-//
-// DoubleClickablePushButton - QPushButton that emits a mouse double
-// click signal
-//
-// Clients should be aware of the QWidget::mouseDoubleClickEvent()
-// notes about receipt of mouse press and mouse release events.
-//
-class DoubleClickablePushButton
- : public QPushButton
-{
- Q_OBJECT
-
-public:
- DoubleClickablePushButton (QWidget * = nullptr);
-
- Q_SIGNAL void doubleClicked ();
-
-protected:
- void mouseDoubleClickEvent (QMouseEvent *) override;
-};
-
-#endif
+#ifndef DOUBLE_CLICKABLE_PUSH_BUTTON_HPP_ +#define DOUBLE_CLICKABLE_PUSH_BUTTON_HPP_ + +#include <QPushButton> + +// +// DoubleClickablePushButton - QPushButton that emits a mouse double +// click signal +// +// Clients should be aware of the QWidget::mouseDoubleClickEvent() +// notes about receipt of mouse press and mouse release events. +// +class DoubleClickablePushButton + : public QPushButton +{ + Q_OBJECT + +public: + DoubleClickablePushButton (QWidget * = nullptr); + + Q_SIGNAL void doubleClicked (); + +protected: + void mouseDoubleClickEvent (QMouseEvent *) override; +}; + +#endif diff --git a/widgets/DoubleClickableRadioButton.cpp b/widgets/DoubleClickableRadioButton.cpp index d0173180..892b3c29 100755..100644 --- a/widgets/DoubleClickableRadioButton.cpp +++ b/widgets/DoubleClickableRadioButton.cpp @@ -1,14 +1,14 @@ -#include "DoubleClickableRadioButton.hpp"
-
-#include "moc_DoubleClickableRadioButton.cpp"
-
-DoubleClickableRadioButton::DoubleClickableRadioButton (QWidget * parent)
- : QRadioButton {parent}
-{
-}
-
-void DoubleClickableRadioButton::mouseDoubleClickEvent (QMouseEvent * event)
-{
- Q_EMIT doubleClicked ();
- QRadioButton::mouseDoubleClickEvent (event);
-}
+#include "DoubleClickableRadioButton.hpp" + +#include "moc_DoubleClickableRadioButton.cpp" + +DoubleClickableRadioButton::DoubleClickableRadioButton (QWidget * parent) + : QRadioButton {parent} +{ +} + +void DoubleClickableRadioButton::mouseDoubleClickEvent (QMouseEvent * event) +{ + Q_EMIT doubleClicked (); + QRadioButton::mouseDoubleClickEvent (event); +} diff --git a/widgets/DoubleClickableRadioButton.hpp b/widgets/DoubleClickableRadioButton.hpp index 84914fbd..dec715ab 100755..100644 --- a/widgets/DoubleClickableRadioButton.hpp +++ b/widgets/DoubleClickableRadioButton.hpp @@ -1,27 +1,27 @@ -#ifndef DOUBLE_CLICKABLE_RADIO_BUTTON_HPP_
-#define DOUBLE_CLICKABLE_RADIO_BUTTON_HPP_
-
-#include <QRadioButton>
-
-//
-// DoubleClickableRadioButton - QRadioButton that emits a mouse double
-// click signal
-//
-// Clients should be aware of the QWidget::mouseDoubleClickEvent()
-// notes about receipt of mouse press and mouse release events.
-//
-class DoubleClickableRadioButton
- : public QRadioButton
-{
- Q_OBJECT
-
-public:
- DoubleClickableRadioButton (QWidget * = nullptr);
-
- Q_SIGNAL void doubleClicked ();
-
-protected:
- void mouseDoubleClickEvent (QMouseEvent *) override;
-};
-
-#endif
+#ifndef DOUBLE_CLICKABLE_RADIO_BUTTON_HPP_ +#define DOUBLE_CLICKABLE_RADIO_BUTTON_HPP_ + +#include <QRadioButton> + +// +// DoubleClickableRadioButton - QRadioButton that emits a mouse double +// click signal +// +// Clients should be aware of the QWidget::mouseDoubleClickEvent() +// notes about receipt of mouse press and mouse release events. +// +class DoubleClickableRadioButton + : public QRadioButton +{ + Q_OBJECT + +public: + DoubleClickableRadioButton (QWidget * = nullptr); + + Q_SIGNAL void doubleClicked (); + +protected: + void mouseDoubleClickEvent (QMouseEvent *) override; +}; + +#endif diff --git a/widgets/ExportCabrillo.cpp b/widgets/ExportCabrillo.cpp index 84196c21..9a20d756 100755..100644 --- a/widgets/ExportCabrillo.cpp +++ b/widgets/ExportCabrillo.cpp @@ -1,117 +1,117 @@ -#include "ExportCabrillo.h"
-
-#include <QApplication>
-#include <QFileDialog>
-#include <QDir>
-#include <QDebug>
-
-#include "SettingsGroup.hpp"
-#include "Configuration.hpp"
-#include "MessageBox.hpp"
-#include "models/CabrilloLog.hpp"
-
-#include "ui_ExportCabrillo.h"
-#include "moc_ExportCabrillo.cpp"
-
-ExportCabrillo::ExportCabrillo (QSettings * settings, Configuration const * configuration
- , CabrilloLog const * log, QWidget * parent)
- : QDialog {parent},
- settings_ {settings},
- configuration_ {configuration},
- log_ {log},
- ui {new Ui::ExportCabrillo}
-{
- ui->setupUi (this);
- read_settings ();
- setWindowTitle (QApplication::applicationName() + " - Export Cabrillo");
- connect (ui->buttonBox, &QDialogButtonBox::accepted, this, &ExportCabrillo::save_log);
-}
-
-ExportCabrillo::~ExportCabrillo ()
-{
- write_settings ();
-}
-
-void ExportCabrillo::read_settings ()
-{
- SettingsGroup group {settings_, "ExportCabrillo"};
- restoreGeometry (settings_->value("window/geometry").toByteArray());
- ui->location_line_edit->setText(settings_->value("Location").toString());
- ui->contest_line_edit->setText(settings_->value("Contest").toString());
- ui->call_line_edit->setText(settings_->value("Callsign").toString());
- ui->category_op_line_edit->setText(settings_->value("Category-Operator").toString());
- ui->category_xmtr_line_edit->setText(settings_->value("Category-Transmitter").toString());
- ui->category_pwr_line_edit->setText(settings_->value("Category-Power").toString());
- ui->category_assisted_line_edit->setText(settings_->value("Category-Assisted").toString());
- ui->category_band_line_edit->setText(settings_->value("Category-Band").toString());
- ui->claimed_line_edit->setText(settings_->value("Claimed-Score").toString());
- ui->operators_line_edit->setText(settings_->value("Operators").toString());
- ui->club_line_edit->setText(settings_->value("Club").toString());
- ui->name_line_edit->setText(settings_->value("Name").toString());
- ui->addr_1_line_edit->setText(settings_->value("Address1").toString());
- ui->addr_2_line_edit->setText(settings_->value("Address2").toString());
-}
-
-void ExportCabrillo::write_settings ()
-{
- SettingsGroup group {settings_, "ExportCabrillo"};
- settings_->setValue ("window/geometry", saveGeometry ());
- settings_->setValue("Location",ui->location_line_edit->text());
- settings_->setValue("Contest",ui->contest_line_edit->text());
- settings_->setValue("Callsign",ui->call_line_edit->text());
- settings_->setValue("Category-Operator",ui->category_op_line_edit->text());
- settings_->setValue("Category-Transmitter",ui->category_xmtr_line_edit->text());
- settings_->setValue("Category-Power",ui->category_pwr_line_edit->text());
- settings_->setValue("Category-Assisted",ui->category_assisted_line_edit->text());
- settings_->setValue("Category-Band",ui->category_band_line_edit->text());
- settings_->setValue("Claimed-Score",ui->claimed_line_edit->text());
- settings_->setValue("Operators",ui->operators_line_edit->text());
- settings_->setValue("Club",ui->club_line_edit->text());
- settings_->setValue("Name",ui->name_line_edit->text());
- settings_->setValue("Address1",ui->addr_1_line_edit->text());
- settings_->setValue("Address2",ui->addr_2_line_edit->text());
-}
-
-void ExportCabrillo::save_log ()
-{
- auto fname = QFileDialog::getSaveFileName (this
- , tr ("Save Log File")
- , configuration_->writeable_data_dir ().absolutePath ()
- , tr ("Cabrillo Log (*.cbr)"));
- if (fname.size ())
- {
- QFile f {fname};
- if (f.open (QIODevice::WriteOnly | QIODevice::Text)) {
- QTextStream out {&f};
- out << "START-OF-LOG:3.0\n"
- << "LOCATION: " << ui->location_line_edit->text() << '\n'
- << "CONTEST: " << ui->contest_line_edit->text() << '\n'
- << "CALLSIGN: " << ui->call_line_edit->text() << '\n'
- << "CATEGORY-OPERATOR: " << ui->category_op_line_edit->text() << '\n'
- << "CATEGORY-TRANSMITTER: " << ui->category_xmtr_line_edit->text() << '\n'
- << "CATEGORY-POWER: " << ui->category_pwr_line_edit->text() << '\n'
- << "CATEGORY-ASSISTED: " << ui->category_assisted_line_edit->text() << '\n'
- << "CATEGORY-BAND: " << ui->category_band_line_edit->text() << '\n'
- << "CLAIMED-SCORE: " << ui->claimed_line_edit->text() << '\n'
- << "OPERATORS: " << ui->operators_line_edit->text() << '\n'
- << "CLUB: " << ui->club_line_edit->text() << '\n'
- << "NAME: " << ui->name_line_edit->text() << '\n'
- << "ADDRESS: " << ui->addr_1_line_edit->text() << '\n'
- << "ADDRESS: " << ui->addr_2_line_edit->text() << '\n';
- if (log_) log_->export_qsos (out);
- out << "END-OF-LOG:"
-#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0)
- << Qt::endl
-#else
- << endl
-#endif
- ;
- return;
- } else {
- auto const& message = tr ("Cannot open \"%1\" for writing: %2")
- .arg (f.fileName ()).arg (f.errorString ());
- MessageBox::warning_message (this, tr ("Export Cabrillo File Error"), message);
- }
- }
- setResult (Rejected);
-}
+#include "ExportCabrillo.h" + +#include <QApplication> +#include <QFileDialog> +#include <QDir> +#include <QDebug> + +#include "SettingsGroup.hpp" +#include "Configuration.hpp" +#include "MessageBox.hpp" +#include "models/CabrilloLog.hpp" + +#include "ui_ExportCabrillo.h" +#include "moc_ExportCabrillo.cpp" + +ExportCabrillo::ExportCabrillo (QSettings * settings, Configuration const * configuration + , CabrilloLog const * log, QWidget * parent) + : QDialog {parent}, + settings_ {settings}, + configuration_ {configuration}, + log_ {log}, + ui {new Ui::ExportCabrillo} +{ + ui->setupUi (this); + read_settings (); + setWindowTitle (QApplication::applicationName() + " - Export Cabrillo"); + connect (ui->buttonBox, &QDialogButtonBox::accepted, this, &ExportCabrillo::save_log); +} + +ExportCabrillo::~ExportCabrillo () +{ + write_settings (); +} + +void ExportCabrillo::read_settings () +{ + SettingsGroup group {settings_, "ExportCabrillo"}; + restoreGeometry (settings_->value("window/geometry").toByteArray()); + ui->location_line_edit->setText(settings_->value("Location").toString()); + ui->contest_line_edit->setText(settings_->value("Contest").toString()); + ui->call_line_edit->setText(settings_->value("Callsign").toString()); + ui->category_op_line_edit->setText(settings_->value("Category-Operator").toString()); + ui->category_xmtr_line_edit->setText(settings_->value("Category-Transmitter").toString()); + ui->category_pwr_line_edit->setText(settings_->value("Category-Power").toString()); + ui->category_assisted_line_edit->setText(settings_->value("Category-Assisted").toString()); + ui->category_band_line_edit->setText(settings_->value("Category-Band").toString()); + ui->claimed_line_edit->setText(settings_->value("Claimed-Score").toString()); + ui->operators_line_edit->setText(settings_->value("Operators").toString()); + ui->club_line_edit->setText(settings_->value("Club").toString()); + ui->name_line_edit->setText(settings_->value("Name").toString()); + ui->addr_1_line_edit->setText(settings_->value("Address1").toString()); + ui->addr_2_line_edit->setText(settings_->value("Address2").toString()); +} + +void ExportCabrillo::write_settings () +{ + SettingsGroup group {settings_, "ExportCabrillo"}; + settings_->setValue ("window/geometry", saveGeometry ()); + settings_->setValue("Location",ui->location_line_edit->text()); + settings_->setValue("Contest",ui->contest_line_edit->text()); + settings_->setValue("Callsign",ui->call_line_edit->text()); + settings_->setValue("Category-Operator",ui->category_op_line_edit->text()); + settings_->setValue("Category-Transmitter",ui->category_xmtr_line_edit->text()); + settings_->setValue("Category-Power",ui->category_pwr_line_edit->text()); + settings_->setValue("Category-Assisted",ui->category_assisted_line_edit->text()); + settings_->setValue("Category-Band",ui->category_band_line_edit->text()); + settings_->setValue("Claimed-Score",ui->claimed_line_edit->text()); + settings_->setValue("Operators",ui->operators_line_edit->text()); + settings_->setValue("Club",ui->club_line_edit->text()); + settings_->setValue("Name",ui->name_line_edit->text()); + settings_->setValue("Address1",ui->addr_1_line_edit->text()); + settings_->setValue("Address2",ui->addr_2_line_edit->text()); +} + +void ExportCabrillo::save_log () +{ + auto fname = QFileDialog::getSaveFileName (this + , tr ("Save Log File") + , configuration_->writeable_data_dir ().absolutePath () + , tr ("Cabrillo Log (*.cbr)")); + if (fname.size ()) + { + QFile f {fname}; + if (f.open (QIODevice::WriteOnly | QIODevice::Text)) { + QTextStream out {&f}; + out << "START-OF-LOG:3.0\n" + << "LOCATION: " << ui->location_line_edit->text() << '\n' + << "CONTEST: " << ui->contest_line_edit->text() << '\n' + << "CALLSIGN: " << ui->call_line_edit->text() << '\n' + << "CATEGORY-OPERATOR: " << ui->category_op_line_edit->text() << '\n' + << "CATEGORY-TRANSMITTER: " << ui->category_xmtr_line_edit->text() << '\n' + << "CATEGORY-POWER: " << ui->category_pwr_line_edit->text() << '\n' + << "CATEGORY-ASSISTED: " << ui->category_assisted_line_edit->text() << '\n' + << "CATEGORY-BAND: " << ui->category_band_line_edit->text() << '\n' + << "CLAIMED-SCORE: " << ui->claimed_line_edit->text() << '\n' + << "OPERATORS: " << ui->operators_line_edit->text() << '\n' + << "CLUB: " << ui->club_line_edit->text() << '\n' + << "NAME: " << ui->name_line_edit->text() << '\n' + << "ADDRESS: " << ui->addr_1_line_edit->text() << '\n' + << "ADDRESS: " << ui->addr_2_line_edit->text() << '\n'; + if (log_) log_->export_qsos (out); + out << "END-OF-LOG:" +#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0) + << Qt::endl +#else + << endl +#endif + ; + return; + } else { + auto const& message = tr ("Cannot open \"%1\" for writing: %2") + .arg (f.fileName ()).arg (f.errorString ()); + MessageBox::warning_message (this, tr ("Export Cabrillo File Error"), message); + } + } + setResult (Rejected); +} diff --git a/widgets/ExportCabrillo.h b/widgets/ExportCabrillo.h index c1002638..0dfbf675 100755..100644 --- a/widgets/ExportCabrillo.h +++ b/widgets/ExportCabrillo.h @@ -1,36 +1,36 @@ -// -*- Mode: C++ -*-
-#ifndef EXPORTCABRILLO_H
-#define EXPORTCABRILLO_H
-
-#include <QDialog>
-#include <QScopedPointer>
-
-class QSettings;
-class Configuration;
-class CabrilloLog;
-namespace Ui {
- class ExportCabrillo;
-}
-
-class ExportCabrillo final
- : public QDialog
-{
- Q_OBJECT
-
-public:
- explicit ExportCabrillo (QSettings *, Configuration const *
- , CabrilloLog const *, QWidget * parent = nullptr);
- ~ExportCabrillo ();
-
-private:
- void read_settings();
- void write_settings();
- void save_log ();
-
- QSettings * settings_;
- Configuration const * configuration_;
- CabrilloLog const * log_;
- QScopedPointer<Ui::ExportCabrillo> ui;
-};
-
-#endif
+// -*- Mode: C++ -*- +#ifndef EXPORTCABRILLO_H +#define EXPORTCABRILLO_H + +#include <QDialog> +#include <QScopedPointer> + +class QSettings; +class Configuration; +class CabrilloLog; +namespace Ui { + class ExportCabrillo; +} + +class ExportCabrillo final + : public QDialog +{ + Q_OBJECT + +public: + explicit ExportCabrillo (QSettings *, Configuration const * + , CabrilloLog const *, QWidget * parent = nullptr); + ~ExportCabrillo (); + +private: + void read_settings(); + void write_settings(); + void save_log (); + + QSettings * settings_; + Configuration const * configuration_; + CabrilloLog const * log_; + QScopedPointer<Ui::ExportCabrillo> ui; +}; + +#endif diff --git a/widgets/ExportCabrillo.ui b/widgets/ExportCabrillo.ui index b1e8a8fc..eddbab9c 100755..100644 --- a/widgets/ExportCabrillo.ui +++ b/widgets/ExportCabrillo.ui @@ -1,331 +1,331 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>ExportCabrillo</class>
- <widget class="QDialog" name="ExportCabrillo">
- <property name="windowTitle">
- <string>Dialog</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <layout class="QFormLayout" name="formLayout">
- <item row="0" column="0">
- <widget class="QLabel" name="location_label">
- <property name="text">
- <string>Location:</string>
- </property>
- <property name="buddy">
- <cstring>location_line_edit</cstring>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QLineEdit" name="location_line_edit">
- <property name="text">
- <string>SNJ</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="contest_label">
- <property name="text">
- <string>Contest:</string>
- </property>
- <property name="buddy">
- <cstring>contest_line_edit</cstring>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QLineEdit" name="contest_line_edit">
- <property name="text">
- <string>ARRL-RTTY</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="call_label">
- <property name="text">
- <string>Callsign:</string>
- </property>
- <property name="buddy">
- <cstring>call_line_edit</cstring>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QLineEdit" name="call_line_edit">
- <property name="text">
- <string/>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="3" column="0">
- <widget class="QLabel" name="category_op_label">
- <property name="text">
- <string>Category-Operator: </string>
- </property>
- <property name="buddy">
- <cstring>category_op_line_edit</cstring>
- </property>
- </widget>
- </item>
- <item row="3" column="1">
- <widget class="QLineEdit" name="category_op_line_edit">
- <property name="text">
- <string>SINGLE-OP</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="4" column="0">
- <widget class="QLabel" name="category_xmtr_label">
- <property name="text">
- <string>Category-Transmitter:</string>
- </property>
- <property name="buddy">
- <cstring>category_xmtr_line_edit</cstring>
- </property>
- </widget>
- </item>
- <item row="4" column="1">
- <widget class="QLineEdit" name="category_xmtr_line_edit">
- <property name="text">
- <string>ONE</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="5" column="0">
- <widget class="QLabel" name="category_pwr_label">
- <property name="text">
- <string>Category-Power:</string>
- </property>
- <property name="buddy">
- <cstring>category_pwr_line_edit</cstring>
- </property>
- </widget>
- </item>
- <item row="5" column="1">
- <widget class="QLineEdit" name="category_pwr_line_edit">
- <property name="text">
- <string>LOW</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="6" column="0">
- <widget class="QLabel" name="category_assisted_label">
- <property name="text">
- <string>Category-Assisted:</string>
- </property>
- <property name="buddy">
- <cstring>category_assisted_line_edit</cstring>
- </property>
- </widget>
- </item>
- <item row="6" column="1">
- <widget class="QLineEdit" name="category_assisted_line_edit">
- <property name="text">
- <string>NON-ASSISTED</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="7" column="0">
- <widget class="QLabel" name="category_band_label">
- <property name="text">
- <string>Category-Band:</string>
- </property>
- <property name="buddy">
- <cstring>category_band_line_edit</cstring>
- </property>
- </widget>
- </item>
- <item row="7" column="1">
- <widget class="QLineEdit" name="category_band_line_edit">
- <property name="text">
- <string>ALL</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="8" column="0">
- <widget class="QLabel" name="claimed_label">
- <property name="text">
- <string>Claimed-Score:</string>
- </property>
- <property name="buddy">
- <cstring>claimed_line_edit</cstring>
- </property>
- </widget>
- </item>
- <item row="8" column="1">
- <widget class="QLineEdit" name="claimed_line_edit">
- <property name="text">
- <string/>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="9" column="0">
- <widget class="QLabel" name="operators_label">
- <property name="text">
- <string>Operators:</string>
- </property>
- <property name="buddy">
- <cstring>operators_line_edit</cstring>
- </property>
- </widget>
- </item>
- <item row="9" column="1">
- <widget class="QLineEdit" name="operators_line_edit">
- <property name="text">
- <string/>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="10" column="0">
- <widget class="QLabel" name="club_label">
- <property name="text">
- <string>Club:</string>
- </property>
- <property name="buddy">
- <cstring>club_line_edit</cstring>
- </property>
- </widget>
- </item>
- <item row="10" column="1">
- <widget class="QLineEdit" name="club_line_edit">
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="11" column="0">
- <widget class="QLabel" name="name_label">
- <property name="text">
- <string>Name:</string>
- </property>
- <property name="buddy">
- <cstring>name_line_edit</cstring>
- </property>
- </widget>
- </item>
- <item row="11" column="1">
- <widget class="QLineEdit" name="name_line_edit">
- <property name="text">
- <string/>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="12" column="0">
- <widget class="QLabel" name="addr_1_label">
- <property name="text">
- <string>Address:</string>
- </property>
- <property name="buddy">
- <cstring>addr_1_line_edit</cstring>
- </property>
- </widget>
- </item>
- <item row="12" column="1">
- <widget class="QLineEdit" name="addr_1_line_edit">
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="13" column="0">
- <widget class="QLabel" name="addr_2_label">
- <property name="text">
- <string>Address:</string>
- </property>
- <property name="buddy">
- <cstring>addr_2_line_edit</cstring>
- </property>
- </widget>
- </item>
- <item row="13" column="1">
- <widget class="QLineEdit" name="addr_2_line_edit">
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QDialogButtonBox" name="buttonBox">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="standardButtons">
- <set>QDialogButtonBox::Cancel|QDialogButtonBox::Save</set>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections>
- <connection>
- <sender>buttonBox</sender>
- <signal>accepted()</signal>
- <receiver>ExportCabrillo</receiver>
- <slot>accept()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>248</x>
- <y>254</y>
- </hint>
- <hint type="destinationlabel">
- <x>157</x>
- <y>274</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>buttonBox</sender>
- <signal>rejected()</signal>
- <receiver>ExportCabrillo</receiver>
- <slot>reject()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>316</x>
- <y>260</y>
- </hint>
- <hint type="destinationlabel">
- <x>286</x>
- <y>274</y>
- </hint>
- </hints>
- </connection>
- </connections>
-</ui>
+<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>ExportCabrillo</class> + <widget class="QDialog" name="ExportCabrillo"> + <property name="windowTitle"> + <string>Dialog</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <layout class="QFormLayout" name="formLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="location_label"> + <property name="text"> + <string>Location:</string> + </property> + <property name="buddy"> + <cstring>location_line_edit</cstring> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLineEdit" name="location_line_edit"> + <property name="text"> + <string>SNJ</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="contest_label"> + <property name="text"> + <string>Contest:</string> + </property> + <property name="buddy"> + <cstring>contest_line_edit</cstring> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLineEdit" name="contest_line_edit"> + <property name="text"> + <string>ARRL-RTTY</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="call_label"> + <property name="text"> + <string>Callsign:</string> + </property> + <property name="buddy"> + <cstring>call_line_edit</cstring> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QLineEdit" name="call_line_edit"> + <property name="text"> + <string/> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="category_op_label"> + <property name="text"> + <string>Category-Operator: </string> + </property> + <property name="buddy"> + <cstring>category_op_line_edit</cstring> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QLineEdit" name="category_op_line_edit"> + <property name="text"> + <string>SINGLE-OP</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="4" column="0"> + <widget class="QLabel" name="category_xmtr_label"> + <property name="text"> + <string>Category-Transmitter:</string> + </property> + <property name="buddy"> + <cstring>category_xmtr_line_edit</cstring> + </property> + </widget> + </item> + <item row="4" column="1"> + <widget class="QLineEdit" name="category_xmtr_line_edit"> + <property name="text"> + <string>ONE</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="5" column="0"> + <widget class="QLabel" name="category_pwr_label"> + <property name="text"> + <string>Category-Power:</string> + </property> + <property name="buddy"> + <cstring>category_pwr_line_edit</cstring> + </property> + </widget> + </item> + <item row="5" column="1"> + <widget class="QLineEdit" name="category_pwr_line_edit"> + <property name="text"> + <string>LOW</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="6" column="0"> + <widget class="QLabel" name="category_assisted_label"> + <property name="text"> + <string>Category-Assisted:</string> + </property> + <property name="buddy"> + <cstring>category_assisted_line_edit</cstring> + </property> + </widget> + </item> + <item row="6" column="1"> + <widget class="QLineEdit" name="category_assisted_line_edit"> + <property name="text"> + <string>NON-ASSISTED</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="7" column="0"> + <widget class="QLabel" name="category_band_label"> + <property name="text"> + <string>Category-Band:</string> + </property> + <property name="buddy"> + <cstring>category_band_line_edit</cstring> + </property> + </widget> + </item> + <item row="7" column="1"> + <widget class="QLineEdit" name="category_band_line_edit"> + <property name="text"> + <string>ALL</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="8" column="0"> + <widget class="QLabel" name="claimed_label"> + <property name="text"> + <string>Claimed-Score:</string> + </property> + <property name="buddy"> + <cstring>claimed_line_edit</cstring> + </property> + </widget> + </item> + <item row="8" column="1"> + <widget class="QLineEdit" name="claimed_line_edit"> + <property name="text"> + <string/> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="9" column="0"> + <widget class="QLabel" name="operators_label"> + <property name="text"> + <string>Operators:</string> + </property> + <property name="buddy"> + <cstring>operators_line_edit</cstring> + </property> + </widget> + </item> + <item row="9" column="1"> + <widget class="QLineEdit" name="operators_line_edit"> + <property name="text"> + <string/> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="10" column="0"> + <widget class="QLabel" name="club_label"> + <property name="text"> + <string>Club:</string> + </property> + <property name="buddy"> + <cstring>club_line_edit</cstring> + </property> + </widget> + </item> + <item row="10" column="1"> + <widget class="QLineEdit" name="club_line_edit"> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="11" column="0"> + <widget class="QLabel" name="name_label"> + <property name="text"> + <string>Name:</string> + </property> + <property name="buddy"> + <cstring>name_line_edit</cstring> + </property> + </widget> + </item> + <item row="11" column="1"> + <widget class="QLineEdit" name="name_line_edit"> + <property name="text"> + <string/> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="12" column="0"> + <widget class="QLabel" name="addr_1_label"> + <property name="text"> + <string>Address:</string> + </property> + <property name="buddy"> + <cstring>addr_1_line_edit</cstring> + </property> + </widget> + </item> + <item row="12" column="1"> + <widget class="QLineEdit" name="addr_1_line_edit"> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="13" column="0"> + <widget class="QLabel" name="addr_2_label"> + <property name="text"> + <string>Address:</string> + </property> + <property name="buddy"> + <cstring>addr_2_line_edit</cstring> + </property> + </widget> + </item> + <item row="13" column="1"> + <widget class="QLineEdit" name="addr_2_line_edit"> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Save</set> + </property> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections> + <connection> + <sender>buttonBox</sender> + <signal>accepted()</signal> + <receiver>ExportCabrillo</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel"> + <x>248</x> + <y>254</y> + </hint> + <hint type="destinationlabel"> + <x>157</x> + <y>274</y> + </hint> + </hints> + </connection> + <connection> + <sender>buttonBox</sender> + <signal>rejected()</signal> + <receiver>ExportCabrillo</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel"> + <x>316</x> + <y>260</y> + </hint> + <hint type="destinationlabel"> + <x>286</x> + <y>274</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/widgets/FoxLogWindow.cpp b/widgets/FoxLogWindow.cpp index 992d02db..14b8fb73 100755..100644 --- a/widgets/FoxLogWindow.cpp +++ b/widgets/FoxLogWindow.cpp @@ -1,129 +1,129 @@ -#include "FoxLogWindow.hpp"
-
-#include <QApplication>
-#include <QAction>
-#include <QFile>
-#include <QDir>
-#include <QSqlTableModel>
-#include <QFileDialog>
-
-#include "SettingsGroup.hpp"
-#include "Configuration.hpp"
-#include "MessageBox.hpp"
-#include "models/Bands.hpp"
-#include "models/FoxLog.hpp"
-#include "item_delegates/ForeignKeyDelegate.hpp"
-#include "item_delegates/CallsignDelegate.hpp"
-#include "item_delegates/MaidenheadLocatorDelegate.hpp"
-#include "item_delegates/SQLiteDateTimeDelegate.hpp"
-#include "pimpl_impl.hpp"
-
-#include "ui_FoxLogWindow.h"
-#include "moc_FoxLogWindow.cpp"
-
-class FoxLogWindow::impl final
-{
-public:
- explicit impl (FoxLog * log)
- : log_ {log}
- {
- }
-
- FoxLog * log_;
- Ui::FoxLogWindow ui_;
-};
-
-FoxLogWindow::FoxLogWindow (QSettings * settings, Configuration const * configuration
- , FoxLog * fox_log, QWidget * parent)
- : AbstractLogWindow {"Fox Log Window", settings, configuration, parent}
- , m_ {fox_log}
-{
- setWindowTitle (QApplication::applicationName () + " - Fox Log");
- m_->ui_.setupUi (this);
- m_->ui_.log_table_view->setModel (m_->log_->model ());
- set_log_view (m_->ui_.log_table_view);
- m_->ui_.log_table_view->setItemDelegateForColumn (1, new SQLiteDateTimeDelegate {this});
- m_->ui_.log_table_view->setItemDelegateForColumn (2, new CallsignDelegate {this});
- m_->ui_.log_table_view->setItemDelegateForColumn (3, new MaidenheadLocatorDelegate {this});
- m_->ui_.log_table_view->setItemDelegateForColumn (6, new ForeignKeyDelegate {configuration->bands (), 0, this});
- m_->ui_.log_table_view->horizontalHeader ()->moveSection (6, 1); // move band to first column
- m_->ui_.rate_label->setText ("");
- m_->ui_.queued_label->setNum (0);
- m_->ui_.callers_label->setNum (0);
-
- // actions
- auto export_action = new QAction {tr ("&Export ADIF ..."), m_->ui_.log_table_view};
- m_->ui_.log_table_view->insertAction (nullptr, export_action);
- connect (export_action, &QAction::triggered, [this, configuration] (bool /*checked*/) {
- auto file_name = QFileDialog::getSaveFileName (this
- , tr ("Export ADIF Log File")
- , configuration->writeable_data_dir ().absolutePath ()
- , tr ("ADIF Log (*.adi)"));
- if (file_name.size () && m_->log_)
- {
- QFile ADIF_file {file_name};
- if (ADIF_file.open (QIODevice::WriteOnly | QIODevice::Text))
- {
- QTextStream output_stream {&ADIF_file};
- m_->log_->export_qsos (output_stream);
- }
- else
- {
- MessageBox::warning_message (this
- , tr ("Export ADIF File Error")
- , tr ("Cannot open \"%1\" for writing: %2")
- .arg (ADIF_file.fileName ()).arg (ADIF_file.errorString ()));
- }
- }
- });
-
- auto reset_action = new QAction {tr ("&Reset ..."), m_->ui_.log_table_view};
- m_->ui_.log_table_view->insertAction (nullptr, reset_action);
- connect (reset_action, &QAction::triggered, [this, configuration] (bool /*checked*/) {
- if (MessageBox::Yes == MessageBox::query_message( this
- , tr ("Confirm Reset")
- , tr ("Are you sure you want to erase file FoxQSO.txt "
- "and start a new Fox log?")))
- {
- QFile f{configuration->writeable_data_dir ().absoluteFilePath ("FoxQSO.txt")};
- f.remove ();
- Q_EMIT reset_log_model ();
- }
- });
-}
-
-FoxLogWindow::~FoxLogWindow ()
-{
-}
-
-void FoxLogWindow::callers (int n)
-{
- m_->ui_.callers_label->setNum (n);
-}
-
-void FoxLogWindow::queued (int n)
-{
- m_->ui_.queued_label->setNum (n);
-}
-
-void FoxLogWindow::rate (int n)
-{
- m_->ui_.rate_label->setNum (n);
-}
-
-void FoxLogWindow::rate (QString s)
-{
- m_->ui_.rate_label->setText(s);
-}
-
-void FoxLogWindow::log_model_changed (int row)
-{
- if (row >= 0)
- {
- m_->log_->model ()->selectRow (row);
- }
- else
- {
- m_->log_->model ()->select ();
- }
-}
+#include "FoxLogWindow.hpp" + +#include <QApplication> +#include <QAction> +#include <QFile> +#include <QDir> +#include <QSqlTableModel> +#include <QFileDialog> + +#include "SettingsGroup.hpp" +#include "Configuration.hpp" +#include "MessageBox.hpp" +#include "models/Bands.hpp" +#include "models/FoxLog.hpp" +#include "item_delegates/ForeignKeyDelegate.hpp" +#include "item_delegates/CallsignDelegate.hpp" +#include "item_delegates/MaidenheadLocatorDelegate.hpp" +#include "item_delegates/SQLiteDateTimeDelegate.hpp" +#include "pimpl_impl.hpp" + +#include "ui_FoxLogWindow.h" +#include "moc_FoxLogWindow.cpp" + +class FoxLogWindow::impl final +{ +public: + explicit impl (FoxLog * log) + : log_ {log} + { + } + + FoxLog * log_; + Ui::FoxLogWindow ui_; +}; + +FoxLogWindow::FoxLogWindow (QSettings * settings, Configuration const * configuration + , FoxLog * fox_log, QWidget * parent) + : AbstractLogWindow {"Fox Log Window", settings, configuration, parent} + , m_ {fox_log} +{ + setWindowTitle (QApplication::applicationName () + " - Fox Log"); + m_->ui_.setupUi (this); + m_->ui_.log_table_view->setModel (m_->log_->model ()); + set_log_view (m_->ui_.log_table_view); + m_->ui_.log_table_view->setItemDelegateForColumn (1, new SQLiteDateTimeDelegate {this}); + m_->ui_.log_table_view->setItemDelegateForColumn (2, new CallsignDelegate {this}); + m_->ui_.log_table_view->setItemDelegateForColumn (3, new MaidenheadLocatorDelegate {this}); + m_->ui_.log_table_view->setItemDelegateForColumn (6, new ForeignKeyDelegate {configuration->bands (), 0, this}); + m_->ui_.log_table_view->horizontalHeader ()->moveSection (6, 1); // move band to first column + m_->ui_.rate_label->setText (""); + m_->ui_.queued_label->setNum (0); + m_->ui_.callers_label->setNum (0); + + // actions + auto export_action = new QAction {tr ("&Export ADIF ..."), m_->ui_.log_table_view}; + m_->ui_.log_table_view->insertAction (nullptr, export_action); + connect (export_action, &QAction::triggered, [this, configuration] (bool /*checked*/) { + auto file_name = QFileDialog::getSaveFileName (this + , tr ("Export ADIF Log File") + , configuration->writeable_data_dir ().absolutePath () + , tr ("ADIF Log (*.adi)")); + if (file_name.size () && m_->log_) + { + QFile ADIF_file {file_name}; + if (ADIF_file.open (QIODevice::WriteOnly | QIODevice::Text)) + { + QTextStream output_stream {&ADIF_file}; + m_->log_->export_qsos (output_stream); + } + else + { + MessageBox::warning_message (this + , tr ("Export ADIF File Error") + , tr ("Cannot open \"%1\" for writing: %2") + .arg (ADIF_file.fileName ()).arg (ADIF_file.errorString ())); + } + } + }); + + auto reset_action = new QAction {tr ("&Reset ..."), m_->ui_.log_table_view}; + m_->ui_.log_table_view->insertAction (nullptr, reset_action); + connect (reset_action, &QAction::triggered, [this, configuration] (bool /*checked*/) { + if (MessageBox::Yes == MessageBox::query_message( this + , tr ("Confirm Reset") + , tr ("Are you sure you want to erase file FoxQSO.txt " + "and start a new Fox log?"))) + { + QFile f{configuration->writeable_data_dir ().absoluteFilePath ("FoxQSO.txt")}; + f.remove (); + Q_EMIT reset_log_model (); + } + }); +} + +FoxLogWindow::~FoxLogWindow () +{ +} + +void FoxLogWindow::callers (int n) +{ + m_->ui_.callers_label->setNum (n); +} + +void FoxLogWindow::queued (int n) +{ + m_->ui_.queued_label->setNum (n); +} + +void FoxLogWindow::rate (int n) +{ + m_->ui_.rate_label->setNum (n); +} + +void FoxLogWindow::rate (QString s) +{ + m_->ui_.rate_label->setText(s); +} + +void FoxLogWindow::log_model_changed (int row) +{ + if (row >= 0) + { + m_->log_->model ()->selectRow (row); + } + else + { + m_->log_->model ()->select (); + } +} diff --git a/widgets/FoxLogWindow.hpp b/widgets/FoxLogWindow.hpp index a03f19be..faf5f4f5 100755..100644 --- a/widgets/FoxLogWindow.hpp +++ b/widgets/FoxLogWindow.hpp @@ -1,36 +1,36 @@ -#ifndef FOX_LOG_WINDOW_HPP_
-#define FOX_LOG_WINDOW_HPP_
-
-#include "AbstractLogWindow.hpp"
-#include "pimpl_h.hpp"
-
-class QSettings;
-class Configuration;
-class QFont;
-class FoxLog;
-
-class FoxLogWindow final
- : public AbstractLogWindow
-{
- Q_OBJECT
-
-public:
- explicit FoxLogWindow (QSettings *, Configuration const *, FoxLog * fox_log
- , QWidget * parent = nullptr);
- ~FoxLogWindow ();
-
- void callers (int);
- void queued (int);
- void rate (int);
- void rate (QString);
-
- Q_SIGNAL void reset_log_model () const;
-
-private:
- void log_model_changed (int row) override;
-
- class impl;
- pimpl<impl> m_;
-};
-
-#endif
+#ifndef FOX_LOG_WINDOW_HPP_ +#define FOX_LOG_WINDOW_HPP_ + +#include "AbstractLogWindow.hpp" +#include "pimpl_h.hpp" + +class QSettings; +class Configuration; +class QFont; +class FoxLog; + +class FoxLogWindow final + : public AbstractLogWindow +{ + Q_OBJECT + +public: + explicit FoxLogWindow (QSettings *, Configuration const *, FoxLog * fox_log + , QWidget * parent = nullptr); + ~FoxLogWindow (); + + void callers (int); + void queued (int); + void rate (int); + void rate (QString); + + Q_SIGNAL void reset_log_model () const; + +private: + void log_model_changed (int row) override; + + class impl; + pimpl<impl> m_; +}; + +#endif diff --git a/widgets/FoxLogWindow.ui b/widgets/FoxLogWindow.ui index fd8c3c23..2d290767 100755..100644 --- a/widgets/FoxLogWindow.ui +++ b/widgets/FoxLogWindow.ui @@ -1,125 +1,125 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>FoxLogWindow</class>
- <widget class="QWidget" name="FoxLogWindow">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>453</width>
- <height>238</height>
- </rect>
- </property>
- <property name="contextMenuPolicy">
- <enum>Qt::DefaultContextMenu</enum>
- </property>
- <property name="windowTitle">
- <string>Fox Log</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QTableView" name="log_table_view">
- <property name="contextMenuPolicy">
- <enum>Qt::ActionsContextMenu</enum>
- </property>
- <property name="toolTip">
- <string><html><head/><body><p>Right-click here for available actions.</p></body></html></string>
- </property>
- <attribute name="horizontalHeaderStretchLastSection">
- <bool>true</bool>
- </attribute>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <spacer name="horizontalSpacer_2">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Callers:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="callers_label">
- <property name="text">
- <string>N</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>In progress:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="queued_label">
- <property name="text">
- <string>N</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QLabel" name="label_4">
- <property name="text">
- <string>Rate:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="rate_label">
- <property name="toolTip">
- <string><html><head/><body><p>Last 10: Average rate (QSOs/hour) for the last 10 QSOs.<br/>Last 100: Average rate (QSOs/hour) for the last 100 QSOs. <br/>Last 60m: Average rate (QSOs/hour) for the last 60 minutes.</span></p></body></html></string>
- </property>
- <property name="text">
- <string>N</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer_3">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
+<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>FoxLogWindow</class> + <widget class="QWidget" name="FoxLogWindow"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>453</width> + <height>238</height> + </rect> + </property> + <property name="contextMenuPolicy"> + <enum>Qt::DefaultContextMenu</enum> + </property> + <property name="windowTitle"> + <string>Fox Log</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QTableView" name="log_table_view"> + <property name="contextMenuPolicy"> + <enum>Qt::ActionsContextMenu</enum> + </property> + <property name="toolTip"> + <string><html><head/><body><p>Right-click here for available actions.</p></body></html></string> + </property> + <attribute name="horizontalHeaderStretchLastSection"> + <bool>true</bool> + </attribute> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Callers:</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="callers_label"> + <property name="text"> + <string>N</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>In progress:</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="queued_label"> + <property name="text"> + <string>N</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="label_4"> + <property name="text"> + <string>Rate:</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="rate_label"> + <property name="toolTip"> + <string><html><head/><body><p>Last 10: Average rate (QSOs/hour) for the last 10 QSOs.<br/>Last 100: Average rate (QSOs/hour) for the last 100 QSOs. <br/>Last 60m: Average rate (QSOs/hour) for the last 60 minutes.</span></p></body></html></string> + </property> + <property name="text"> + <string>N</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_3"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/widgets/FrequencyDeltaLineEdit.cpp b/widgets/FrequencyDeltaLineEdit.cpp index 12cb80ec..59ae9bc9 100755..100644 --- a/widgets/FrequencyDeltaLineEdit.cpp +++ b/widgets/FrequencyDeltaLineEdit.cpp @@ -1,54 +1,54 @@ -#include "FrequencyDeltaLineEdit.hpp"
-
-#include <limits>
-
-#include <QDoubleValidator>
-#include <QString>
-#include <QLocale>
-
-#include "moc_FrequencyDeltaLineEdit.cpp"
-
-namespace
-{
- class MHzValidator
- : public QDoubleValidator
- {
- public:
- MHzValidator (double bottom, double top, QObject * parent = nullptr)
- : QDoubleValidator {bottom, top, 6, parent}
- {
- }
-
- State validate (QString& input, int& pos) const override
- {
- State result = QDoubleValidator::validate (input, pos);
- if (Acceptable == result)
- {
- bool ok;
- (void)QLocale {}.toDouble (input, &ok);
- if (!ok)
- {
- result = Intermediate;
- }
- }
- return result;
- }
- };
-}
-
-FrequencyDeltaLineEdit::FrequencyDeltaLineEdit (QWidget * parent)
- : QLineEdit (parent)
-{
- setValidator (new MHzValidator {static_cast<double>(std::numeric_limits<FrequencyDelta>::min ()) / 10.e6,
- static_cast<double>(std::numeric_limits<FrequencyDelta>::max ()) / 10.e6, this});
-}
-
-auto FrequencyDeltaLineEdit::frequency_delta () const -> FrequencyDelta
-{
- return Radio::frequency_delta (text (), 6);
-}
-
-void FrequencyDeltaLineEdit::frequency_delta (FrequencyDelta d)
-{
- setText (Radio::frequency_MHz_string (d));
-}
+#include "FrequencyDeltaLineEdit.hpp" + +#include <limits> + +#include <QDoubleValidator> +#include <QString> +#include <QLocale> + +#include "moc_FrequencyDeltaLineEdit.cpp" + +namespace +{ + class MHzValidator + : public QDoubleValidator + { + public: + MHzValidator (double bottom, double top, QObject * parent = nullptr) + : QDoubleValidator {bottom, top, 6, parent} + { + } + + State validate (QString& input, int& pos) const override + { + State result = QDoubleValidator::validate (input, pos); + if (Acceptable == result) + { + bool ok; + (void)QLocale {}.toDouble (input, &ok); + if (!ok) + { + result = Intermediate; + } + } + return result; + } + }; +} + +FrequencyDeltaLineEdit::FrequencyDeltaLineEdit (QWidget * parent) + : QLineEdit (parent) +{ + setValidator (new MHzValidator {static_cast<double>(std::numeric_limits<FrequencyDelta>::min ()) / 10.e6, + static_cast<double>(std::numeric_limits<FrequencyDelta>::max ()) / 10.e6, this}); +} + +auto FrequencyDeltaLineEdit::frequency_delta () const -> FrequencyDelta +{ + return Radio::frequency_delta (text (), 6); +} + +void FrequencyDeltaLineEdit::frequency_delta (FrequencyDelta d) +{ + setText (Radio::frequency_MHz_string (d)); +} diff --git a/widgets/FrequencyDeltaLineEdit.hpp b/widgets/FrequencyDeltaLineEdit.hpp index bc39e08f..caa00ecb 100755..100644 --- a/widgets/FrequencyDeltaLineEdit.hpp +++ b/widgets/FrequencyDeltaLineEdit.hpp @@ -1,29 +1,29 @@ -#ifndef FREQUENCY_DELTA_LINE_EDIT_HPP_
-#define FREQUENCY_DELTA_LINE_EDIT_HPP_
-
-#include <QLineEdit>
-
-#include "Radio.hpp"
-
-class QWidget;
-
-//
-// MHz frequency delta line edit with validation
-//
-class FrequencyDeltaLineEdit final
- : public QLineEdit
-{
- Q_OBJECT;
- Q_PROPERTY (FrequencyDelta frequency_delta READ frequency_delta WRITE frequency_delta USER true);
-
-public:
- using FrequencyDelta = Radio::FrequencyDelta;
-
- explicit FrequencyDeltaLineEdit (QWidget * parent = nullptr);
-
- // Property frequency_delta implementation
- FrequencyDelta frequency_delta () const;
- void frequency_delta (FrequencyDelta);
-};
-
-#endif
+#ifndef FREQUENCY_DELTA_LINE_EDIT_HPP_ +#define FREQUENCY_DELTA_LINE_EDIT_HPP_ + +#include <QLineEdit> + +#include "Radio.hpp" + +class QWidget; + +// +// MHz frequency delta line edit with validation +// +class FrequencyDeltaLineEdit final + : public QLineEdit +{ + Q_OBJECT; + Q_PROPERTY (FrequencyDelta frequency_delta READ frequency_delta WRITE frequency_delta USER true); + +public: + using FrequencyDelta = Radio::FrequencyDelta; + + explicit FrequencyDeltaLineEdit (QWidget * parent = nullptr); + + // Property frequency_delta implementation + FrequencyDelta frequency_delta () const; + void frequency_delta (FrequencyDelta); +}; + +#endif diff --git a/widgets/FrequencyLineEdit.cpp b/widgets/FrequencyLineEdit.cpp index 4826b2c6..8e74c7db 100755..100644 --- a/widgets/FrequencyLineEdit.cpp +++ b/widgets/FrequencyLineEdit.cpp @@ -1,53 +1,53 @@ -#include "FrequencyLineEdit.hpp"
-
-#include <limits>
-
-#include <QDoubleValidator>
-#include <QString>
-#include <QLocale>
-
-#include "moc_FrequencyLineEdit.cpp"
-
-namespace
-{
- class MHzValidator
- : public QDoubleValidator
- {
- public:
- MHzValidator (double bottom, double top, QObject * parent = nullptr)
- : QDoubleValidator {bottom, top, 6, parent}
- {
- }
-
- State validate (QString& input, int& pos) const override
- {
- State result = QDoubleValidator::validate (input, pos);
- if (Acceptable == result)
- {
- bool ok;
- (void)QLocale {}.toDouble (input, &ok);
- if (!ok)
- {
- result = Intermediate;
- }
- }
- return result;
- }
- };
-}
-
-FrequencyLineEdit::FrequencyLineEdit (QWidget * parent)
- : QLineEdit (parent)
-{
- setValidator (new MHzValidator {0., static_cast<double>(std::numeric_limits<Radio::Frequency>::max ()) / 10.e6, this});
-}
-
-auto FrequencyLineEdit::frequency () const -> Frequency
-{
- return Radio::frequency (text (), 6);
-}
-
-void FrequencyLineEdit::frequency (Frequency f)
-{
- setText (Radio::frequency_MHz_string (f));
-}
+#include "FrequencyLineEdit.hpp" + +#include <limits> + +#include <QDoubleValidator> +#include <QString> +#include <QLocale> + +#include "moc_FrequencyLineEdit.cpp" + +namespace +{ + class MHzValidator + : public QDoubleValidator + { + public: + MHzValidator (double bottom, double top, QObject * parent = nullptr) + : QDoubleValidator {bottom, top, 6, parent} + { + } + + State validate (QString& input, int& pos) const override + { + State result = QDoubleValidator::validate (input, pos); + if (Acceptable == result) + { + bool ok; + (void)QLocale {}.toDouble (input, &ok); + if (!ok) + { + result = Intermediate; + } + } + return result; + } + }; +} + +FrequencyLineEdit::FrequencyLineEdit (QWidget * parent) + : QLineEdit (parent) +{ + setValidator (new MHzValidator {0., static_cast<double>(std::numeric_limits<Radio::Frequency>::max ()) / 10.e6, this}); +} + +auto FrequencyLineEdit::frequency () const -> Frequency +{ + return Radio::frequency (text (), 6); +} + +void FrequencyLineEdit::frequency (Frequency f) +{ + setText (Radio::frequency_MHz_string (f)); +} diff --git a/widgets/FrequencyLineEdit.hpp b/widgets/FrequencyLineEdit.hpp index 3e5d9a85..7e535f5a 100755..100644 --- a/widgets/FrequencyLineEdit.hpp +++ b/widgets/FrequencyLineEdit.hpp @@ -1,29 +1,29 @@ -#ifndef FREQUENCY_LINE_EDIT_HPP_
-#define FREQUENCY_LINE_EDIT_HPP_
-
-#include <QLineEdit>
-
-#include "Radio.hpp"
-
-class QWidget;
-
-//
-// MHz frequency line edit with validation
-//
-class FrequencyLineEdit final
- : public QLineEdit
-{
- Q_OBJECT;
- Q_PROPERTY (Frequency frequency READ frequency WRITE frequency USER true);
-
-public:
- using Frequency = Radio::Frequency;
-
- explicit FrequencyLineEdit (QWidget * parent = nullptr);
-
- // Property frequency implementation
- Frequency frequency () const;
- void frequency (Frequency);
-};
-
-#endif
+#ifndef FREQUENCY_LINE_EDIT_HPP_ +#define FREQUENCY_LINE_EDIT_HPP_ + +#include <QLineEdit> + +#include "Radio.hpp" + +class QWidget; + +// +// MHz frequency line edit with validation +// +class FrequencyLineEdit final + : public QLineEdit +{ + Q_OBJECT; + Q_PROPERTY (Frequency frequency READ frequency WRITE frequency USER true); + +public: + using Frequency = Radio::Frequency; + + explicit FrequencyLineEdit (QWidget * parent = nullptr); + + // Property frequency implementation + Frequency frequency () const; + void frequency (Frequency); +}; + +#endif diff --git a/widgets/HelpTextWindow.cpp b/widgets/HelpTextWindow.cpp index bb0e7077..7ac1367b 100755..100644 --- a/widgets/HelpTextWindow.cpp +++ b/widgets/HelpTextWindow.cpp @@ -1,21 +1,21 @@ -#include "HelpTextWindow.hpp"
-
-#include <QApplication>
-#include <QString>
-#include <QPalette>
-
-#include "qt_helpers.hpp"
-
-#include "moc_HelpTextWindow.cpp"
-
-HelpTextWindow::HelpTextWindow (QString const& title, QString const& text, QFont const& font, QWidget * parent)
- : QLabel {parent, Qt::WindowCloseButtonHint | Qt::WindowMinimizeButtonHint}
-{
- setWindowTitle(QApplication::applicationName () + " - " + title);
- setMargin (10);
- setBackgroundRole (QPalette::Base);
- setAutoFillBackground (true);
- setStyleSheet (font_as_stylesheet (font));
- setText (text);
- setMinimumSize (sizeHint ());
-}
+#include "HelpTextWindow.hpp" + +#include <QApplication> +#include <QString> +#include <QPalette> + +#include "qt_helpers.hpp" + +#include "moc_HelpTextWindow.cpp" + +HelpTextWindow::HelpTextWindow (QString const& title, QString const& text, QFont const& font, QWidget * parent) + : QLabel {parent, Qt::WindowCloseButtonHint | Qt::WindowMinimizeButtonHint} +{ + setWindowTitle(QApplication::applicationName () + " - " + title); + setMargin (10); + setBackgroundRole (QPalette::Base); + setAutoFillBackground (true); + setStyleSheet (font_as_stylesheet (font)); + setText (text); + setMinimumSize (sizeHint ()); +} diff --git a/widgets/HelpTextWindow.hpp b/widgets/HelpTextWindow.hpp index 8635088d..96caaad6 100755..100644 --- a/widgets/HelpTextWindow.hpp +++ b/widgets/HelpTextWindow.hpp @@ -1,18 +1,18 @@ -#ifndef HELP_TEXT_WINDOW_HPP__
-#define HELP_TEXT_WINDOW_HPP__
-
-#include <QLabel>
-#include <QFont>
-
-class QString;
-
-class HelpTextWindow final
- : public QLabel
-{
- Q_OBJECT
-
-public:
- HelpTextWindow (QString const& title, QString const& text, QFont const& = QFont {}, QWidget * parent = nullptr);
-};
-
-#endif
+#ifndef HELP_TEXT_WINDOW_HPP__ +#define HELP_TEXT_WINDOW_HPP__ + +#include <QLabel> +#include <QFont> + +class QString; + +class HelpTextWindow final + : public QLabel +{ + Q_OBJECT + +public: + HelpTextWindow (QString const& title, QString const& text, QFont const& = QFont {}, QWidget * parent = nullptr); +}; + +#endif diff --git a/widgets/HintedSpinBox.cpp b/widgets/HintedSpinBox.cpp index 3b7d1336..25ffcc71 100755..100644 --- a/widgets/HintedSpinBox.cpp +++ b/widgets/HintedSpinBox.cpp @@ -1,55 +1,55 @@ -#include "HintedSpinBox.hpp"
-
-#include <algorithm>
-
-auto HintedSpinBox::values (values_type values, bool set_min_max) -> values_type
-{
- // replace any prior values
- std::swap (values, values_);
-
- // sort values and make unique
- std::sort (values_.begin (), values_.end ());
- auto last = std::unique (values_.begin (), values_.end ());
- values_.erase (last, values_.end ());
- if (set_min_max)
- {
- setMinimum (values_.front ());
- setMaximum (values_.back ());
- }
- return values; // return old values
-}
-
-void HintedSpinBox::stepBy (int steps)
-{
- if (values_.size ())
- {
- if (steps > 0)
- {
- auto p = std::upper_bound (values_.begin (), values_.end (), value ());
- if (p != values_.end () && *p <= maximum ())
- {
- setValue (*p);
- }
- else if (wrapping ())
- {
- setValue (values_.front ());
- }
- }
- else if (steps < 0)
- {
- auto p = std::lower_bound (values_.begin (), values_.end (), value ());
- if (p != values_.begin () && *(p - 1) >= minimum ())
- {
- setValue (*(p - 1));
- }
- else if (wrapping ())
- {
- setValue (values_.back ());
- }
- }
- }
- else
- {
- QSpinBox::stepBy (steps); // no values so revert to QSpinBox behaviour
- }
-}
+#include "HintedSpinBox.hpp" + +#include <algorithm> + +auto HintedSpinBox::values (values_type values, bool set_min_max) -> values_type +{ + // replace any prior values + std::swap (values, values_); + + // sort values and make unique + std::sort (values_.begin (), values_.end ()); + auto last = std::unique (values_.begin (), values_.end ()); + values_.erase (last, values_.end ()); + if (set_min_max) + { + setMinimum (values_.front ()); + setMaximum (values_.back ()); + } + return values; // return old values +} + +void HintedSpinBox::stepBy (int steps) +{ + if (values_.size ()) + { + if (steps > 0) + { + auto p = std::upper_bound (values_.begin (), values_.end (), value ()); + if (p != values_.end () && *p <= maximum ()) + { + setValue (*p); + } + else if (wrapping ()) + { + setValue (values_.front ()); + } + } + else if (steps < 0) + { + auto p = std::lower_bound (values_.begin (), values_.end (), value ()); + if (p != values_.begin () && *(p - 1) >= minimum ()) + { + setValue (*(p - 1)); + } + else if (wrapping ()) + { + setValue (values_.back ()); + } + } + } + else + { + QSpinBox::stepBy (steps); // no values so revert to QSpinBox behaviour + } +} diff --git a/widgets/HintedSpinBox.hpp b/widgets/HintedSpinBox.hpp index 10177571..8498b29e 100755..100644 --- a/widgets/HintedSpinBox.hpp +++ b/widgets/HintedSpinBox.hpp @@ -1,53 +1,53 @@ -#ifndef HINTED_SPIN_BOX_HPP_
-#define HINTED_SPIN_BOX_HPP_
-
-#include <vector>
-
-#include <QSpinBox>
-
-//
-// HintedSpinBox - QSpinBox refinement with an optional sequence of
-// discrete hints
-//
-// The hint sequence values are used as step values and can
-// optionally define the minimum and maximum value. Intermediate
-// values are allowed but the step up/down arrows and accelerator
-// keys will only use the hints.
-//
-// Ensure that the default minimum and maximum values are sufficient
-// to allow initial initialization if done before the hints are set.
-//
-class HintedSpinBox
- : public QSpinBox
-{
-public:
- typedef std::vector<int> values_type;
-
- HintedSpinBox (QWidget * parent = nullptr)
- : QSpinBox {parent}
- {
- }
-
- // Initialize sequence of values allowed.
- //
- // This spin box behaves exactly as a standard QSpinBox if the
- // sequence of values is empty.
- //
- // The minimum and maximum are automatically set to the lowest and
- // highest value provided if required.
- //
- // Returns the previous sequence.
- values_type values (values_type values, bool set_min_max = true);
-
- // Read access to the values.
- values_type const& values () const {return values_;}
-
-protected:
- // override the QSpinBox stepping
- void stepBy (int steps) override;
-
-private:
- values_type values_;
-};
-
-#endif
+#ifndef HINTED_SPIN_BOX_HPP_ +#define HINTED_SPIN_BOX_HPP_ + +#include <vector> + +#include <QSpinBox> + +// +// HintedSpinBox - QSpinBox refinement with an optional sequence of +// discrete hints +// +// The hint sequence values are used as step values and can +// optionally define the minimum and maximum value. Intermediate +// values are allowed but the step up/down arrows and accelerator +// keys will only use the hints. +// +// Ensure that the default minimum and maximum values are sufficient +// to allow initial initialization if done before the hints are set. +// +class HintedSpinBox + : public QSpinBox +{ +public: + typedef std::vector<int> values_type; + + HintedSpinBox (QWidget * parent = nullptr) + : QSpinBox {parent} + { + } + + // Initialize sequence of values allowed. + // + // This spin box behaves exactly as a standard QSpinBox if the + // sequence of values is empty. + // + // The minimum and maximum are automatically set to the lowest and + // highest value provided if required. + // + // Returns the previous sequence. + values_type values (values_type values, bool set_min_max = true); + + // Read access to the values. + values_type const& values () const {return values_;} + +protected: + // override the QSpinBox stepping + void stepBy (int steps) override; + +private: + values_type values_; +}; + +#endif diff --git a/widgets/LazyFillComboBox.cpp b/widgets/LazyFillComboBox.cpp index cb75c21a..08968f35 100755..100644 --- a/widgets/LazyFillComboBox.cpp +++ b/widgets/LazyFillComboBox.cpp @@ -1,3 +1,3 @@ -#include "LazyFillComboBox.hpp"
-
-#include "moc_LazyFillComboBox.cpp"
+#include "LazyFillComboBox.hpp" + +#include "moc_LazyFillComboBox.cpp" diff --git a/widgets/LazyFillComboBox.hpp b/widgets/LazyFillComboBox.hpp index 7cff2505..7ac828fe 100755..100644 --- a/widgets/LazyFillComboBox.hpp +++ b/widgets/LazyFillComboBox.hpp @@ -1,54 +1,54 @@ -#ifndef LAZY_FILL_COMBO_BOX_HPP__
-#define LAZY_FILL_COMBO_BOX_HPP__
-
-#include <QComboBox>
-
-class QWidget;
-
-//
-// Class LazyFillComboBox
-//
-// QComboBox derivative that signals show and hide of the pop up list.
-//
-class LazyFillComboBox
- : public QComboBox
-{
- Q_OBJECT
-
-public:
- Q_SIGNAL void about_to_show_popup ();
- Q_SIGNAL void popup_hidden ();
-
- explicit LazyFillComboBox (QWidget * parent = nullptr)
- : QComboBox {parent}
- {
- }
-
-#if QT_VERSION >= QT_VERSION_CHECK (5, 12, 0)
- void showPopup () override
- {
- Q_EMIT about_to_show_popup ();
- QComboBox::showPopup ();
- }
-
- void hidePopup () override
- {
- QComboBox::hidePopup ();
- Q_EMIT popup_hidden ();
- }
-#else
- void mousePressEvent (QMouseEvent * e) override
- {
- Q_EMIT about_to_show_popup ();
- QComboBox::mousePressEvent (e);
- }
-
- void mouseReleaseEvent (QMouseEvent * e) override
- {
- QComboBox::mouseReleaseEvent (e);
- Q_EMIT popup_hidden ();
- }
-#endif
-};
-
-#endif
+#ifndef LAZY_FILL_COMBO_BOX_HPP__ +#define LAZY_FILL_COMBO_BOX_HPP__ + +#include <QComboBox> + +class QWidget; + +// +// Class LazyFillComboBox +// +// QComboBox derivative that signals show and hide of the pop up list. +// +class LazyFillComboBox + : public QComboBox +{ + Q_OBJECT + +public: + Q_SIGNAL void about_to_show_popup (); + Q_SIGNAL void popup_hidden (); + + explicit LazyFillComboBox (QWidget * parent = nullptr) + : QComboBox {parent} + { + } + +#if QT_VERSION >= QT_VERSION_CHECK (5, 12, 0) + void showPopup () override + { + Q_EMIT about_to_show_popup (); + QComboBox::showPopup (); + } + + void hidePopup () override + { + QComboBox::hidePopup (); + Q_EMIT popup_hidden (); + } +#else + void mousePressEvent (QMouseEvent * e) override + { + Q_EMIT about_to_show_popup (); + QComboBox::mousePressEvent (e); + } + + void mouseReleaseEvent (QMouseEvent * e) override + { + QComboBox::mouseReleaseEvent (e); + Q_EMIT popup_hidden (); + } +#endif +}; + +#endif diff --git a/widgets/LettersSpinBox.cpp b/widgets/LettersSpinBox.cpp index 05db1ead..9079d8d9 100755..100644 --- a/widgets/LettersSpinBox.cpp +++ b/widgets/LettersSpinBox.cpp @@ -1,25 +1,25 @@ -#include "LettersSpinBox.hpp"
-
-#include <QString>
-#include "moc_LettersSpinBox.cpp"
-
-QString LettersSpinBox::textFromValue (int value) const
-{
- QString text;
- do {
- auto digit = value % 26;
- value /= 26;
- text = QChar {lowercase_ ? 'a' + digit : 'A' + digit} + text;
- } while (value);
- return text;
-}
-
-int LettersSpinBox::valueFromText (QString const& text) const
-{
- int value {0};
- for (int index = text.size (); index > 0; --index)
- {
- value = value * 26 + text[index - 1].toLatin1 () - (lowercase_ ? 'a' : 'A');
- }
- return value;
-}
+#include "LettersSpinBox.hpp" + +#include <QString> +#include "moc_LettersSpinBox.cpp" + +QString LettersSpinBox::textFromValue (int value) const +{ + QString text; + do { + auto digit = value % 26; + value /= 26; + text = QChar {lowercase_ ? 'a' + digit : 'A' + digit} + text; + } while (value); + return text; +} + +int LettersSpinBox::valueFromText (QString const& text) const +{ + int value {0}; + for (int index = text.size (); index > 0; --index) + { + value = value * 26 + text[index - 1].toLatin1 () - (lowercase_ ? 'a' : 'A'); + } + return value; +} diff --git a/widgets/LettersSpinBox.hpp b/widgets/LettersSpinBox.hpp index 031ab7f1..aaa37d7f 100755..100644 --- a/widgets/LettersSpinBox.hpp +++ b/widgets/LettersSpinBox.hpp @@ -1,31 +1,31 @@ -#ifndef LETTERS_SPIN_BOX_HPP_
-#define LETTERS_SPIN_BOX_HPP_
-
-#include <QSpinBox>
-
-class QString;
-
-//
-// LettersSpinBox - select from consecutive letters
-//
-class LettersSpinBox final
- : public QSpinBox
-{
- Q_OBJECT
- Q_PROPERTY (bool lowercase MEMBER lowercase_)
-
-public:
- LettersSpinBox (QWidget * parent = nullptr)
- : QSpinBox {parent}
- , lowercase_ {false}
- {
- }
-
- QString textFromValue (int) const override;
- int valueFromText (QString const&) const override;
-
-private:
- bool lowercase_;
-};
-
-#endif
+#ifndef LETTERS_SPIN_BOX_HPP_ +#define LETTERS_SPIN_BOX_HPP_ + +#include <QSpinBox> + +class QString; + +// +// LettersSpinBox - select from consecutive letters +// +class LettersSpinBox final + : public QSpinBox +{ + Q_OBJECT + Q_PROPERTY (bool lowercase MEMBER lowercase_) + +public: + LettersSpinBox (QWidget * parent = nullptr) + : QSpinBox {parent} + , lowercase_ {false} + { + } + + QString textFromValue (int) const override; + int valueFromText (QString const&) const override; + +private: + bool lowercase_; +}; + +#endif diff --git a/widgets/MessageBox.cpp b/widgets/MessageBox.cpp index c6576708..7c6f0513 100755..100644 --- a/widgets/MessageBox.cpp +++ b/widgets/MessageBox.cpp @@ -1,102 +1,102 @@ -#include "MessageBox.hpp"
-
-#include <QDialogButtonBox>
-#include <QPushButton>
-#include <QCoreApplication>
-
-#include "revision_utils.hpp"
-
-MessageBox::MessageBox (QWidget * parent)
- : QMessageBox {parent}
-{
- setWindowTitle (program_title ());
-}
-
-MessageBox::MessageBox (Icon icon, QString const& text, StandardButtons buttons
- , QWidget * parent, Qt::WindowFlags flags)
- : QMessageBox {icon, QCoreApplication::applicationName (), text, buttons, parent, flags}
-{
-}
-
-void MessageBox::about_message (QWidget * parent, QString const& text)
-{
- QMessageBox::about (parent, program_title (), text);
-}
-
-void MessageBox::about_Qt_message (QWidget * parent)
-{
- QMessageBox::aboutQt (parent, program_title ());
-}
-
-namespace
-{
- QMessageBox::StandardButton show_it (QWidget * parent, MessageBox::Icon icon
- , QString const& text
- , QString const& informative
- , QString const& detail
- , MessageBox::StandardButtons buttons
- , MessageBox::StandardButton default_button)
- {
- MessageBox mb {icon, text, MessageBox::NoButton, parent};
- QDialogButtonBox * button_box = mb.findChild<QDialogButtonBox *> ();
- Q_ASSERT (button_box);
-
- uint mask = MessageBox::FirstButton;
- while (mask <= MessageBox::LastButton) {
- uint sb = buttons & mask;
- mask <<= 1;
- if (!sb)
- continue;
- QPushButton * button = mb.addButton (static_cast<MessageBox::StandardButton> (sb));
- // Choose the first accept role as the default
- if (mb.defaultButton ())
- continue;
- if ((default_button == MessageBox::NoButton
- && button_box->buttonRole (button) == QDialogButtonBox::AcceptRole)
- || (default_button != MessageBox::NoButton
- && sb == static_cast<uint> (default_button)))
- mb.setDefaultButton (button);
- }
- mb.setInformativeText (informative);
- mb.setDetailedText (detail);
- if (mb.exec() == -1)
- return MessageBox::Cancel;
- return mb.standardButton (mb.clickedButton ());
- }
-}
-
-auto MessageBox::information_message (QWidget * parent, QString const& text
- , QString const& informative
- , QString const& detail
- , StandardButtons buttons
- , StandardButton default_button) -> StandardButton
-{
- return show_it (parent, Information, text, informative, detail, buttons, default_button);
-}
-
-auto MessageBox::query_message (QWidget * parent, QString const& text
- , QString const& informative
- , QString const& detail
- , StandardButtons buttons
- , StandardButton default_button) -> StandardButton
-{
- return show_it (parent, Question, text, informative, detail, buttons, default_button);
-}
-
-auto MessageBox::warning_message (QWidget * parent, QString const& text
- , QString const& informative
- , QString const& detail
- , StandardButtons buttons
- , StandardButton default_button) -> StandardButton
-{
- return show_it (parent, Warning, text, informative, detail, buttons, default_button);
-}
-
-auto MessageBox::critical_message (QWidget * parent, QString const& text
- , QString const& informative
- , QString const& detail
- , StandardButtons buttons
- , StandardButton default_button) -> StandardButton
-{
- return show_it (parent, Critical, text, informative, detail, buttons, default_button);
-}
+#include "MessageBox.hpp" + +#include <QDialogButtonBox> +#include <QPushButton> +#include <QCoreApplication> + +#include "revision_utils.hpp" + +MessageBox::MessageBox (QWidget * parent) + : QMessageBox {parent} +{ + setWindowTitle (program_title ()); +} + +MessageBox::MessageBox (Icon icon, QString const& text, StandardButtons buttons + , QWidget * parent, Qt::WindowFlags flags) + : QMessageBox {icon, QCoreApplication::applicationName (), text, buttons, parent, flags} +{ +} + +void MessageBox::about_message (QWidget * parent, QString const& text) +{ + QMessageBox::about (parent, program_title (), text); +} + +void MessageBox::about_Qt_message (QWidget * parent) +{ + QMessageBox::aboutQt (parent, program_title ()); +} + +namespace +{ + QMessageBox::StandardButton show_it (QWidget * parent, MessageBox::Icon icon + , QString const& text + , QString const& informative + , QString const& detail + , MessageBox::StandardButtons buttons + , MessageBox::StandardButton default_button) + { + MessageBox mb {icon, text, MessageBox::NoButton, parent}; + QDialogButtonBox * button_box = mb.findChild<QDialogButtonBox *> (); + Q_ASSERT (button_box); + + uint mask = MessageBox::FirstButton; + while (mask <= MessageBox::LastButton) { + uint sb = buttons & mask; + mask <<= 1; + if (!sb) + continue; + QPushButton * button = mb.addButton (static_cast<MessageBox::StandardButton> (sb)); + // Choose the first accept role as the default + if (mb.defaultButton ()) + continue; + if ((default_button == MessageBox::NoButton + && button_box->buttonRole (button) == QDialogButtonBox::AcceptRole) + || (default_button != MessageBox::NoButton + && sb == static_cast<uint> (default_button))) + mb.setDefaultButton (button); + } + mb.setInformativeText (informative); + mb.setDetailedText (detail); + if (mb.exec() == -1) + return MessageBox::Cancel; + return mb.standardButton (mb.clickedButton ()); + } +} + +auto MessageBox::information_message (QWidget * parent, QString const& text + , QString const& informative + , QString const& detail + , StandardButtons buttons + , StandardButton default_button) -> StandardButton +{ + return show_it (parent, Information, text, informative, detail, buttons, default_button); +} + +auto MessageBox::query_message (QWidget * parent, QString const& text + , QString const& informative + , QString const& detail + , StandardButtons buttons + , StandardButton default_button) -> StandardButton +{ + return show_it (parent, Question, text, informative, detail, buttons, default_button); +} + +auto MessageBox::warning_message (QWidget * parent, QString const& text + , QString const& informative + , QString const& detail + , StandardButtons buttons + , StandardButton default_button) -> StandardButton +{ + return show_it (parent, Warning, text, informative, detail, buttons, default_button); +} + +auto MessageBox::critical_message (QWidget * parent, QString const& text + , QString const& informative + , QString const& detail + , StandardButtons buttons + , StandardButton default_button) -> StandardButton +{ + return show_it (parent, Critical, text, informative, detail, buttons, default_button); +} diff --git a/widgets/MessageBox.hpp b/widgets/MessageBox.hpp index 673ec16f..7290b73a 100755..100644 --- a/widgets/MessageBox.hpp +++ b/widgets/MessageBox.hpp @@ -1,58 +1,58 @@ -#ifndef MESSAGE_BOX_HPP__
-#define MESSAGE_BOX_HPP__
-
-#include <QMessageBox>
-
-// get rid of the nasty MS define
-#ifdef MessageBox
-#undef MessageBox
-#endif
-
-//
-// MessageBox - wrap the Qt QMessageBox class to give a more platform
-// neutral and functional interface
-//
-class MessageBox
- : public QMessageBox
-{
-public:
- explicit MessageBox (QWidget * parent = nullptr);
- explicit MessageBox (Icon, QString const& text, StandardButtons = NoButton
- , QWidget * parent = nullptr
- , Qt::WindowFlags = Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint);
-
- static void about_message (QWidget * parent, QString const& text);
- static void about_Qt_message (QWidget * parent);
- static StandardButton information_message (QWidget * parent, QString const& text
- , QString const& informative = QString {}
- , QString const& detail = QString {}
- , StandardButtons buttons = Ok
- , StandardButton default_button = NoButton);
- static StandardButton query_message (QWidget * parent, QString const& text
- , QString const& informative = QString {}
- , QString const& detail = QString {}
- , StandardButtons buttons = Yes | No
- , StandardButton default_button = NoButton);
- static StandardButton warning_message (QWidget * parent, QString const& text
- , QString const& informative = QString {}
- , QString const& detail = QString {}
- , StandardButtons buttons = Ok
- , StandardButton default_button = NoButton);
- static StandardButton critical_message (QWidget * parent, QString const& text
- , QString const& informative = QString {}
- , QString const& detail = QString {}
- , StandardButtons buttons = Ok
- , StandardButton default_button = NoButton);
-private:
- // hide the parent static functions so that users use our versions
- // above that are correctly branded and have better platform
- // independence
- using QMessageBox::about;
- using QMessageBox::aboutQt;
- using QMessageBox::information;
- using QMessageBox::question;
- using QMessageBox::warning;
- using QMessageBox::critical;
-};
-
-#endif
+#ifndef MESSAGE_BOX_HPP__ +#define MESSAGE_BOX_HPP__ + +#include <QMessageBox> + +// get rid of the nasty MS define +#ifdef MessageBox +#undef MessageBox +#endif + +// +// MessageBox - wrap the Qt QMessageBox class to give a more platform +// neutral and functional interface +// +class MessageBox + : public QMessageBox +{ +public: + explicit MessageBox (QWidget * parent = nullptr); + explicit MessageBox (Icon, QString const& text, StandardButtons = NoButton + , QWidget * parent = nullptr + , Qt::WindowFlags = Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint); + + static void about_message (QWidget * parent, QString const& text); + static void about_Qt_message (QWidget * parent); + static StandardButton information_message (QWidget * parent, QString const& text + , QString const& informative = QString {} + , QString const& detail = QString {} + , StandardButtons buttons = Ok + , StandardButton default_button = NoButton); + static StandardButton query_message (QWidget * parent, QString const& text + , QString const& informative = QString {} + , QString const& detail = QString {} + , StandardButtons buttons = Yes | No + , StandardButton default_button = NoButton); + static StandardButton warning_message (QWidget * parent, QString const& text + , QString const& informative = QString {} + , QString const& detail = QString {} + , StandardButtons buttons = Ok + , StandardButton default_button = NoButton); + static StandardButton critical_message (QWidget * parent, QString const& text + , QString const& informative = QString {} + , QString const& detail = QString {} + , StandardButtons buttons = Ok + , StandardButton default_button = NoButton); +private: + // hide the parent static functions so that users use our versions + // above that are correctly branded and have better platform + // independence + using QMessageBox::about; + using QMessageBox::aboutQt; + using QMessageBox::information; + using QMessageBox::question; + using QMessageBox::warning; + using QMessageBox::critical; +}; + +#endif diff --git a/widgets/MultiGeometryWidget.hpp b/widgets/MultiGeometryWidget.hpp index 01b2fd5e..a9386189 100755..100644 --- a/widgets/MultiGeometryWidget.hpp +++ b/widgets/MultiGeometryWidget.hpp @@ -1,92 +1,92 @@ -#ifndef MULTI_GEOMETRY_WIDGET_HPP__
-#define MULTI_GEOMETRY_WIDGET_HPP__
-
-#include <cstddef>
-#include <utility>
-#include <array>
-
-#include <QWidget>
-#include <QByteArray>
-#include <QEvent>
-
-//
-// Class MultiGeometryWidget<N, Widget> - Decorate a QWidget type with
-// switchable geometries
-//
-// The abstract base class imbues a Qt Widget type with N alternative
-// geometries. Sub-classes can initialise the currently selected
-// geometry and the initial geometries using geometries. To switch
-// geometry call select_geometry(n) which saves the current geometry
-// and switches to the n'th saved geometry.
-//
-template<std::size_t N, typename Widget=QWidget>
-class MultiGeometryWidget
- : public Widget
-{
-public:
- template<typename... Args>
- explicit MultiGeometryWidget (Args&&... args)
- : Widget {std::forward<Args> (args)...}
- , current_geometry_ {0}
- {
- }
-
- void geometries (std::size_t current
- , std::array<QByteArray, N> const& the_geometries = std::array<QByteArray, N> {})
- {
- Q_ASSERT (current < the_geometries.size ());
- saved_geometries_ = the_geometries;
- current_geometry_ = current;
- Widget::restoreGeometry (saved_geometries_[current_geometry_]);
- }
-
- std::array<QByteArray, N> const& geometries () const {return saved_geometries_;}
- std::size_t current () {return current_geometry_;}
-
- // Call this to select a new geometry denoted by the 'n' argument,
- // any actual layout changes should be made in the implementation of
- // the change_layout operation below.
- void select_geometry (std::size_t n)
- {
- Q_ASSERT (n < N);
- auto geometry = Widget::saveGeometry ();
- change_layout (n);
- saved_geometries_[current_geometry_] = geometry;
- current_geometry_ = n;
-
- // Defer restoration of the window geometry until the layour
- // request event has been processed, this is necessary otherwise
- // the final geometry may be affected by widgets not shown in the
- // new layout.
- desired_geometry_ = saved_geometries_[n];
- }
-
-protected:
- virtual ~MultiGeometryWidget () {}
-
-private:
- // Override this operation to implement any layout changes for the
- // geometry specified by the argument 'n'.
- virtual void change_layout (std::size_t n) = 0;
-
- bool event (QEvent * e) override
- {
- auto ret = Widget::event (e);
- if (QEvent::LayoutRequest == e->type ()
- && desired_geometry_.size ())
- {
- // Restore the new desired geometry and flag that we have done
- // so by clearing the desired_geometry_ member variable.
- QByteArray geometry;
- std::swap (geometry, desired_geometry_);
- Widget::restoreGeometry (geometry);
- }
- return ret;
- }
-
- std::size_t current_geometry_;
- std::array<QByteArray, N> saved_geometries_;
- QByteArray desired_geometry_;
-};
-
-#endif
+#ifndef MULTI_GEOMETRY_WIDGET_HPP__ +#define MULTI_GEOMETRY_WIDGET_HPP__ + +#include <cstddef> +#include <utility> +#include <array> + +#include <QWidget> +#include <QByteArray> +#include <QEvent> + +// +// Class MultiGeometryWidget<N, Widget> - Decorate a QWidget type with +// switchable geometries +// +// The abstract base class imbues a Qt Widget type with N alternative +// geometries. Sub-classes can initialise the currently selected +// geometry and the initial geometries using geometries. To switch +// geometry call select_geometry(n) which saves the current geometry +// and switches to the n'th saved geometry. +// +template<std::size_t N, typename Widget=QWidget> +class MultiGeometryWidget + : public Widget +{ +public: + template<typename... Args> + explicit MultiGeometryWidget (Args&&... args) + : Widget {std::forward<Args> (args)...} + , current_geometry_ {0} + { + } + + void geometries (std::size_t current + , std::array<QByteArray, N> const& the_geometries = std::array<QByteArray, N> {}) + { + Q_ASSERT (current < the_geometries.size ()); + saved_geometries_ = the_geometries; + current_geometry_ = current; + Widget::restoreGeometry (saved_geometries_[current_geometry_]); + } + + std::array<QByteArray, N> const& geometries () const {return saved_geometries_;} + std::size_t current () {return current_geometry_;} + + // Call this to select a new geometry denoted by the 'n' argument, + // any actual layout changes should be made in the implementation of + // the change_layout operation below. + void select_geometry (std::size_t n) + { + Q_ASSERT (n < N); + auto geometry = Widget::saveGeometry (); + change_layout (n); + saved_geometries_[current_geometry_] = geometry; + current_geometry_ = n; + + // Defer restoration of the window geometry until the layour + // request event has been processed, this is necessary otherwise + // the final geometry may be affected by widgets not shown in the + // new layout. + desired_geometry_ = saved_geometries_[n]; + } + +protected: + virtual ~MultiGeometryWidget () {} + +private: + // Override this operation to implement any layout changes for the + // geometry specified by the argument 'n'. + virtual void change_layout (std::size_t n) = 0; + + bool event (QEvent * e) override + { + auto ret = Widget::event (e); + if (QEvent::LayoutRequest == e->type () + && desired_geometry_.size ()) + { + // Restore the new desired geometry and flag that we have done + // so by clearing the desired_geometry_ member variable. + QByteArray geometry; + std::swap (geometry, desired_geometry_); + Widget::restoreGeometry (geometry); + } + return ret; + } + + std::size_t current_geometry_; + std::array<QByteArray, N> saved_geometries_; + QByteArray desired_geometry_; +}; + +#endif diff --git a/widgets/QSYMessage.cpp b/widgets/QSYMessage.cpp index c8437c6a..9078c774 100755..100644 --- a/widgets/QSYMessage.cpp +++ b/widgets/QSYMessage.cpp @@ -1,365 +1,365 @@ -#include <QApplication>
-#include <QSettings>
-#include <QCloseEvent>
-#include <QDateTime>
-#include "SettingsGroup.hpp"
-#include "Configuration.hpp"
-#include "QSYMessage.h"
-#include "ui_QSYMessage.h"
-
-QSYMessage::QSYMessage(const QString& message,const QString& theCall, QSettings * settings, Configuration const * configuration, QWidget *parent) :
- QWidget {parent},
- settings_ {settings},
- configuration_ {configuration},
- ui(new Ui::QSYMessage),
- receivedMessage(message),receivedCall(theCall)
-{
- ui->setupUi(this);
- read_settings();
- setWindowTitle ("Message" + QDateTime::currentDateTimeUtc().toString(" [hh:mm:ss]"));
- ui->label->setStyleSheet("font: bold; font-size: 30pt");
- getBandModeFreq();
-}
-
-QSYMessage::~QSYMessage()
-{
- delete ui;
-}
-
-void QSYMessage::closeEvent (QCloseEvent * e) {
- write_settings();
- e->accept();
-}
-
-void QSYMessage::read_settings () {
- SettingsGroup g (settings_, "QSYMessage");
- move (settings_->value ("window/pos", pos()).toPoint());
-}
-
-void QSYMessage::write_settings () {
- SettingsGroup g (settings_, "QSYMessage");
- settings_->setValue ("window/pos", pos());
-}
-
-void QSYMessage::on_yesButton_clicked()
-{
- QString message = QString(Radio::base_callsign(receivedCall)) + QString(".OKQSY");
- Q_EMIT sendReply(message);
- ui->yesButton->setStyleSheet("background-color:#00ff00");
- ui->noButton->setStyleSheet("background-color:palette(button).color()");
-}
-
-void QSYMessage::on_noButton_clicked()
-{
- QString message = QString(Radio::base_callsign(receivedCall)) + QString(".NOQSY");
- Q_EMIT sendReply(message);
- ui->noButton->setStyleSheet("background-color:red; color:white");
- ui->yesButton->setStyleSheet("background-color:palette(button).color()");
-}
-
-void QSYMessage::getBandModeFreq()
-{
- if(receivedMessage.at(0) =='$' && receivedMessage.size() >= 5)
- {
-#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0)
- QStringList bhList = receivedMessage.split(" ",Qt::SkipEmptyParts);
-#else
- QStringList bhList = receivedMessage.split(" ",QString::SkipEmptyParts);
-#endif
- ui->label->setText(bhList[1] + " replied " +bhList[2].mid(0,2));
- ui->yesButton->hide();
- ui->noButton->hide();
- }
- else if(receivedMessage.at(0) =='Z' && receivedMessage.at(1) =='A' && receivedMessage.size() >= 5) {
- QString messageContent = "";
- QString text1 = "";
- QString msgNum =receivedMessage.mid(2,3);
- if(msgNum == "001") {
- text1 = "You are in the log";
- } else if(msgNum =="002") {
- text1 = "Please call me by phone";
- } else if(msgNum =="003") {
- text1 = "Check your email";
- } else if(msgNum =="004") {
- text1 = "You are not in Contest Mode";
- } else if(msgNum =="005") {
- text1 = "Please check your PC Clock";
- } else if(msgNum =="006") {
- text1 = "You are transmitting in the wrong time slot";
- } else if(msgNum =="007") {
- text1 = "Please transmit above 1000 Hz";
- } else if(msgNum =="008") {
- text1 = "Your transmitter is overmodulated";
- } else if(msgNum =="009") {
- text1 = "Your audio is distorted";
- } else if(msgNum =="010") {
- text1 = "You are transmitting on top of a rare DX station";
- } else if(msgNum =="011") {
- text1 = "Please check HB9Q Logger";
- } else if(msgNum =="012") {
- text1 = "Please check Ping Jockey";
- } else if(msgNum =="013") {
- text1 = "Please check ON4KST";
- } else if(msgNum =="014") {
- text1 = "Please QSL via LoTW";
- }
- ui->noButton->setHidden(true);
- ui->yesButton->setText("OK");
- ui->label->setText(text1);
- }
- else if(receivedMessage.at(0).isLetter() || receivedMessage.at(0) == '9' || receivedMessage.at(0) == '4' || receivedMessage.at(0) == '7')
- {
- QString bandParam = "";
- QString modeParam = receivedMessage.at(0);
- QString freqParam = "";
- bandParam = receivedMessage.mid(0,1);
- modeParam = receivedMessage.at(1);
- freqParam = receivedMessage.mid(2, 3);
- QString band = "";
- QString mode = "";
- QString freq = "";
-
- if (bandParam == "A") {
- if (modeParam.at(0).isLetter()) {
- freq = "50.";
- } else {
- if (modeParam =="0") {
- freq = "50.";
- } else if (modeParam =="1") {
- freq = "51.";
- } else if (modeParam =="2") {
- freq = "52.";
- } else if (modeParam =="3") {
- freq = "53.";
- }
- }
- }
- else if (bandParam == "B") {
- if (modeParam.at(0).isLetter()) {
- freq = "144.";
- } else {
- if (modeParam =="4") {
- freq = "144.";
- } else if (modeParam =="5") {
- freq = "145.";
- } else if (modeParam =="6") {
- freq = "146.";
- } else if (modeParam =="7") {
- freq = "147.";
- }
- }
- }
- else if (bandParam == "C") {
- if (modeParam.at(0).isLetter()) {
- freq = "222.";
- } else {
- if (modeParam =="2") {
- freq = "222.";
- } else if (modeParam =="3") {
- freq = "223.";
- }
- }
- }
- else if (bandParam == "D") {
- if (modeParam.at(0).isLetter()) {
- freq = "432.";
- } else {
- if (configuration_->region()==2) {
- if (modeParam =="0") {
- freq = "440.";
- } else if (modeParam =="1") {
- freq = "441.";
- } else if (modeParam =="2") {
- freq = "442.";
- } else if (modeParam =="3") {
- freq = "443.";
- } else if (modeParam =="4") {
- freq = "444.";
- } else if (modeParam =="5") {
- freq = "445.";
- } else if (modeParam =="6") {
- freq = "446.";
- } else if (modeParam =="7") {
- freq = "447.";
- } else if (modeParam =="8") {
- freq = "448.";
- } else if (modeParam =="9") {
- freq = "449.";
- }
- } else { //not region 2
- if (modeParam =="0") {
- freq = "430.";
- } else if (modeParam =="1") {
- freq = "431.";
- } else if (modeParam =="2") {
- freq = "432.";
- } else if (modeParam =="3") {
- freq = "433.";
- } else if (modeParam =="4") {
- freq = "434.";
- } else if (modeParam =="5") {
- freq = "435.";
- } else if (modeParam =="6") {
- freq = "436.";
- } else if (modeParam =="7") {
- freq = "437.";
- } else if (modeParam =="8") {
- freq = "438.";
- } else if (modeParam =="9") {
- freq = "439.";
- }
- }
- }
- }
- else if (bandParam == "E") {
- if (modeParam.at(0).isLetter()) {
- freq = "1296.";
- } else {
- if (modeParam =="0") {
- freq = "1290.";
- } else if (modeParam =="1") {
- freq = "1291.";
- } else if (modeParam =="2") {
- freq = "1292.";
- } else if (modeParam =="3") {
- freq = "1293.";
- } else if (modeParam =="4") {
- freq = "1294.";
- } else if (modeParam =="5") {
- freq = "1295.";
- } else if (modeParam =="6") {
- freq = "1296.";
- } else if (modeParam =="7") {
- freq = "1297.";
- } else if (modeParam =="8") {
- freq = "1298.";
- } else if (modeParam =="9") {
- freq = "1299.";
- }
- }
- }
- else if (bandParam == "F") {
- freq = "2304.";
- }
- else if (bandParam == "G") {
- freq = "3400.";
- }
- else if (bandParam == "H") {
- freq = "5760.";
- }
- else if (bandParam == "I") {
- freq = "10368.";
- }
- else if (bandParam == "J") {
- if (configuration_->region()==2) {
- freq = "24192.";
- } else {
- freq = "24048.";
- }
- }
- else if (bandParam == "9") {
- freq = "902.";
- }
- else if (bandParam == "K") {
- freq = "903.";
- }
- else if (bandParam == "J") {
- freq = "24192.";
- }
- else if (bandParam == "X") {
- freq = "24048.";
- }
- else if (bandParam == "4") {
- freq = "40.";
- }
- else if (bandParam == "7") {
- freq = "70.";
- }
- else if (bandParam == "L") {
- freq = "0.";
- }
- else if (bandParam == "M") {
- freq = "1.";
- }
- else if (bandParam == "N") {
- freq = "3.";
- }
- else if (bandParam == "O") {
- freq = "5.";
- }
- else if (bandParam == "P") {
- freq = "7.";
- }
- else if (bandParam == "Q") {
- freq = "10.";
- }
- else if (bandParam == "R") {
- freq = "14.";
- }
- else if (bandParam == "S") {
- freq = "18.";
- }
- else if (bandParam == "T") {
- freq = "21.";
- }
- else if (bandParam == "U") {
- freq = "24.";
- }
- else if (bandParam == "V") {
- freq = "28.";
- }
- else if (bandParam == "W") {
- freq = "29.";
- } else {
- freq = "";
- }
-
- freq = freq + freqParam;
- if(!modeParam.at(0).isLetter()) {
- mode = "FM";
- }
- else if (modeParam == 'V') {
- mode = "SSB";
- }
- else if (modeParam == 'J') {
- mode = "FT4";
- }
- else if (modeParam == 'L') {
- mode = "FT8";
- }
- else if (modeParam == 'K') {
- mode = "MSK144";
- }
- else if (modeParam == 'W') {
- mode = "CW";
- }
- else if (modeParam == 'A') {
- mode = "JT9";
- }
- else if (modeParam == 'B') {
- mode = "JT65";
- }
- else if (modeParam == 'C') {
- mode = "FST4";
- }
- else if (modeParam == 'D') {
- mode = "Q65-30B";
- }
- else if (modeParam == 'E') {
- mode = "Q65-60C";
- }
- else if (modeParam == 'F') {
- mode = "Q65-60D";
- }
- else if (modeParam == 'G') {
- mode = "Q65-60E";
- }
- else if (modeParam == 'H') {
- mode = "Q65-120D";
- }
- else {
- mode = "";
- }
- ui->label->setText("QSY to\n" + freq + " MHz\n" + "mode " + mode);
- }
-}
+#include <QApplication> +#include <QSettings> +#include <QCloseEvent> +#include <QDateTime> +#include "SettingsGroup.hpp" +#include "Configuration.hpp" +#include "QSYMessage.h" +#include "ui_QSYMessage.h" + +QSYMessage::QSYMessage(const QString& message,const QString& theCall, QSettings * settings, Configuration const * configuration, QWidget *parent) : + QWidget {parent}, + settings_ {settings}, + configuration_ {configuration}, + ui(new Ui::QSYMessage), + receivedMessage(message),receivedCall(theCall) +{ + ui->setupUi(this); + read_settings(); + setWindowTitle ("Message" + QDateTime::currentDateTimeUtc().toString(" [hh:mm:ss]")); + ui->label->setStyleSheet("font: bold; font-size: 30pt"); + getBandModeFreq(); +} + +QSYMessage::~QSYMessage() +{ + delete ui; +} + +void QSYMessage::closeEvent (QCloseEvent * e) { + write_settings(); + e->accept(); +} + +void QSYMessage::read_settings () { + SettingsGroup g (settings_, "QSYMessage"); + move (settings_->value ("window/pos", pos()).toPoint()); +} + +void QSYMessage::write_settings () { + SettingsGroup g (settings_, "QSYMessage"); + settings_->setValue ("window/pos", pos()); +} + +void QSYMessage::on_yesButton_clicked() +{ + QString message = QString(Radio::base_callsign(receivedCall)) + QString(".OKQSY"); + Q_EMIT sendReply(message); + ui->yesButton->setStyleSheet("background-color:#00ff00"); + ui->noButton->setStyleSheet("background-color:palette(button).color()"); +} + +void QSYMessage::on_noButton_clicked() +{ + QString message = QString(Radio::base_callsign(receivedCall)) + QString(".NOQSY"); + Q_EMIT sendReply(message); + ui->noButton->setStyleSheet("background-color:red; color:white"); + ui->yesButton->setStyleSheet("background-color:palette(button).color()"); +} + +void QSYMessage::getBandModeFreq() +{ + if(receivedMessage.at(0) =='$' && receivedMessage.size() >= 5) + { +#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0) + QStringList bhList = receivedMessage.split(" ",Qt::SkipEmptyParts); +#else + QStringList bhList = receivedMessage.split(" ",QString::SkipEmptyParts); +#endif + ui->label->setText(bhList[1] + " replied " +bhList[2].mid(0,2)); + ui->yesButton->hide(); + ui->noButton->hide(); + } + else if(receivedMessage.at(0) =='Z' && receivedMessage.at(1) =='A' && receivedMessage.size() >= 5) { + QString messageContent = ""; + QString text1 = ""; + QString msgNum =receivedMessage.mid(2,3); + if(msgNum == "001") { + text1 = "You are in the log"; + } else if(msgNum =="002") { + text1 = "Please call me by phone"; + } else if(msgNum =="003") { + text1 = "Check your email"; + } else if(msgNum =="004") { + text1 = "You are not in Contest Mode"; + } else if(msgNum =="005") { + text1 = "Please check your PC Clock"; + } else if(msgNum =="006") { + text1 = "You are transmitting in the wrong time slot"; + } else if(msgNum =="007") { + text1 = "Please transmit above 1000 Hz"; + } else if(msgNum =="008") { + text1 = "Your transmitter is overmodulated"; + } else if(msgNum =="009") { + text1 = "Your audio is distorted"; + } else if(msgNum =="010") { + text1 = "You are transmitting on top of a rare DX station"; + } else if(msgNum =="011") { + text1 = "Please check HB9Q Logger"; + } else if(msgNum =="012") { + text1 = "Please check Ping Jockey"; + } else if(msgNum =="013") { + text1 = "Please check ON4KST"; + } else if(msgNum =="014") { + text1 = "Please QSL via LoTW"; + } + ui->noButton->setHidden(true); + ui->yesButton->setText("OK"); + ui->label->setText(text1); + } + else if(receivedMessage.at(0).isLetter() || receivedMessage.at(0) == '9' || receivedMessage.at(0) == '4' || receivedMessage.at(0) == '7') + { + QString bandParam = ""; + QString modeParam = receivedMessage.at(0); + QString freqParam = ""; + bandParam = receivedMessage.mid(0,1); + modeParam = receivedMessage.at(1); + freqParam = receivedMessage.mid(2, 3); + QString band = ""; + QString mode = ""; + QString freq = ""; + + if (bandParam == "A") { + if (modeParam.at(0).isLetter()) { + freq = "50."; + } else { + if (modeParam =="0") { + freq = "50."; + } else if (modeParam =="1") { + freq = "51."; + } else if (modeParam =="2") { + freq = "52."; + } else if (modeParam =="3") { + freq = "53."; + } + } + } + else if (bandParam == "B") { + if (modeParam.at(0).isLetter()) { + freq = "144."; + } else { + if (modeParam =="4") { + freq = "144."; + } else if (modeParam =="5") { + freq = "145."; + } else if (modeParam =="6") { + freq = "146."; + } else if (modeParam =="7") { + freq = "147."; + } + } + } + else if (bandParam == "C") { + if (modeParam.at(0).isLetter()) { + freq = "222."; + } else { + if (modeParam =="2") { + freq = "222."; + } else if (modeParam =="3") { + freq = "223."; + } + } + } + else if (bandParam == "D") { + if (modeParam.at(0).isLetter()) { + freq = "432."; + } else { + if (configuration_->region()==2) { + if (modeParam =="0") { + freq = "440."; + } else if (modeParam =="1") { + freq = "441."; + } else if (modeParam =="2") { + freq = "442."; + } else if (modeParam =="3") { + freq = "443."; + } else if (modeParam =="4") { + freq = "444."; + } else if (modeParam =="5") { + freq = "445."; + } else if (modeParam =="6") { + freq = "446."; + } else if (modeParam =="7") { + freq = "447."; + } else if (modeParam =="8") { + freq = "448."; + } else if (modeParam =="9") { + freq = "449."; + } + } else { //not region 2 + if (modeParam =="0") { + freq = "430."; + } else if (modeParam =="1") { + freq = "431."; + } else if (modeParam =="2") { + freq = "432."; + } else if (modeParam =="3") { + freq = "433."; + } else if (modeParam =="4") { + freq = "434."; + } else if (modeParam =="5") { + freq = "435."; + } else if (modeParam =="6") { + freq = "436."; + } else if (modeParam =="7") { + freq = "437."; + } else if (modeParam =="8") { + freq = "438."; + } else if (modeParam =="9") { + freq = "439."; + } + } + } + } + else if (bandParam == "E") { + if (modeParam.at(0).isLetter()) { + freq = "1296."; + } else { + if (modeParam =="0") { + freq = "1290."; + } else if (modeParam =="1") { + freq = "1291."; + } else if (modeParam =="2") { + freq = "1292."; + } else if (modeParam =="3") { + freq = "1293."; + } else if (modeParam =="4") { + freq = "1294."; + } else if (modeParam =="5") { + freq = "1295."; + } else if (modeParam =="6") { + freq = "1296."; + } else if (modeParam =="7") { + freq = "1297."; + } else if (modeParam =="8") { + freq = "1298."; + } else if (modeParam =="9") { + freq = "1299."; + } + } + } + else if (bandParam == "F") { + freq = "2304."; + } + else if (bandParam == "G") { + freq = "3400."; + } + else if (bandParam == "H") { + freq = "5760."; + } + else if (bandParam == "I") { + freq = "10368."; + } + else if (bandParam == "J") { + if (configuration_->region()==2) { + freq = "24192."; + } else { + freq = "24048."; + } + } + else if (bandParam == "9") { + freq = "902."; + } + else if (bandParam == "K") { + freq = "903."; + } + else if (bandParam == "J") { + freq = "24192."; + } + else if (bandParam == "X") { + freq = "24048."; + } + else if (bandParam == "4") { + freq = "40."; + } + else if (bandParam == "7") { + freq = "70."; + } + else if (bandParam == "L") { + freq = "0."; + } + else if (bandParam == "M") { + freq = "1."; + } + else if (bandParam == "N") { + freq = "3."; + } + else if (bandParam == "O") { + freq = "5."; + } + else if (bandParam == "P") { + freq = "7."; + } + else if (bandParam == "Q") { + freq = "10."; + } + else if (bandParam == "R") { + freq = "14."; + } + else if (bandParam == "S") { + freq = "18."; + } + else if (bandParam == "T") { + freq = "21."; + } + else if (bandParam == "U") { + freq = "24."; + } + else if (bandParam == "V") { + freq = "28."; + } + else if (bandParam == "W") { + freq = "29."; + } else { + freq = ""; + } + + freq = freq + freqParam; + if(!modeParam.at(0).isLetter()) { + mode = "FM"; + } + else if (modeParam == 'V') { + mode = "SSB"; + } + else if (modeParam == 'J') { + mode = "FT4"; + } + else if (modeParam == 'L') { + mode = "FT8"; + } + else if (modeParam == 'K') { + mode = "MSK144"; + } + else if (modeParam == 'W') { + mode = "CW"; + } + else if (modeParam == 'A') { + mode = "JT9"; + } + else if (modeParam == 'B') { + mode = "JT65"; + } + else if (modeParam == 'C') { + mode = "FST4"; + } + else if (modeParam == 'D') { + mode = "Q65-30B"; + } + else if (modeParam == 'E') { + mode = "Q65-60C"; + } + else if (modeParam == 'F') { + mode = "Q65-60D"; + } + else if (modeParam == 'G') { + mode = "Q65-60E"; + } + else if (modeParam == 'H') { + mode = "Q65-120D"; + } + else { + mode = ""; + } + ui->label->setText("QSY to\n" + freq + " MHz\n" + "mode " + mode); + } +} diff --git a/widgets/QSYMessage.h b/widgets/QSYMessage.h index 71ba08b2..5ed4d354 100755..100644 --- a/widgets/QSYMessage.h +++ b/widgets/QSYMessage.h @@ -1,47 +1,47 @@ -// -*- Mode: C++ -*-
-#ifndef QSYMESSAGE_H
-#define QSYMESSAGE_H
-
-#include <QWidget>
-#include <QCloseEvent>
-
-class QSettings;
-class Configuration;
-namespace Ui {
- class QSYMessage;
-}
-
-class QSYMessage
- : public QWidget
-{
- Q_OBJECT
-
-
-public:
- explicit QSYMessage(const QString& message, const QString& theCall, QSettings * settings, Configuration const *, QWidget * parent = 0);
- ~QSYMessage();
- void getBandModeFreq();
-
-public slots:
- void write_settings ();
-
-protected:
- void closeEvent(QCloseEvent *event) override;
-
-signals:
- void sendReply(const QString &value);
-
-private:
- QSettings * settings_;
- Configuration const * configuration_;
- Ui::QSYMessage *ui;
- QString receivedMessage;
- QString receivedCall;
-
-private slots:
- void on_yesButton_clicked();
- void on_noButton_clicked();
- void read_settings ();
-};
-
-#endif //QSYMESSAGE_H
+// -*- Mode: C++ -*- +#ifndef QSYMESSAGE_H +#define QSYMESSAGE_H + +#include <QWidget> +#include <QCloseEvent> + +class QSettings; +class Configuration; +namespace Ui { + class QSYMessage; +} + +class QSYMessage + : public QWidget +{ + Q_OBJECT + + +public: + explicit QSYMessage(const QString& message, const QString& theCall, QSettings * settings, Configuration const *, QWidget * parent = 0); + ~QSYMessage(); + void getBandModeFreq(); + +public slots: + void write_settings (); + +protected: + void closeEvent(QCloseEvent *event) override; + +signals: + void sendReply(const QString &value); + +private: + QSettings * settings_; + Configuration const * configuration_; + Ui::QSYMessage *ui; + QString receivedMessage; + QString receivedCall; + +private slots: + void on_yesButton_clicked(); + void on_noButton_clicked(); + void read_settings (); +}; + +#endif //QSYMESSAGE_H diff --git a/widgets/QSYMessage.ui b/widgets/QSYMessage.ui index 9d88ce5d..f39a180d 100755..100644 --- a/widgets/QSYMessage.ui +++ b/widgets/QSYMessage.ui @@ -1,99 +1,99 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>QSYMessage</class>
- <widget class="QWidget" name="QSYMessage">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>449</width>
- <height>300</height>
- </rect>
- </property>
- <property name="minimumSize">
- <size>
- <width>449</width>
- <height>300</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>449</width>
- <height>300</height>
- </size>
- </property>
- <property name="windowTitle">
- <string>WSJT-X Popup</string>
- </property>
- <widget class="QLabel" name="label">
- <property name="geometry">
- <rect>
- <x>3</x>
- <y>10</y>
- <width>443</width>
- <height>231</height>
- </rect>
- </property>
- <property name="font">
- <font>
- <pointsize>30</pointsize>
- <bold>true</bold>
- </font>
- </property>
- <property name="text">
- <string>TextLabel</string>
- </property>
- <property name="scaledContents">
- <bool>true</bool>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- </widget>
- <widget class="QPushButton" name="yesButton">
- <property name="geometry">
- <rect>
- <x>20</x>
- <y>240</y>
- <width>75</width>
- <height>51</height>
- </rect>
- </property>
- <property name="font">
- <font>
- <pointsize>10</pointsize>
- <bold>true</bold>
- </font>
- </property>
- <property name="text">
- <string>Reply
-Yes</string>
- </property>
- </widget>
- <widget class="QPushButton" name="noButton">
- <property name="geometry">
- <rect>
- <x>360</x>
- <y>240</y>
- <width>75</width>
- <height>51</height>
- </rect>
- </property>
- <property name="font">
- <font>
- <pointsize>10</pointsize>
- <bold>true</bold>
- </font>
- </property>
- <property name="text">
- <string>Reply
-No</string>
- </property>
- </widget>
- </widget>
- <resources/>
- <connections/>
-</ui>
+<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>QSYMessage</class> + <widget class="QWidget" name="QSYMessage"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>449</width> + <height>300</height> + </rect> + </property> + <property name="minimumSize"> + <size> + <width>449</width> + <height>300</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>449</width> + <height>300</height> + </size> + </property> + <property name="windowTitle"> + <string>WSJT-X Popup</string> + </property> + <widget class="QLabel" name="label"> + <property name="geometry"> + <rect> + <x>3</x> + <y>10</y> + <width>443</width> + <height>231</height> + </rect> + </property> + <property name="font"> + <font> + <pointsize>30</pointsize> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>TextLabel</string> + </property> + <property name="scaledContents"> + <bool>true</bool> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + </widget> + <widget class="QPushButton" name="yesButton"> + <property name="geometry"> + <rect> + <x>20</x> + <y>240</y> + <width>75</width> + <height>51</height> + </rect> + </property> + <property name="font"> + <font> + <pointsize>10</pointsize> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>Reply +Yes</string> + </property> + </widget> + <widget class="QPushButton" name="noButton"> + <property name="geometry"> + <rect> + <x>360</x> + <y>240</y> + <width>75</width> + <height>51</height> + </rect> + </property> + <property name="font"> + <font> + <pointsize>10</pointsize> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>Reply +No</string> + </property> + </widget> + </widget> + <resources/> + <connections/> +</ui> diff --git a/widgets/QSYMessageCreator.cpp b/widgets/QSYMessageCreator.cpp index 840c33cb..0529c876 100755..100644 --- a/widgets/QSYMessageCreator.cpp +++ b/widgets/QSYMessageCreator.cpp @@ -1,1543 +1,1543 @@ -#include "QSYMessageCreator.h"
-#include <QApplication>
-#include <QSettings>
-#include <QRadioButton>
-#include <QButtonGroup>
-#include <QObject>
-#include <QMessageBox>
-#include <QInputDialog>
-#include <QCloseEvent>
-#include <QTimer>
-#include <QThread>
-#include <QTabWidget>
-#include <QDialog>
-#include <QPushButton>
-#include <QLabel>
-#include <QWidget>
-#include <QLayout>
-#include <QSpinBox>
-#include <QMap>
-#include <QProxyStyle>
-#include "commons.h"
-#include "SettingsGroup.hpp"
-#include "Configuration.hpp"
-#include "qt_helpers.hpp"
-#include "QSYMessageCreator.h"
-#include "ui_QSYMessageCreator.h"
-
-QSYMessageCreator::QSYMessageCreator(QSettings * settings, Configuration const * configuration, QWidget *parent)
- : QWidget(parent),
- settings_ {settings},
- configuration_ {configuration},
- ui(new Ui::QSYMessageCreator) {
- ui->setupUi(this);
- setWindowTitle (QApplication::applicationName () + " - " + tr ("MessageCreator"));
- QButtonGroup *modeButtonGroup = new QButtonGroup;
- modeButtonGroup-> setExclusive(true);
- modeButtonGroup->addButton(ui->radioButFM);
- modeButtonGroup->addButton(ui->radioButSSB);
- modeButtonGroup->addButton(ui->radioButCW);
- modeButtonGroup->addButton(ui->radioButFT8);
- modeButtonGroup->addButton(ui->radioButMSK);
-
- QButtonGroup *bandButtonGroup = new QButtonGroup;
- bandButtonGroup-> setExclusive(true);
- bandButtonGroup->addButton(ui->radioBut50);
- bandButtonGroup->addButton(ui->radioBut144);
- bandButtonGroup->addButton(ui->radioBut222);
- bandButtonGroup->addButton(ui->radioBut432);
- bandButtonGroup->addButton(ui->radioBut902);
- bandButtonGroup->addButton(ui->radioBut903);
- bandButtonGroup->addButton(ui->radioBut1296);
- bandButtonGroup->addButton(ui->radioBut2304);
- bandButtonGroup->addButton(ui->radioBut3400);
- bandButtonGroup->addButton(ui->radioBut5760);
- bandButtonGroup->addButton(ui->radioBut10368);
- bandButtonGroup->addButton(ui->radioBut24192);
- bandButtonGroup->addButton(ui->radioBut40);
- bandButtonGroup->addButton(ui->radioBut70);
-
- QButtonGroup *modeButtonGroup2 = new QButtonGroup;
- modeButtonGroup2-> setExclusive(true);
- modeButtonGroup2->addButton(ui->radioButFM2);
- modeButtonGroup2->addButton(ui->radioButSSB2);
- modeButtonGroup2->addButton(ui->radioButCW2);
- modeButtonGroup2->addButton(ui->radioButFT82);
- modeButtonGroup2->addButton(ui->radioButFT4);
- modeButtonGroup2->addButton(ui->radioButJT9);
- modeButtonGroup2->addButton(ui->radioButJT65);
- modeButtonGroup2->addButton(ui->radioButFST4);
-
- QButtonGroup *bandButtonGroup2 = new QButtonGroup;
- bandButtonGroup2-> setExclusive(true);
- bandButtonGroup2->addButton(ui->radioBut630M);
- bandButtonGroup2->addButton(ui->radioBut160M);
- bandButtonGroup2->addButton(ui->radioBut80M);
- bandButtonGroup2->addButton(ui->radioBut60M);
- bandButtonGroup2->addButton(ui->radioBut40M);
- bandButtonGroup2->addButton(ui->radioBut30M);
- bandButtonGroup2->addButton(ui->radioBut20M);
- bandButtonGroup2->addButton(ui->radioBut17M);
- bandButtonGroup2->addButton(ui->radioBut15M);
- bandButtonGroup2->addButton(ui->radioBut12M);
- bandButtonGroup2->addButton(ui->radioBut10M1);
- bandButtonGroup2->addButton(ui->radioBut10M2);
-
- QButtonGroup *modeButtonGroup3 = new QButtonGroup;
- modeButtonGroup3-> setExclusive(true);
- modeButtonGroup3->addButton(ui->radioButQ6530B);
- modeButtonGroup3->addButton(ui->radioButQ6560C);
- modeButtonGroup3->addButton(ui->radioButCW3);
- modeButtonGroup3->addButton(ui->radioButQ6560D);
- modeButtonGroup3->addButton(ui->radioButQ6560E);
- modeButtonGroup3->addButton(ui->radioButQ65120D);
-
- QButtonGroup *bandButtonGroup3 = new QButtonGroup;
- bandButtonGroup3-> setExclusive(true);
- bandButtonGroup3->addButton(ui->radioBut50A);
- bandButtonGroup3->addButton(ui->radioBut144A);
- bandButtonGroup3->addButton(ui->radioBut222A);
- bandButtonGroup3->addButton(ui->radioBut432A);
- bandButtonGroup3->addButton(ui->radioBut902A);
- bandButtonGroup3->addButton(ui->radioBut903A);
- bandButtonGroup3->addButton(ui->radioBut1296A);
- bandButtonGroup3->addButton(ui->radioBut2304A);
- bandButtonGroup3->addButton(ui->radioBut3400A);
- bandButtonGroup3->addButton(ui->radioBut5760A);
- bandButtonGroup3->addButton(ui->radioBut10368A);
- bandButtonGroup3->addButton(ui->radioBut24048);
-
- QButtonGroup *messageButtonGroup = new QButtonGroup;
- messageButtonGroup-> setExclusive(true);
- messageButtonGroup->addButton(ui->message1);
- messageButtonGroup->addButton(ui->message2);
- messageButtonGroup->addButton(ui->message3);
- messageButtonGroup->addButton(ui->message4);
- messageButtonGroup->addButton(ui->message5);
- messageButtonGroup->addButton(ui->message6);
- messageButtonGroup->addButton(ui->message7);
- messageButtonGroup->addButton(ui->message8);
- messageButtonGroup->addButton(ui->message9);
- messageButtonGroup->addButton(ui->message10);
- messageButtonGroup->addButton(ui->message11);
- messageButtonGroup->addButton(ui->message12);
- messageButtonGroup->addButton(ui->message13);
- messageButtonGroup->addButton(ui->message14);
-
- read_settings();
-
- if(MHzFreqMap.size() < 4) {
- // need a MHZ map now that have selectable MHz values for FM mode
- if(configuration_->region() > 0) {
- if(configuration_->region() ==2) {
- MHzFreqMap.insert("A",52); //6M, 52 MHz
- MHzFreqMap.insert("B",146); //2M, 146 MHz
- MHzFreqMap.insert("C",223); //1.25M, 223 MHz
- MHzFreqMap.insert("D",446); //70cm, 446 MHz
- MHzFreqMap.insert("E",1294); //23 cm, 1294 MHz
- } else {
- MHzFreqMap.insert("A",50); //6M 50 MHz
- MHzFreqMap.insert("B",145); //2M, 145 MHz
- MHzFreqMap.insert("D",433); //70cm, 433 MHz
- MHzFreqMap.insert("E",1297); //23 cm, 1297 MHz
- }
- }
- }
-
- if(kHzFreqMap.size() < 10) {
- QPair<QString,QChar> key("L",'V'); //630m //SSB
- key.first = "M"; //160
- kHzFreqMap.insert(key, 910);
- key.first = "N"; //80
- kHzFreqMap.insert(key, 960);
- key.first = "O"; //60
- kHzFreqMap.insert(key, 354);
- key.first = "P"; //40
- kHzFreqMap.insert(key, 285);
- key.first = "R"; //20
- kHzFreqMap.insert(key, 285);
- key.first = "S"; //17
- kHzFreqMap.insert(key, 130);
- key.first = "T"; //15
- kHzFreqMap.insert(key, 385);
- key.first = "U"; //12
- kHzFreqMap.insert(key, 910);
- key.first = "V"; //28M
- kHzFreqMap.insert(key, 385);
-
- key.first = "L"; //630M
- key.second = 'W'; //CW
- kHzFreqMap.insert(key, 473);
- key.first = "M"; //160
- kHzFreqMap.insert(key, 810);
- key.first = "N"; //80
- kHzFreqMap.insert(key, 560);
- key.first = "O"; //60
- kHzFreqMap.insert(key, 353);
- key.first = "P"; //40
- kHzFreqMap.insert(key, 40);
- key.first = "Q"; //30
- kHzFreqMap.insert(key, 106);
- key.first = "R"; //20
- kHzFreqMap.insert(key, 60);
- key.first = "S"; //17
- kHzFreqMap.insert(key, 96);
- key.first = "T"; //15
- kHzFreqMap.insert(key, 60);
- key.first = "U"; //12
- kHzFreqMap.insert(key, 906);
- key.first = "V"; //28M
- kHzFreqMap.insert(key, 60);
-
- key.first = "V"; //28 MHz
- key.second = '9'; //FM
- kHzFreqMap.insert(key, 999);
- key.first = "W"; //29 MHz
- key.second = '9'; //FM
- kHzFreqMap.insert(key, 600);
-
- key.first = "L"; //630M
- key.second = 'C'; //FST4
- kHzFreqMap.insert(key, 474);
- key.first = "M"; //160
- kHzFreqMap.insert(key, 839);
- key.first = "N"; //80
- kHzFreqMap.insert(key, 577);
- key.first = "O"; //60
- kHzFreqMap.insert(key, 357);
- key.first = "P"; //40
- kHzFreqMap.insert(key, 49);
- key.first = "Q"; //30
- kHzFreqMap.insert(key, 142);
- key.first = "R"; //20
- kHzFreqMap.insert(key, 82);
- key.first = "S"; //17
- kHzFreqMap.insert(key, 106);
- key.first = "T"; //15
- kHzFreqMap.insert(key, 142);
- key.first = "U"; //12
- kHzFreqMap.insert(key, 921);
- key.first = "V"; //28M
- kHzFreqMap.insert(key, 182);
-
- key.second = 'J'; //FT4
- key.first = "N"; //80
- kHzFreqMap.insert(key, 575);
- key.first = "O"; //60
- kHzFreqMap.insert(key, 357);
- key.first = "P"; //40
- kHzFreqMap.insert(key, 47);
- key.first = "Q"; //30
- kHzFreqMap.insert(key, 140);
- key.first = "R"; //20
- kHzFreqMap.insert(key, 80);
- key.first = "S"; //17
- kHzFreqMap.insert(key, 104);
- key.first = "T"; //15
- kHzFreqMap.insert(key, 140);
- key.first = "U"; //12
- kHzFreqMap.insert(key, 919);
- key.first = "V"; //28M
- kHzFreqMap.insert(key, 180);
-
- key.second = 'L'; //FT8;
- key.first = "M"; //160
- kHzFreqMap.insert(key, 840);
- key.first = "N"; //80
- kHzFreqMap.insert(key, 573);
- key.first = "O"; //60
- kHzFreqMap.insert(key, 357);
- key.first = "P"; //40
- kHzFreqMap.insert(key, 74);
- key.first = "Q"; //30
- kHzFreqMap.insert(key, 136);
- key.first = "R"; //20
- kHzFreqMap.insert(key, 74);
- key.first = "S"; //17
- kHzFreqMap.insert(key, 100);
- key.first = "T"; //15
- kHzFreqMap.insert(key, 74);
- key.first = "U"; //12
- kHzFreqMap.insert(key, 915);
- key.first = "V"; //28M
- kHzFreqMap.insert(key, 74);
-
- key.second = 'B'; //JT65
- key.first = "M"; //160
- kHzFreqMap.insert(key, 838);
- key.first = "N"; //80
- kHzFreqMap.insert(key, 576);
- key.first = "O"; //60
- kHzFreqMap.insert(key, 357);
- key.first = "P"; //40
- kHzFreqMap.insert(key, 76);
- key.first = "Q"; //30
- kHzFreqMap.insert(key, 138);
- key.first = "R"; //20
- kHzFreqMap.insert(key, 76);
- key.first = "S"; //17
- kHzFreqMap.insert(key, 102);
- key.first = "T"; //15
- kHzFreqMap.insert(key, 76);
- key.first = "U"; //12
- kHzFreqMap.insert(key, 917);
- key.first = "V"; //28M
- kHzFreqMap.insert(key, 76);
-
- key.second = 'A'; //JT9
- key.first = "M"; //160
- kHzFreqMap.insert(key, 839);
- key.first = "N"; //80
- kHzFreqMap.insert(key, 572);
- key.first = "O"; //60
- kHzFreqMap.insert(key, 357);
- key.first = "P"; //40
- kHzFreqMap.insert(key, 78);
- key.first = "Q"; //30
- kHzFreqMap.insert(key, 140);
- key.first = "R"; //20
- kHzFreqMap.insert(key, 78);
- key.first = "S"; //17
- kHzFreqMap.insert(key, 104);
- key.first = "T"; //15
- kHzFreqMap.insert(key, 78);
- key.first = "U"; //12
- kHzFreqMap.insert(key, 919);
- key.first = "V"; //28M
- kHzFreqMap.insert(key, 78);
-
- //VHF and EME band/mode/freq
-
- key.second = 'V'; //SSB
- key.first = "A"; // 6M
- kHzFreqMap.insert(key, 125);
- key.first = "B"; //2M
- kHzFreqMap.insert(key, 200);
- key.first = "C"; //222
- kHzFreqMap.insert(key, 100);
- key.first = "D"; //432
- kHzFreqMap.insert(key, 100);
- key.first = "9"; //902
- kHzFreqMap.insert(key, 100);
- key.first = "K"; //903
- kHzFreqMap.insert(key, 100);
- key.first = "E"; //1296
- kHzFreqMap.insert(key, 100);
- key.first = "F"; //2304
- kHzFreqMap.insert(key, 100);
- key.first = "G"; //3400
- kHzFreqMap.insert(key, 100);
- key.first = "H"; //5760
- kHzFreqMap.insert(key, 100);
- key.first = "I"; //10368
- kHzFreqMap.insert(key, 100);
- key.first = "J"; //24192
- kHzFreqMap.insert(key, 100);
- key.first = "X"; //24048
- kHzFreqMap.insert(key, 100);
- key.first = "4"; //8M
- kHzFreqMap.insert(key, 680);
- key.first = "7"; //4M
- kHzFreqMap.insert(key, 200);
-
- key.second = 'W'; //CW
- key.first = "A"; // 6M
- kHzFreqMap.insert(key, 90);
- key.first = "B"; //2M
- kHzFreqMap.insert(key, 100);
- key.first = "C"; //222
- kHzFreqMap.insert(key, 100);
- key.first = "D"; //432
- kHzFreqMap.insert(key, 100);
- key.first = "9"; //902
- kHzFreqMap.insert(key, 100);
- key.first = "K"; //903
- kHzFreqMap.insert(key, 100);
- key.first = "E"; //1296
- kHzFreqMap.insert(key, 100);
- key.first = "F"; //2304
- kHzFreqMap.insert(key, 100);
- key.first = "G"; //3400
- kHzFreqMap.insert(key, 100);
- key.first = "H"; //5760
- kHzFreqMap.insert(key, 100);
- key.first = "I"; //10368
- kHzFreqMap.insert(key, 100);
- key.first = "J"; //24192
- kHzFreqMap.insert(key, 100);
- key.first = "X"; //24048
- kHzFreqMap.insert(key, 100);
-
- key.second = '2'; // FM
- key.first = "A"; // 6M
- kHzFreqMap.insert(key, 525); //region 2
- key.second = '6'; // FM
- key.first = "B"; //2M
- kHzFreqMap.insert(key, 520); //region 2
- key.second = '3'; // FM
- key.first = "C"; //222
- kHzFreqMap.insert(key, 500); //region 2
- key.second = '6'; // FM
- key.first = "D"; //432
- kHzFreqMap.insert(key, 000); //region 2
- key.second = '7'; // FM
- key.first = "E"; //1296
- kHzFreqMap.insert(key, 500); //region 1
- key.second = '4'; // FM
- key.first = "E"; //1296
- kHzFreqMap.insert(key, 500); //region 2
- key.second = '1'; // FM
- key.first = "A"; // 6M
- kHzFreqMap.insert(key, 800); //region 1
- key.second = '5'; // FM
- key.first = "B"; //2M
- kHzFreqMap.insert(key, 500); //region 1
- key.second = '3'; // FM
- key.first = "D"; //432
- kHzFreqMap.insert(key, 650); //region 1
-
- key.second = 'L'; // FT8
- key.first = "A"; // 6M
- kHzFreqMap.insert(key, 313);
- key.first = "B"; //2M
- kHzFreqMap.insert(key, 174);
- key.first = "C"; //222
- kHzFreqMap.insert(key, 174);
- key.first = "D"; //432
- kHzFreqMap.insert(key, 174);
- key.first = "9"; //902
- kHzFreqMap.insert(key, 174);
- key.first = "K"; //903
- kHzFreqMap.insert(key, 174);
- key.first = "E"; //1296
- kHzFreqMap.insert(key, 174);
- key.first = "F"; //2304
- kHzFreqMap.insert(key, 174);
- key.first = "G"; //3400
- kHzFreqMap.insert(key, 174);
- key.first = "H"; //5760
- kHzFreqMap.insert(key, 174);
- key.first = "I"; //10368
- kHzFreqMap.insert(key, 174);
- key.first = "J"; //24192
- kHzFreqMap.insert(key, 174);
- key.first = "X"; //24048
- kHzFreqMap.insert(key, 174);
- key.first = "4"; //8M
- kHzFreqMap.insert(key, 680);
- key.first = "7"; //4M
- kHzFreqMap.insert(key, 154);
-
- key.second = 'K'; // MSK144
- key.first = "A"; // 6M
- kHzFreqMap.insert(key, 280);
- key.first = "B"; //2M
- kHzFreqMap.insert(key, 150);
- key.first = "C"; //222
- kHzFreqMap.insert(key, 150);
- key.first = "D"; //432
- kHzFreqMap.insert(key, 150);
-
- QList<QChar> Q65modes = {'D','E','F','G','H'};
- QList<QChar>::iterator it = Q65modes.begin();
- while (it!=Q65modes.end()) {
- key.second = *it; // Q65 submodes D,E,F,G,H
- key.first = "A"; // 6M
- kHzFreqMap.insert(key, 275);
- key.first = "B"; //2M
- kHzFreqMap.insert(key, 170);
- key.first = "C"; //222
- kHzFreqMap.insert(key, 170);
- key.first = "D"; //432
- kHzFreqMap.insert(key, 170);
- key.first = "9"; //902
- kHzFreqMap.insert(key, 170);
- key.first = "K"; //903
- kHzFreqMap.insert(key, 170);
- key.first = "E"; //1296
- kHzFreqMap.insert(key, 170);
- key.first = "F"; //2304
- kHzFreqMap.insert(key, 170);
- key.first = "G"; //3400
- kHzFreqMap.insert(key, 170);
- key.first = "H"; //5760
- kHzFreqMap.insert(key, 170);
- key.first = "I"; //10368
- kHzFreqMap.insert(key, 170);
- key.first = "J"; //24192
- kHzFreqMap.insert(key, 170);
- key.first = "X"; //24048
- kHzFreqMap.insert(key, 170);
- ++it;
- }
- }
-
-#if (QT_VERSION < QT_VERSION_CHECK(5, 15, 0))
- //VHF
- connect(modeButtonGroup, QOverload<int, bool>::of(&QButtonGroup::buttonToggled), [=](int id, bool checked){
- qDebug() << "id" << id << "toggled:" << checked;
- QString theBand = getBand();
- QChar theMode = getMode(theBand, configuration_->region());
- setkHzBox(theBand, theMode, ui->tabWidget->currentIndex());
- WriteMessage(ui->DxBaseLabel->text(), theBand, theMode);
- });
-
- connect(bandButtonGroup, QOverload<int, bool>::of(&QButtonGroup::buttonToggled), [=](int id, bool checked){
- qDebug() << "id" << id << "toggled:" << checked;
- QString theBand = getBand();
- if((theBand=="A" || theBand=="B" || theBand=="C" || theBand=="D" || theBand=="E")) setupfmSpinBox(theBand);
- QChar theMode = getMode(theBand, configuration_->region());
- setkHzBox(theBand, theMode, ui->tabWidget->currentIndex());
- WriteMessage(ui->DxBaseLabel->text(), theBand, theMode);
- });
- //HF
- connect(modeButtonGroup2, QOverload<int, bool>::of(&QButtonGroup::buttonToggled), [=](int id, bool checked){
- qDebug() << "id" << id << "toggled:" << checked;
- QString theBand = getBand();
- QChar theMode = getMode(theBand, configuration_->region());
- setkHzBox(theBand, theMode, ui->tabWidget->currentIndex());
- WriteMessage(ui->DxBaseLabel->text(), theBand, theMode);
- });
-
- connect(bandButtonGroup2, QOverload<int, bool>::of(&QButtonGroup::buttonToggled), [=](int id, bool checked){
- qDebug() << "id" << id << "toggled:" << checked;
- QString theBand = getBand();
- QChar theMode = getMode(theBand, configuration_->region());
- setkHzBox(theBand, theMode, ui->tabWidget->currentIndex());
- WriteMessage(ui->DxBaseLabel->text(), theBand, theMode);
- });
- //EME
- connect(modeButtonGroup3, QOverload<int, bool>::of(&QButtonGroup::buttonToggled), [=](int id, bool checked){
- qDebug() << "id" << id << "toggled:" << checked;
- QString theBand = getBand();
- QChar theMode = getMode(theBand, configuration_->region());
- setkHzBox(theBand, theMode, ui->tabWidget->currentIndex());
- WriteMessage(ui->DxBaseLabel->text(), theBand, theMode);
- });
-
- connect(bandButtonGroup3, QOverload<int, bool>::of(&QButtonGroup::buttonToggled), [=](int id, bool checked){
- qDebug() << "id" << id << "toggled:" << checked;
- QString theBand = getBand();
- QChar theMode = getMode(theBand, configuration_->region());
- setkHzBox(theBand, theMode, ui->tabWidget->currentIndex());
- WriteMessage(ui->DxBaseLabel->text(), theBand, theMode);
- });
-
- //General Messages
- connect(messageButtonGroup, QOverload<int, bool>::of(&QButtonGroup::buttonToggled), [=](int id, bool checked){
- qDebug() << "id" << id << "toggled:" << checked;
- QString message = getGenMessage();
- });
-
-#else //VHF
- QObject::connect(modeButtonGroup, &QButtonGroup::idToggled, [&](int id, bool checked) {
- qDebug() << "Button" << id << "toggled:" << checked;
- QString theBand = getBand();
- QChar theMode = getMode(theBand, configuration_->region());
- setkHzBox(theBand, theMode, ui->tabWidget->currentIndex());
- QSYMessageCreator::WriteMessage(ui->DxBaseLabel->text(), theBand, theMode);
- });
-
- QObject::connect(bandButtonGroup, &QButtonGroup::idToggled, [&](int id, bool checked) {
- qDebug() << "Button" << id << "toggled:" << checked;
- QString theBand = getBand();
- if((theBand=="A" || theBand=="B" || theBand=="C" || theBand=="D" || theBand=="E")) setupfmSpinBox(theBand);
- QChar theMode = getMode(theBand, configuration_->region());
- setkHzBox(theBand, theMode, ui->tabWidget->currentIndex());
- QSYMessageCreator::WriteMessage(ui->DxBaseLabel->text(), theBand, theMode);
- });
- //HF
- QObject::connect(modeButtonGroup2, &QButtonGroup::idToggled, [&](int id, bool checked) {
- qDebug() << "Button" << id << "toggled:" << checked;
- QString theBand = getBand();
- QChar theMode = getMode(theBand, configuration_->region());
- setkHzBox(theBand, theMode, ui->tabWidget->currentIndex());
- QSYMessageCreator::WriteMessage(ui->DxBaseLabel->text(), theBand, theMode);
- });
-
- QObject::connect(bandButtonGroup2, &QButtonGroup::idToggled, [&](int id, bool checked) {
- qDebug() << "Button" << id << "toggled:" << checked;
- QString theBand = getBand();
- QChar theMode = getMode(theBand, configuration_->region());
- setkHzBox(theBand, theMode, ui->tabWidget->currentIndex());
- QSYMessageCreator::WriteMessage(ui->DxBaseLabel->text(), theBand, theMode);
- });
- //EME
- QObject::connect(modeButtonGroup3, &QButtonGroup::idToggled, [&](int id, bool checked) {
- qDebug() << "Button" << id << "toggled:" << checked;
- QString theBand = getBand();
- QChar theMode = getMode(theBand, configuration_->region());
- setkHzBox(theBand, theMode, ui->tabWidget->currentIndex());
- QSYMessageCreator::WriteMessage(ui->DxBaseLabel->text(), theBand, theMode);
- });
-
- QObject::connect(bandButtonGroup3, &QButtonGroup::idToggled, [&](int id, bool checked) {
- qDebug() << "Button" << id << "toggled:" << checked;
- QString theBand = getBand();
- QChar theMode = getMode(theBand, configuration_->region());
- setkHzBox(theBand, theMode, ui->tabWidget->currentIndex());
- QSYMessageCreator::WriteMessage(ui->DxBaseLabel->text(), theBand, theMode);
- });
-
- //General Messages
- QObject::connect(messageButtonGroup, &QButtonGroup::idToggled, [&](int id, bool checked) {
- qDebug() << "Button" << id << "toggled:" << checked;
- QString message = getGenMessage();
- });
-
-#endif
-
- connect(ui->fmSpinBox, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &QSYMessageCreator::onfmSpinBoxValueChanged); //VHF
- connect(ui->kHzBox, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &QSYMessageCreator::onkHzBoxValueChanged); //VHF
- connect(ui->kHzBox2, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &QSYMessageCreator::onkHzBox2ValueChanged); //HF
- connect(ui->kHzBox3, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &QSYMessageCreator::onkHzBox3ValueChanged); //EME
-
- connect(ui->tabWidget, &QTabWidget::currentChanged, this, &QSYMessageCreator::onTabChanged);
-
- setup();
-}
-
-QSYMessageCreator::~QSYMessageCreator()
-{
- delete ui;
-}
-
-void QSYMessageCreator::onfmSpinBoxValueChanged()
-{
- QString theBand = getBand();
- QChar theMode = getMode(theBand, configuration_->region());
- QString message = WriteMessage(ui->DxBaseLabel->text(), theBand, theMode);
- setkHzVHF(ui->kHzBox->value());
- WriteMessage(ui->DxBaseLabel->text(), theBand, theMode);
-}
-
-void QSYMessageCreator::setupfmSpinBox(QString band) {
- if ((band =="A" || band == "B" || band == "C" || band == "D" || band == "E") && (configuration_->region () > 0)) {
- ui->label_2_FM->setHidden(false);
- ui->fmSpinBox->setHidden(false);
- ui->label_2_FM->setText("Region " + QString::number(configuration_->region()) + " MHz");
- if (configuration_->region ()==2) {
- if(band=="A") {
- ui->fmSpinBox->setRange(50,53);
- } else if(band=="B") {
- ui->fmSpinBox->setRange(144,147);
- } else if(band=="C") {
- ui->fmSpinBox->setRange(222,223);
- } else if(band=="D") {
- ui->fmSpinBox->setRange(440,449);
- } else if(band=="E") {
- ui->fmSpinBox->setRange(1290,1299);
- }
- } else { //not region 2
- if(band=="A") {
- ui->fmSpinBox->setRange(50,53);
- } else if(band=="B") {
- ui->fmSpinBox->setRange(144,145);
- } else if(band=="C") {
- ui->label_2_FM->setHidden(true);
- } else if(band=="D") {
- ui->fmSpinBox->setRange(430,439);
- } else if(band=="E") {
- ui->fmSpinBox->setRange(1290,1299);
- }
- }
- auto it = MHzFreqMap.find(band);
- int defaultValue = -1;
- int value = (it != MHzFreqMap.constEnd()) ? it.value() : defaultValue;
- if(value >=0) {
- ui->fmSpinBox->setValue(value);
- }
- else {
- ui->fmSpinBox->setValue(ui->fmSpinBox->minimum());
- }
- }
-}
-
-void QSYMessageCreator::setkHzBox(QString theBand, QChar theMode, int tabNum)
-{
- QPair<QString,QChar> key(theBand,theMode);
- auto it = kHzFreqMap.find(key);
- int defaultValue = -1;
- int value = (it != kHzFreqMap.constEnd()) ? it.value() : defaultValue;
-
- if (value >= 0) {
- if(tabNum ==1) {
- ui->kHzBox->setValue(value);
- setkHzVHF(value);
- } else if (tabNum ==0) {
- ui->kHzBox2->setValue(value);
- setkHzHF(value);
- } else if (tabNum ==2) {
- ui->kHzBox3->setValue(value);
- setkHzEME(value);
- }
- kHzFreqMap.insert(key, value);
- } else {
- QMap<QPair<QString, QChar>, int>::const_iterator it = kHzFreqMap.begin();
- bool running = true;
- while (running && (it !=kHzFreqMap.end())) {
- QPair<QString,QChar> key = it.key();
- if (key.first.contains(theBand)) {
- int value = it.value();
- if (tabNum ==1) {
- ui->kHzBox->setValue(value);
- setkHzVHF(value);
- } else if (tabNum ==0) {
- ui->kHzBox2->setValue(value);
- setkHzHF(value);
- } else if (tabNum ==2) {
- ui->kHzBox3->setValue(value);
- setkHzEME(value);
- };
- running = false;
- }
- ++it;
- }
- }
-
- if (value<0 && tabNum == 0) {
- if (theBand.compare("L")==0) {
- if ((ui->kHzBox2->value() < 472) || ui->kHzBox2->value() > 479) ui->kHzBox2->setValue(472);
- }
- else if (theBand.compare("M")==0) {
- if (ui->kHzBox2->value() < 800 ) ui->kHzBox2->setValue(800);
- }
- else if (theBand.compare("N")==0) {
- if (ui->kHzBox2->value() < 500 ) ui->kHzBox2->setValue(500);
- }
- else if (theBand.compare("O")==0) {
- if (ui->kHzBox2->value() < 330 || ui->kHzBox2->value() > 405) ui->kHzBox2->setValue(357);
- }
- else if (theBand.compare("P")==0) {
- if (ui->kHzBox2->value() > 300) ui->kHzBox2->setValue(0);
- }
- else if (theBand.compare("Q")==0) {
- if (ui->kHzBox2->value() < 100 || ui->kHzBox2->value() > 150) ui->kHzBox2->setValue(100);
- }
- else if (theBand.compare("R")==0) {
- if (ui->kHzBox2->value() > 350) ui->kHzBox2->setValue(0);
- }
- else if (theBand.compare("S")==0) {
- if (ui->kHzBox2->value() < 68 || ui->kHzBox2->value() > 110) ui->kHzBox2->setValue(68);
- }
- else if (theBand.compare("T")==0) {
- if (ui->kHzBox2->value() > 450) ui->kHzBox2->setValue(0);
- }
- else if (theBand.compare("U")==0) {
- if (ui->kHzBox2->value() < 890 || ui->kHzBox2->value() > 930) ui->kHzBox2->setValue(890);
- }
- else if (theBand.compare("W")==0) {
- if (ui->kHzBox2->value() > 700) ui->kHzBox2->setValue(0);
- }
- else if (theBand.compare("4")==0) {
- if (ui->kHzBox2->value() > 680) ui->kHzBox2->setValue(0);
- }
- else if (theBand.compare("7")==0) {
- if (ui->kHzBox2->value() > 200) ui->kHzBox2->setValue(0);
- }
- }
- setkHzHF(ui->kHzBox2->value());
-}
-
-void QSYMessageCreator::onkHzBoxValueChanged()
-{
- QString theBand = getBand();
- QChar theMode = getMode(theBand, configuration_->region());
- QString message = WriteMessage(ui->DxBaseLabel->text(), theBand, theMode);
- setkHzVHF(ui->kHzBox->value());
- WriteMessage(ui->DxBaseLabel->text(), theBand, theMode);
-}
-
-void QSYMessageCreator::onkHzBox2ValueChanged()
-{
- QString theBand = getBand();
- QChar theMode = getMode(theBand, configuration_->region());
- QString message = WriteMessage(ui->DxBaseLabel->text(), theBand, theMode);
- setkHzHF(ui->kHzBox2->value());
- WriteMessage(ui->DxBaseLabel->text(), theBand, theMode);
-}
-
-void QSYMessageCreator::onkHzBox3ValueChanged()
-{
- QString theBand = getBand();
- QChar theMode = getMode(theBand, configuration_->region());
- QString message = WriteMessage(ui->DxBaseLabel->text(), theBand, theMode);
- setkHzEME(ui->kHzBox3->value());
- WriteMessage(ui->DxBaseLabel->text(), theBand, theMode);
-}
-
-void QSYMessageCreator::setup()
-{
- if (configuration_->region() == 0) {
- QMessageBox *regionWarning = new QMessageBox(this);
- regionWarning->setModal(false);
- regionWarning->setIcon(QMessageBox::Warning);
- regionWarning->setText("You need to enter your IARU Region\nin Settings or FM frequencies\nwill not be shown!");
- regionWarning->setWindowFlags(regionWarning->windowFlags() | Qt::WindowStaysOnTopHint);
- regionWarning->show();
- } else if (configuration_->region() == 2) {
- ui->radioBut24192->setText("24192 MHz");
- } else {
- ui->radioBut24192->setText("24048 MHz");
- }
-}
-
-void QSYMessageCreator::onTabChanged()
-{
- if (configuration_->region() == 2) {
- ui->radioBut24192->setText("24192 MHz");
- } else {
- ui->radioBut24192->setText("24048 MHz");
- }
- getGenMessage();
- QString theBand = getBand();
- QChar theMode = getMode(theBand, configuration_->region());
- setkHzBox(theBand, theMode, ui->tabWidget->currentIndex());
- WriteMessage(ui->DxBaseLabel->text(), theBand, theMode);
-}
-
-void QSYMessageCreator::on_button1_clicked()
-{
- QString theBand = getBand();
- QChar theMode = getMode(theBand, configuration_->region());
- QString message = WriteMessage(ui->DxBaseLabel->text(), theBand, theMode);
- QPair<QString,QChar>key(theBand,theMode);
- kHzFreqMap.insert(key, ui->kHzBox->value());
- if(!theMode.isLetter() && (theBand=="A" || theBand=="B" || theBand=="C" || theBand=="D" || theBand=="E")) MHzFreqMap.insert(theBand, ui->fmSpinBox->value());
- Q_EMIT sendMessage(message);
-}
-
-void QSYMessageCreator::on_saveMHzButton_clicked()
-{
- QString theBand = getBand();
- QChar theMode = getMode(theBand, configuration_->region());
- QPair<QString,QChar>key(theBand,theMode);
- kHzFreqMap.insert(key, ui->kHzBox->value());
- MHzFreqMap.insert(theBand, ui->fmSpinBox->value());
-}
-
-void QSYMessageCreator::on_saveMHzButton_2_clicked()
-{
- QString theBand = getBand();
- QChar theMode = getMode(theBand, configuration_->region());
- QPair<QString,QChar>key(theBand,theMode);
- kHzFreqMap.insert(key, ui->kHzBox2->value());
-}
-
-void QSYMessageCreator::on_saveMHzButton_3_clicked()
-{
- QString theBand = getBand();
- QChar theMode = getMode(theBand, configuration_->region());
- QPair<QString,QChar>key(theBand,theMode);
- kHzFreqMap.insert(key, ui->kHzBox3->value());
-}
-
-void QSYMessageCreator::on_button2_clicked()
-{
- QString theBand = getBand();
- QChar theMode = getMode(theBand, configuration_->region());
- QString message = WriteMessage(ui->DxBaseLabel->text(), theBand, theMode);
- QPair<QString,QChar>key(theBand,theMode);
- kHzFreqMap.insert(key, ui->kHzBox2->value());
- Q_EMIT sendMessage(message);
-}
-
-void QSYMessageCreator::on_button3_clicked()
-{
- QString theBand = getBand();
- QChar theMode = getMode(theBand, configuration_->region());
- QString message = WriteMessage(ui->DxBaseLabel->text(), theBand, theMode);
- QPair<QString,QChar>key(theBand,theMode);
- kHzFreqMap.insert(key, ui->kHzBox3->value());
- Q_EMIT sendMessage(message);
-}
-
-void QSYMessageCreator::on_genButton_clicked()
-{
- QString message = getGenMessage();
- Q_EMIT sendMessage(message);
-}
-
-QString QSYMessageCreator::getGenMessage() {
- QString message;
- if (ui->message1->isChecked()) message = "001";
- else if (ui->message2->isChecked()) message = "002";
- else if (ui->message3->isChecked()) message = "003";
- else if (ui->message4->isChecked()) message = "004";
- else if (ui->message5->isChecked()) message = "005";
- else if (ui->message6->isChecked()) message = "006";
- else if (ui->message7->isChecked()) message = "007";
- else if (ui->message8->isChecked()) message = "008";
- else if (ui->message9->isChecked()) message = "009";
- else if (ui->message10->isChecked()) message = "010";
- else if (ui->message11->isChecked()) message = "011";
- else if (ui->message12->isChecked()) message = "012";
- else if (ui->message13->isChecked()) message = "013";
- else if (ui->message14->isChecked()) message = "014";
- message = ui->DxBaseLabel->text() + ".ZA" + message;
- ui->messageLabel4->setText(message);
- return message;
-}
-
-void QSYMessageCreator::setQSYMessageCreatorStatusFalse()
-{
- Q_EMIT sendQSYMessageCreatorStatus(false);
-}
-
-void QSYMessageCreator::getDxBase(QString value) {
- ui->DxBaseLabel->setText(value);
- QString theBand = getBand();
- QChar theMode = getMode(theBand, configuration_->region());
- setkHzBox(theBand, theMode, ui->tabWidget->currentIndex());
- WriteMessage(ui->DxBaseLabel->text(), theBand, theMode);
- getGenMessage();
-}
-
-void QSYMessageCreator::closeEvent (QCloseEvent * e)
-{
- if ((configuration_->region()) ==2 ) {
- ui->radioBut24192->setText("24192 MHz");
- } else {
- ui->radioBut24192->setText("24048 MHz");
- }
- write_settings();
- setQSYMessageCreatorStatusFalse();
- e->accept(); // was ignore
-}
-
-void QSYMessageCreator::read_settings ()
-{
- SettingsGroup g (settings_, "QSYMessageCreator");
- move (settings_->value ("window/pos", pos ()).toPoint ());
-
- QByteArray readKHzData = settings_->value("kHzFreqMap").toByteArray();
- QDataStream readKHzStream(&readKHzData, QIODevice::ReadOnly);
- readKHzStream >> kHzFreqMap;
- QByteArray readMHzData = settings_->value("MHzFreqMap").toByteArray();
- QDataStream readMHzStream(&readMHzData, QIODevice::ReadOnly);
- readMHzStream >> MHzFreqMap;
-
- ui->kHzBox3->setValue(settings_->value("kHzEME").toInt());
- setbandEME(settings_->value("bandEME").toString());
- setmodeEME(settings_->value("modeEME").toChar());
- ui->kHzBox->setValue(settings_->value("kHzVHF").toInt());
- setbandVHF(settings_->value("bandVHF").toString());
- setmodeVHF(settings_->value("modeVHF").toChar());
- initVHFMode = settings_->value("modeVHF").toChar();
- ui->kHzBox2->setValue(settings_->value("kHzHF").toInt());
- setbandHF(settings_->value("bandHF").toString());
- setmodeHF(settings_->value("modeHF").toChar());
- ui->tabWidget->setCurrentIndex(settings_->value("whichTab").toInt());
- setkHzVHF(ui->kHzBox->value());
- setkHzEME(ui->kHzBox3->value());
- setkHzHF(ui->kHzBox2->value());
- bool testVHF = true;
- bool testHF = true;
- bool testEME = true;
- if ((settings_->value("bandVHF").toString()).compare("")==0) {
- setbandVHF("A");
- testVHF=false;
- }
- if ((settings_->value("modeVHF").toString()).compare("")==0) {
- setmodeVHF('V');
- testVHF=false;
- }
- if ((settings_->value("bandHF").toString()).compare("")==0) {
- setbandHF("M");
- testHF = false;
- }
- if ((settings_->value("modeHF").toString()).compare("")==0) {
- setmodeHF('V');
- testHF = false;
- }
- if ((settings_->value("bandEME").toString()).compare("")==0) {
- setbandEME("A");
- testEME = false;
- }
- if ((settings_->value("modeEME").toString()).compare("")==0) {
- setmodeEME('V');
- testEME = false;
- }
- if ((settings_->value("kHzVHF").toString()).compare("")==0) {
- setkHzVHF(0);
- testVHF = false;
- }
- if ((settings_->value("kHzHF").toString()).compare("")==0) {
- setkHzHF(0);
- testHF = false;
- }
- if ((settings_->value("kHzEME").toString()).compare("")==0) {
- setkHzEME(0);
- testEME = false;
- }
-
- if (testVHF) {
- QPair<QString,QChar> key(getbandVHF(),getmodeVHF());
- kHzFreqMap.insert(key,getkHzVHF());
- }
-
- if (testEME) {
- QPair<QString,QChar> key(getbandEME(),getmodeEME());
- kHzFreqMap.insert(key,getkHzEME());
- }
-
- if (testHF) {
- QPair<QString,QChar> key(getbandHF(),getmodeHF());
- kHzFreqMap.insert(key,getkHzHF());
- }
-
- ui->tabWidget->setCurrentIndex(1);
- setBand(getbandVHF());
- setMode(getbandVHF(), getmodeVHF(), configuration_->region());
- if (!testVHF) {
- setkHzBox(getbandVHF(),getmodeVHF(),1);
- }
- setkHzVHF(ui->kHzBox->value());;
- WriteMessage(ui->DxBaseLabel->text(), getbandVHF(), getmodeVHF());
-
- ui->tabWidget->setCurrentIndex(2);
- setBand(getbandEME());
- setMode(getbandEME(), getmodeEME(), configuration_->region());
- if (!testEME) {
- setkHzBox(getbandEME(),getmodeEME(),2);
- }
- setkHzEME(ui->kHzBox3->value());;
- WriteMessage(ui->DxBaseLabel->text(), getbandEME(), getmodeEME());
-
- ui->tabWidget->setCurrentIndex(0);
- setBand(getbandHF());
- setMode(getbandHF(), getmodeHF(), configuration_->region());
- if (!testHF) {
- setkHzBox(getbandHF(),getmodeHF(),0);
- }
- setkHzHF(ui->kHzBox2->value());
- WriteMessage(ui->DxBaseLabel->text(), getbandHF(), getmodeHF());
-
- ui->tabWidget->setCurrentIndex(settings_->value("whichTab").toInt());
-
-}
-
-QString QSYMessageCreator::WriteMessage (QString hisCall, QString band, QChar mode)
-{
- QString message = "";
- if(ui->tabWidget->currentIndex() == 1) {
- qint16 kHzFreq = ui->kHzBox->value();
- QString kHzStr = QStringLiteral("%1").arg(kHzFreq,3,10,QLatin1Char('0'));
- message = hisCall + "." + band + mode + kHzStr;
- ui->messageLabel->setText(message);
- }
- else if(ui->tabWidget->currentIndex() == 0) {
- qint16 kHzFreq = ui->kHzBox2->value();
- QString kHzStr = QStringLiteral("%1").arg(kHzFreq,3,10,QLatin1Char('0'));
- message = hisCall + "." + band + mode + kHzStr;
- ui->messageLabel2->setText(message);
- }
- else if(ui->tabWidget->currentIndex() == 2) {
- qint16 kHzFreq = ui->kHzBox3->value();
- QString kHzStr = QStringLiteral("%1").arg(kHzFreq,3,10,QLatin1Char('0'));
- message = hisCall + "." + band + mode + kHzStr;
- ui->messageLabel3->setText(message);
- }
- return message;
-}
-
-QString QSYMessageCreator::getBand()
-{
- QString band;
- if(ui->tabWidget->currentIndex() == 1) {
- if (ui->radioBut50->isChecked()) band = "A";
- else if (ui->radioBut144->isChecked()) band = "B";
- else if (ui->radioBut222->isChecked()) band = "C";
- else if (ui->radioBut432->isChecked()) band = "D";
- else if (ui->radioBut902->isChecked()) band = "9";
- else if (ui->radioBut903->isChecked()) band = "K";
- else if (ui->radioBut1296->isChecked()) band = "E";
- else if (ui->radioBut2304->isChecked()) band = "F";
- else if (ui->radioBut3400->isChecked()) band = "G";
- else if (ui->radioBut5760->isChecked()) band = "H";
- else if (ui->radioBut10368->isChecked()) band = "I";
- else if (ui->radioBut24192->isChecked()) band = "J";
- else if (ui->radioBut40->isChecked()) band = "4";
- else if (ui->radioBut70->isChecked()) band = "7";
- setbandVHF(band);
- } else if(ui->tabWidget->currentIndex() == 0) {
- if (ui->radioBut630M->isChecked()) band = "L";
- else if (ui->radioBut160M->isChecked()) band = "M";
- else if (ui->radioBut80M->isChecked()) band = "N";
- else if (ui->radioBut60M->isChecked()) band = "O";
- else if (ui->radioBut40M->isChecked()) band = "P";
- else if (ui->radioBut30M->isChecked()) band = "Q";
- else if (ui->radioBut20M->isChecked()) band = "R";
- else if (ui->radioBut17M->isChecked()) band = "S";
- else if (ui->radioBut15M->isChecked()) band = "T";
- else if (ui->radioBut12M->isChecked()) band = "U";
- else if (ui->radioBut10M1->isChecked()) band = "V";
- else if (ui->radioBut10M2->isChecked()) band = "W";
- setbandHF(band);
- } else if(ui->tabWidget->currentIndex() == 2) {
- if (ui->radioBut50A->isChecked()) band = "A";
- else if (ui->radioBut144A->isChecked()) band = "B";
- else if (ui->radioBut222A->isChecked()) band = "C";
- else if (ui->radioBut432A->isChecked()) band = "D";
- else if (ui->radioBut902A->isChecked()) band = "9";
- else if (ui->radioBut903A->isChecked()) band = "K";
- else if (ui->radioBut1296A->isChecked()) band = "E";
- else if (ui->radioBut2304A->isChecked()) band = "F";
- else if (ui->radioBut3400A->isChecked()) band = "G";
- else if (ui->radioBut5760A->isChecked()) band = "H";
- else if (ui->radioBut10368A->isChecked()) band = "I";
- else if (ui->radioBut24048->isChecked()) band = "X";
- setbandEME(band);
- }
- return band;
-}
-
-void QSYMessageCreator::setBand(QString band)
-{
- if(ui->tabWidget->currentIndex() == 1) {
- if (band == "A") ui->radioBut50->setChecked(true);
- else if (band == "B") ui->radioBut144->setChecked(true);
- else if (band == "C") ui->radioBut222->setChecked(true);
- else if (band == "D") ui->radioBut432->setChecked(true);
- else if (band == "9") ui->radioBut902->setChecked(true);
- else if (band == "K") ui->radioBut903->setChecked(true);
- else if (band == "E") ui->radioBut1296->setChecked(true);
- else if (band == "F") ui->radioBut2304->setChecked(true);
- else if (band == "G") ui->radioBut3400->setChecked(true);
- else if (band == "H") ui->radioBut5760->setChecked(true);
- else if (band == "I") ui->radioBut10368->setChecked(true);
- else if (band == "J") ui->radioBut24192->setChecked(true);
- else if (band == "4") ui->radioBut40->setChecked(true);
- else if (band == "7") ui->radioBut70->setChecked(true);
- } else if(ui->tabWidget->currentIndex() == 0) {
- if (band == "L") ui->radioBut630M->setChecked(true);
- else if (band == "M") ui->radioBut160M->setChecked(true);
- else if (band == "N") ui->radioBut80M->setChecked(true);
- else if (band == "O") ui->radioBut60M->setChecked(true);
- else if (band == "P") ui->radioBut40M->setChecked(true);
- else if (band == "Q") ui->radioBut30M->setChecked(true);
- else if (band == "R") ui->radioBut20M->setChecked(true);
- else if (band == "S") ui->radioBut17M->setChecked(true);
- else if (band == "T") ui->radioBut15M->setChecked(true);
- else if (band == "U") ui->radioBut12M->setChecked(true);
- else if (band == "V") ui->radioBut10M1->setChecked(true);
- else if (band == "W") ui->radioBut10M2->setChecked(true);
- } else if(ui->tabWidget->currentIndex() == 2) {
- if (band == "A") ui->radioBut50A->setChecked(true);
- else if (band == "B") ui->radioBut144A->setChecked(true);
- else if (band == "C") ui->radioBut222A->setChecked(true);
- else if (band == "D") ui->radioBut432A->setChecked(true);
- else if (band == "9") ui->radioBut902A->setChecked(true);
- else if (band == "K") ui->radioBut903A->setChecked(true);
- else if (band == "E") ui->radioBut1296A->setChecked(true);
- else if (band == "F") ui->radioBut2304A->setChecked(true);
- else if (band == "G") ui->radioBut3400A->setChecked(true);
- else if (band == "H") ui->radioBut5760A->setChecked(true);
- else if (band == "I") ui->radioBut10368A->setChecked(true);
- else if (band == "X") ui->radioBut24048->setChecked(true);
- }
-}
-
-void QSYMessageCreator::setMode(QString band, QChar mode, int region)
-{
- if(ui->tabWidget->currentIndex() == 1) { //VHF tab
- if (mode=='V') { //SSB
- ui->radioButSSB->setChecked(true);
- ui->label_2_FM->setHidden(true);
- ui->fmSpinBox->setHidden(true);
- }
- else if (mode=='W') { //CW
- ui->radioButCW->setChecked(true);
- ui->label_2_FM->setHidden(true);
- ui->fmSpinBox->setHidden(true);
- }
- else if (mode=='K') { //MSK144
- ui->radioButMSK->setChecked(true);
- ui->label_2_FM->setHidden(true);
- ui->fmSpinBox->setHidden(true);
- }
- else if (mode=='L') { //FT8
- ui->radioButFT8->setChecked(true);
- ui->label_2_FM->setHidden(true);
- ui->fmSpinBox->setHidden(true);
- }
- else if (!mode.isLetter()) {
- ui->radioButFM->setChecked(true);
- if ((band =="A" || band == "B" || band == "C" || band == "D" || band == "E") && (configuration_->region () > 0)) {
- ui->label_2_FM->setHidden(false);
- ui->fmSpinBox->setHidden(false);
- ui->label_2_FM->setText("Region " + QString::number(configuration_->region()) + " MHz");
- if (region==2) {
- if(band=="A") {
- ui->fmSpinBox->setRange(50,53);
- if(mode=='0') ui->fmSpinBox->setValue(50);
- if(mode=='1') ui->fmSpinBox->setValue(51);
- if(mode=='2') ui->fmSpinBox->setValue(52);
- if(mode=='3') ui->fmSpinBox->setValue(53);
- } else if(band=="B") {
- ui->fmSpinBox->setRange(144,147);
- if(mode=='4') ui->fmSpinBox->setValue(144);
- if(mode=='5') ui->fmSpinBox->setValue(145);
- if(mode=='6') ui->fmSpinBox->setValue(146);
- if(mode=='7') ui->fmSpinBox->setValue(147);
- } else if(band=="C") {
- ui->fmSpinBox->setRange(222,223);
- if(mode=='2') ui->fmSpinBox->setValue(222);
- if(mode=='3') ui->fmSpinBox->setValue(223);
- } else if(band=="D") {
- ui->fmSpinBox->setRange(440,449);
- if(mode=='0') ui->fmSpinBox->setValue(440);
- if(mode=='1') ui->fmSpinBox->setValue(441);
- if(mode=='2') ui->fmSpinBox->setValue(442);
- if(mode=='3') ui->fmSpinBox->setValue(443);
- if(mode=='4') ui->fmSpinBox->setValue(444);
- if(mode=='5') ui->fmSpinBox->setValue(445);
- if(mode=='6') ui->fmSpinBox->setValue(446);
- if(mode=='7') ui->fmSpinBox->setValue(447);
- if(mode=='8') ui->fmSpinBox->setValue(448);
- if(mode=='9') ui->fmSpinBox->setValue(449);
- } else if(band=="E") {
- ui->fmSpinBox->setRange(1290,1299);
- if(mode=='0') ui->fmSpinBox->setValue(1290);
- if(mode=='1') ui->fmSpinBox->setValue(1291);
- if(mode=='2') ui->fmSpinBox->setValue(1292);
- if(mode=='3') ui->fmSpinBox->setValue(1293);
- if(mode=='4') ui->fmSpinBox->setValue(1294);
- if(mode=='5') ui->fmSpinBox->setValue(1295);
- if(mode=='6') ui->fmSpinBox->setValue(1296);
- if(mode=='7') ui->fmSpinBox->setValue(1297);
- if(mode=='8') ui->fmSpinBox->setValue(1298);
- if(mode=='9') ui->fmSpinBox->setValue(1299);
- }
- } else { //not region 2
- if(band=="A") {
- ui->fmSpinBox->setRange(50,53);
- if(mode=='0') ui->fmSpinBox->setValue(50);
- if(mode=='1') ui->fmSpinBox->setValue(51);
- if(mode=='2') ui->fmSpinBox->setValue(52);
- if(mode=='3') ui->fmSpinBox->setValue(53);
- } else if(band=="B") {
- ui->fmSpinBox->setRange(144,145);
- if(mode=='4') ui->fmSpinBox->setValue(144);
- if(mode=='5') ui->fmSpinBox->setValue(145);
- } else if(band=="C") {
- ui->label_2_FM->setHidden(true);
- } else if(band=="D") {
- ui->fmSpinBox->setRange(430,439);
- if(mode=='0') ui->fmSpinBox->setValue(430);
- if(mode=='1') ui->fmSpinBox->setValue(431);
- if(mode=='2') ui->fmSpinBox->setValue(432);
- if(mode=='3') ui->fmSpinBox->setValue(433);
- if(mode=='4') ui->fmSpinBox->setValue(434);
- if(mode=='5') ui->fmSpinBox->setValue(435);
- if(mode=='6') ui->fmSpinBox->setValue(436);
- if(mode=='7') ui->fmSpinBox->setValue(437);
- if(mode=='8') ui->fmSpinBox->setValue(438);
- if(mode=='9') ui->fmSpinBox->setValue(439);
- } else if(band=="E") {
- ui->fmSpinBox->setRange(1290,1299);
- if(mode=='0') ui->fmSpinBox->setValue(1290);
- if(mode=='1') ui->fmSpinBox->setValue(1291);
- if(mode=='2') ui->fmSpinBox->setValue(1292);
- if(mode=='3') ui->fmSpinBox->setValue(1293);
- if(mode=='4') ui->fmSpinBox->setValue(1294);
- if(mode=='5') ui->fmSpinBox->setValue(1295);
- if(mode=='6') ui->fmSpinBox->setValue(1296);
- if(mode=='7') ui->fmSpinBox->setValue(1297);
- if(mode=='8') ui->fmSpinBox->setValue(1298);
- if(mode=='9') ui->fmSpinBox->setValue(1299);
- }
- }
- } else { // is not lower 4 bands FM Mode
- ui->label_2_FM->setHidden(true);
- ui->fmSpinBox->setHidden(true);
- }
- QSYMessageCreator::MHzFreqMap.insert(band,ui->fmSpinBox->value());
- } //end mode !isLetter ( is FM )
- } //end vhf tab
- else if(ui->tabWidget->currentIndex() == 0) { //HF tab
- if (mode=='V') {
- ui->radioButSSB2->setChecked(true);
- }
- else if (mode=='W') {
- ui->radioButCW2->setChecked(true);
- }
- else if (!mode.isLetter()) {
- ui->radioButFM2->setChecked(true);
- }
- else if (mode=='L') {
- ui->radioButFT82->setChecked(true);
- }
- else if (mode=='J') {
- ui->radioButFT4->setChecked(true);
- }
- else if (mode=='K') {
- ui->radioButMSK->setChecked(true);
- }
- else if (mode=='A') {
- ui->radioButJT9->setChecked(true);
- }
- else if (mode=='B') {
- ui->radioButJT65->setChecked(true);
- }
- else if (mode=='C') {
- ui->radioButFST4->setChecked(true);
- }
- } else if(ui->tabWidget->currentIndex() == 2) { //EME tab
- if (mode=='D') {
- ui->radioButQ6530B->setChecked(true);
- }
- else if (mode=='W') {
- ui->radioButCW3->setChecked(true);
- }
- else if (mode=='E') {
- ui->radioButQ6560C->setChecked(true);
- }
- else if (mode=='F') {
- ui->radioButQ6560D->setChecked(true);
- }
- else if (mode=='G') {
- ui->radioButQ6560E->setChecked(true);
- }
- else if (mode=='H') {
- ui->radioButQ65120D->setChecked(true);
- }
- }
-}
-
-QChar QSYMessageCreator::modeFromSpinBox(QString band, int MHzVHFInt)
-{
- QChar mode = '0';
- if(band=="A") {
- if(MHzVHFInt == 50) mode = '0';
- else if(MHzVHFInt == 51) mode = '1';
- else if(MHzVHFInt == 52) mode = '2';
- else if(MHzVHFInt == 53) mode = '3';
- } else if(band=="B") {
- if(MHzVHFInt == 144) mode = '4';
- else if(MHzVHFInt == 145) mode = '5';
- else if(MHzVHFInt == 146) mode = '6';
- else if(MHzVHFInt == 147) mode = '7';
- } else if(band=="C") {
- if(configuration_->region() ==2) {
- if(MHzVHFInt == 222) mode = '2';
- else if(MHzVHFInt == 223) mode = '3';
- }
- else { //not region 2
- mode = '0';
- }
- } else if(band=="D") {
- if(configuration_->region() ==2) {
- if(MHzVHFInt == 440) mode = '0';
- else if(MHzVHFInt == 441) mode = '1';
- else if(MHzVHFInt == 442) mode = '2';
- else if(MHzVHFInt == 443) mode = '3';
- else if(MHzVHFInt == 444) mode = '4';
- else if(MHzVHFInt == 445) mode = '5';
- else if(MHzVHFInt == 446) mode = '6';
- else if(MHzVHFInt == 447) mode = '7';
- else if(MHzVHFInt == 448) mode = '8';
- else if(MHzVHFInt == 449) mode = '9';
- } else { //not region 2
- if(MHzVHFInt == 430) mode = '0';
- else if(MHzVHFInt == 431) mode = '1';
- else if(MHzVHFInt == 432) mode = '2';
- else if(MHzVHFInt == 433) mode = '3';
- else if(MHzVHFInt == 434) mode = '4';
- else if(MHzVHFInt == 435) mode = '5';
- else if(MHzVHFInt == 436) mode = '6';
- else if(MHzVHFInt == 437) mode = '7';
- else if(MHzVHFInt == 438) mode = '8';
- else if(MHzVHFInt == 439) mode = '9';
- }
- } else if(band=="E") {
- if(MHzVHFInt == 1290) mode = '0';
- else if(MHzVHFInt == 1291) mode = '1';
- else if(MHzVHFInt == 1292) mode = '2';
- else if(MHzVHFInt == 1293) mode = '3';
- else if(MHzVHFInt == 1294) mode = '4';
- else if(MHzVHFInt == 1295) mode = '5';
- else if(MHzVHFInt == 1296) mode = '6';
- else if(MHzVHFInt == 1297) mode = '7';
- else if(MHzVHFInt == 1298) mode = '8';
- else if(MHzVHFInt == 1299) mode = '9';
- }
- return mode;
-}
-
-QChar QSYMessageCreator::getMode(QString band,int region)
-{
- QChar mode;
- qDebug() << "band" << band;
- qDebug() << "band" << region;
-
- if(ui->tabWidget->currentIndex() == 1) {
- ui->label_2_FM->setHidden(true);
- ui->fmSpinBox->setHidden(true);
- if (ui->radioButFM->isChecked()) {
- if ((band =="A" || band == "B" || band == "C" || band == "D" || band == "E") && (configuration_->region () > 0)) {
- if(configuration_->region () !=2 &&(band=="C")) {
- ui->label_2_FM->setHidden(true);
- ui->fmSpinBox->setHidden(true);
- mode = '0';
- } else {
- ui->label_2_FM->setText("Region " + QString::number(configuration_->region()) + " MHz");
- ui->label_2_FM->setHidden(false);
- ui->fmSpinBox->setHidden(false);
- if((ui->fmSpinBox->text().toInt() < getBandEdge(band)) || ((band=="A" ) && (initVHFMode.isLetter()))) {
- initVHFMode='0';
- setupfmSpinBox(band);
- if(firstTime) {
- firstTime = false;
- if(region ==2) {
- if(band=="A") {
- ui->fmSpinBox->setRange(50,53);
- ui->fmSpinBox->setValue(52);
- ui->kHzBox->setValue(525);
- } else if(band=="B") {
- ui->fmSpinBox->setRange(144,147);
- ui->fmSpinBox->setValue(146);
- ui->kHzBox->setValue(520);
- } else if(band=="C") {
- ui->fmSpinBox->setRange(222,223);
- ui->fmSpinBox->setValue(223);
- ui->kHzBox->setValue(500);
- } else if(band=="D") {
- ui->fmSpinBox->setRange(440,449);
- ui->fmSpinBox->setValue(446);
- ui->kHzBox->setValue(000);
- } else if(band=="E") {
- ui->fmSpinBox->setRange(1290,1299);
- ui->fmSpinBox->setValue(1294);
- ui->kHzBox->setValue(000);
- }
- } else {
- if(band=="A") {
- ui->fmSpinBox->setRange(50,53);
- ui->fmSpinBox->setValue(50);
- ui->kHzBox->setValue(800);
- } else if(band=="B") {
- ui->fmSpinBox->setRange(144,145);
- ui->fmSpinBox->setValue(145);
- ui->kHzBox->setValue(500);
- } else if(band=="D") {
- ui->fmSpinBox->setRange(430,439);
- ui->fmSpinBox->setValue(433);
- ui->kHzBox->setValue(650);
- } else if(band=="E") {
- ui->fmSpinBox->setRange(1290,1299);
- ui->fmSpinBox->setValue(1297);
- ui->kHzBox->setValue(500);
- }
- }
- }
- }
- mode = modeFromSpinBox(band, ui->fmSpinBox->value());
- }
- } else {
- ui->label_2_FM->setHidden(true);
- ui->fmSpinBox->setHidden(true);
- mode='0';
- }
- }
- else if (ui->radioButSSB->isChecked()) {
- mode = 'V';
- }
- else if (ui->radioButCW->isChecked()) {
- mode = 'W';
- }
- else if (ui->radioButFT8->isChecked()) {
- mode = 'L';
- }
- else if (ui->radioButMSK->isChecked()) {
- mode = 'K';
- } else mode = 'V';
- setmodeVHF(mode);
- } else if(ui->tabWidget->currentIndex() == 0) {
- if (ui->radioButSSB2->isChecked()) {
- mode = 'V';
- }
- else if (ui->radioButFM2->isChecked()) {
- mode = '0';
- }
- else if (ui->radioButCW2->isChecked()) {
- mode = 'W';
- }
- else if (ui->radioButFT82->isChecked()) {
- mode = 'L';
- }
- else if (ui->radioButFT4->isChecked()) {
- mode = 'J';
- }
- else if (ui->radioButJT9->isChecked()) {
- mode = 'A';
- }
- else if (ui->radioButJT65->isChecked()) {
- mode = 'B';
- }
- else if (ui->radioButFST4->isChecked()) {
- mode = 'C';
- } else mode = 'V';
- setmodeHF(mode);
- } else if(ui->tabWidget->currentIndex() == 2) {
- if (ui->radioButQ6530B->isChecked()) {
- mode = 'D';
- }
- else if (ui->radioButQ6560C->isChecked()) {
- mode = 'E';
- }
- else if (ui->radioButCW3->isChecked()) {
- mode = 'W';
- }
- else if (ui->radioButQ6560D->isChecked()) {
- mode = 'F';
- }
- else if (ui->radioButQ6560E->isChecked()) {
- mode = 'G';
- }
- else if (ui->radioButQ65120D->isChecked()) {
- mode = 'H';
- } else mode = 'V';
- setmodeEME(mode);
- }
- return mode;
-}
-
-int QSYMessageCreator::getBandEdge(QString band) {
- if(band=="A") return 50;
- else if(band=="B") return 144;
- else if(band=="C") return 222;
- else if(band=="D") return 430;
- else if(band=="E") return 1290;
- else return 50;
-}
-
-void QSYMessageCreator::send_message(const QString message) {
- Q_EMIT sendMessage(message);
-}
-
-void QSYMessageCreator::write_settings ()
-{
- SettingsGroup g (settings_, "QSYMessageCreator");
- settings_->setValue ("window/pos", pos ());
- settings_->setValue ("whichTab", ui->tabWidget->currentIndex());
- settings_->setValue ("bandVHF", getbandVHF());
- settings_->setValue ("modeVHF", getmodeVHF());
- settings_->setValue ("kHzVHF", getkHzVHF());
- settings_->setValue ("bandHF", getbandHF());
- settings_->setValue ("modeHF", getmodeHF());
- settings_->setValue ("kHzHF", getkHzHF());
- settings_->setValue ("bandEME", getbandEME());
- settings_->setValue ("modeEME", getmodeEME());
- settings_->setValue ("kHzEME", getkHzEME());
- QByteArray data;
- QDataStream *stream = new QDataStream(&data, QIODevice::WriteOnly);
- *stream << kHzFreqMap;
- settings_->setValue("kHzFreqMap", data);
- QByteArray data2;
- QDataStream *stream2 = new QDataStream(&data2, QIODevice::WriteOnly);
- *stream2 << MHzFreqMap;
- settings_->setValue("MHzFreqMap", data2);
- delete stream;
- delete stream2;
-}
+#include "QSYMessageCreator.h" +#include <QApplication> +#include <QSettings> +#include <QRadioButton> +#include <QButtonGroup> +#include <QObject> +#include <QMessageBox> +#include <QInputDialog> +#include <QCloseEvent> +#include <QTimer> +#include <QThread> +#include <QTabWidget> +#include <QDialog> +#include <QPushButton> +#include <QLabel> +#include <QWidget> +#include <QLayout> +#include <QSpinBox> +#include <QMap> +#include <QProxyStyle> +#include "commons.h" +#include "SettingsGroup.hpp" +#include "Configuration.hpp" +#include "qt_helpers.hpp" +#include "QSYMessageCreator.h" +#include "ui_QSYMessageCreator.h" + +QSYMessageCreator::QSYMessageCreator(QSettings * settings, Configuration const * configuration, QWidget *parent) + : QWidget(parent), + settings_ {settings}, + configuration_ {configuration}, + ui(new Ui::QSYMessageCreator) { + ui->setupUi(this); + setWindowTitle (QApplication::applicationName () + " - " + tr ("MessageCreator")); + QButtonGroup *modeButtonGroup = new QButtonGroup; + modeButtonGroup-> setExclusive(true); + modeButtonGroup->addButton(ui->radioButFM); + modeButtonGroup->addButton(ui->radioButSSB); + modeButtonGroup->addButton(ui->radioButCW); + modeButtonGroup->addButton(ui->radioButFT8); + modeButtonGroup->addButton(ui->radioButMSK); + + QButtonGroup *bandButtonGroup = new QButtonGroup; + bandButtonGroup-> setExclusive(true); + bandButtonGroup->addButton(ui->radioBut50); + bandButtonGroup->addButton(ui->radioBut144); + bandButtonGroup->addButton(ui->radioBut222); + bandButtonGroup->addButton(ui->radioBut432); + bandButtonGroup->addButton(ui->radioBut902); + bandButtonGroup->addButton(ui->radioBut903); + bandButtonGroup->addButton(ui->radioBut1296); + bandButtonGroup->addButton(ui->radioBut2304); + bandButtonGroup->addButton(ui->radioBut3400); + bandButtonGroup->addButton(ui->radioBut5760); + bandButtonGroup->addButton(ui->radioBut10368); + bandButtonGroup->addButton(ui->radioBut24192); + bandButtonGroup->addButton(ui->radioBut40); + bandButtonGroup->addButton(ui->radioBut70); + + QButtonGroup *modeButtonGroup2 = new QButtonGroup; + modeButtonGroup2-> setExclusive(true); + modeButtonGroup2->addButton(ui->radioButFM2); + modeButtonGroup2->addButton(ui->radioButSSB2); + modeButtonGroup2->addButton(ui->radioButCW2); + modeButtonGroup2->addButton(ui->radioButFT82); + modeButtonGroup2->addButton(ui->radioButFT4); + modeButtonGroup2->addButton(ui->radioButJT9); + modeButtonGroup2->addButton(ui->radioButJT65); + modeButtonGroup2->addButton(ui->radioButFST4); + + QButtonGroup *bandButtonGroup2 = new QButtonGroup; + bandButtonGroup2-> setExclusive(true); + bandButtonGroup2->addButton(ui->radioBut630M); + bandButtonGroup2->addButton(ui->radioBut160M); + bandButtonGroup2->addButton(ui->radioBut80M); + bandButtonGroup2->addButton(ui->radioBut60M); + bandButtonGroup2->addButton(ui->radioBut40M); + bandButtonGroup2->addButton(ui->radioBut30M); + bandButtonGroup2->addButton(ui->radioBut20M); + bandButtonGroup2->addButton(ui->radioBut17M); + bandButtonGroup2->addButton(ui->radioBut15M); + bandButtonGroup2->addButton(ui->radioBut12M); + bandButtonGroup2->addButton(ui->radioBut10M1); + bandButtonGroup2->addButton(ui->radioBut10M2); + + QButtonGroup *modeButtonGroup3 = new QButtonGroup; + modeButtonGroup3-> setExclusive(true); + modeButtonGroup3->addButton(ui->radioButQ6530B); + modeButtonGroup3->addButton(ui->radioButQ6560C); + modeButtonGroup3->addButton(ui->radioButCW3); + modeButtonGroup3->addButton(ui->radioButQ6560D); + modeButtonGroup3->addButton(ui->radioButQ6560E); + modeButtonGroup3->addButton(ui->radioButQ65120D); + + QButtonGroup *bandButtonGroup3 = new QButtonGroup; + bandButtonGroup3-> setExclusive(true); + bandButtonGroup3->addButton(ui->radioBut50A); + bandButtonGroup3->addButton(ui->radioBut144A); + bandButtonGroup3->addButton(ui->radioBut222A); + bandButtonGroup3->addButton(ui->radioBut432A); + bandButtonGroup3->addButton(ui->radioBut902A); + bandButtonGroup3->addButton(ui->radioBut903A); + bandButtonGroup3->addButton(ui->radioBut1296A); + bandButtonGroup3->addButton(ui->radioBut2304A); + bandButtonGroup3->addButton(ui->radioBut3400A); + bandButtonGroup3->addButton(ui->radioBut5760A); + bandButtonGroup3->addButton(ui->radioBut10368A); + bandButtonGroup3->addButton(ui->radioBut24048); + + QButtonGroup *messageButtonGroup = new QButtonGroup; + messageButtonGroup-> setExclusive(true); + messageButtonGroup->addButton(ui->message1); + messageButtonGroup->addButton(ui->message2); + messageButtonGroup->addButton(ui->message3); + messageButtonGroup->addButton(ui->message4); + messageButtonGroup->addButton(ui->message5); + messageButtonGroup->addButton(ui->message6); + messageButtonGroup->addButton(ui->message7); + messageButtonGroup->addButton(ui->message8); + messageButtonGroup->addButton(ui->message9); + messageButtonGroup->addButton(ui->message10); + messageButtonGroup->addButton(ui->message11); + messageButtonGroup->addButton(ui->message12); + messageButtonGroup->addButton(ui->message13); + messageButtonGroup->addButton(ui->message14); + + read_settings(); + + if(MHzFreqMap.size() < 4) { + // need a MHZ map now that have selectable MHz values for FM mode + if(configuration_->region() > 0) { + if(configuration_->region() ==2) { + MHzFreqMap.insert("A",52); //6M, 52 MHz + MHzFreqMap.insert("B",146); //2M, 146 MHz + MHzFreqMap.insert("C",223); //1.25M, 223 MHz + MHzFreqMap.insert("D",446); //70cm, 446 MHz + MHzFreqMap.insert("E",1294); //23 cm, 1294 MHz + } else { + MHzFreqMap.insert("A",50); //6M 50 MHz + MHzFreqMap.insert("B",145); //2M, 145 MHz + MHzFreqMap.insert("D",433); //70cm, 433 MHz + MHzFreqMap.insert("E",1297); //23 cm, 1297 MHz + } + } + } + + if(kHzFreqMap.size() < 10) { + QPair<QString,QChar> key("L",'V'); //630m //SSB + key.first = "M"; //160 + kHzFreqMap.insert(key, 910); + key.first = "N"; //80 + kHzFreqMap.insert(key, 960); + key.first = "O"; //60 + kHzFreqMap.insert(key, 354); + key.first = "P"; //40 + kHzFreqMap.insert(key, 285); + key.first = "R"; //20 + kHzFreqMap.insert(key, 285); + key.first = "S"; //17 + kHzFreqMap.insert(key, 130); + key.first = "T"; //15 + kHzFreqMap.insert(key, 385); + key.first = "U"; //12 + kHzFreqMap.insert(key, 910); + key.first = "V"; //28M + kHzFreqMap.insert(key, 385); + + key.first = "L"; //630M + key.second = 'W'; //CW + kHzFreqMap.insert(key, 473); + key.first = "M"; //160 + kHzFreqMap.insert(key, 810); + key.first = "N"; //80 + kHzFreqMap.insert(key, 560); + key.first = "O"; //60 + kHzFreqMap.insert(key, 353); + key.first = "P"; //40 + kHzFreqMap.insert(key, 40); + key.first = "Q"; //30 + kHzFreqMap.insert(key, 106); + key.first = "R"; //20 + kHzFreqMap.insert(key, 60); + key.first = "S"; //17 + kHzFreqMap.insert(key, 96); + key.first = "T"; //15 + kHzFreqMap.insert(key, 60); + key.first = "U"; //12 + kHzFreqMap.insert(key, 906); + key.first = "V"; //28M + kHzFreqMap.insert(key, 60); + + key.first = "V"; //28 MHz + key.second = '9'; //FM + kHzFreqMap.insert(key, 999); + key.first = "W"; //29 MHz + key.second = '9'; //FM + kHzFreqMap.insert(key, 600); + + key.first = "L"; //630M + key.second = 'C'; //FST4 + kHzFreqMap.insert(key, 474); + key.first = "M"; //160 + kHzFreqMap.insert(key, 839); + key.first = "N"; //80 + kHzFreqMap.insert(key, 577); + key.first = "O"; //60 + kHzFreqMap.insert(key, 357); + key.first = "P"; //40 + kHzFreqMap.insert(key, 49); + key.first = "Q"; //30 + kHzFreqMap.insert(key, 142); + key.first = "R"; //20 + kHzFreqMap.insert(key, 82); + key.first = "S"; //17 + kHzFreqMap.insert(key, 106); + key.first = "T"; //15 + kHzFreqMap.insert(key, 142); + key.first = "U"; //12 + kHzFreqMap.insert(key, 921); + key.first = "V"; //28M + kHzFreqMap.insert(key, 182); + + key.second = 'J'; //FT4 + key.first = "N"; //80 + kHzFreqMap.insert(key, 575); + key.first = "O"; //60 + kHzFreqMap.insert(key, 357); + key.first = "P"; //40 + kHzFreqMap.insert(key, 47); + key.first = "Q"; //30 + kHzFreqMap.insert(key, 140); + key.first = "R"; //20 + kHzFreqMap.insert(key, 80); + key.first = "S"; //17 + kHzFreqMap.insert(key, 104); + key.first = "T"; //15 + kHzFreqMap.insert(key, 140); + key.first = "U"; //12 + kHzFreqMap.insert(key, 919); + key.first = "V"; //28M + kHzFreqMap.insert(key, 180); + + key.second = 'L'; //FT8; + key.first = "M"; //160 + kHzFreqMap.insert(key, 840); + key.first = "N"; //80 + kHzFreqMap.insert(key, 573); + key.first = "O"; //60 + kHzFreqMap.insert(key, 357); + key.first = "P"; //40 + kHzFreqMap.insert(key, 74); + key.first = "Q"; //30 + kHzFreqMap.insert(key, 136); + key.first = "R"; //20 + kHzFreqMap.insert(key, 74); + key.first = "S"; //17 + kHzFreqMap.insert(key, 100); + key.first = "T"; //15 + kHzFreqMap.insert(key, 74); + key.first = "U"; //12 + kHzFreqMap.insert(key, 915); + key.first = "V"; //28M + kHzFreqMap.insert(key, 74); + + key.second = 'B'; //JT65 + key.first = "M"; //160 + kHzFreqMap.insert(key, 838); + key.first = "N"; //80 + kHzFreqMap.insert(key, 576); + key.first = "O"; //60 + kHzFreqMap.insert(key, 357); + key.first = "P"; //40 + kHzFreqMap.insert(key, 76); + key.first = "Q"; //30 + kHzFreqMap.insert(key, 138); + key.first = "R"; //20 + kHzFreqMap.insert(key, 76); + key.first = "S"; //17 + kHzFreqMap.insert(key, 102); + key.first = "T"; //15 + kHzFreqMap.insert(key, 76); + key.first = "U"; //12 + kHzFreqMap.insert(key, 917); + key.first = "V"; //28M + kHzFreqMap.insert(key, 76); + + key.second = 'A'; //JT9 + key.first = "M"; //160 + kHzFreqMap.insert(key, 839); + key.first = "N"; //80 + kHzFreqMap.insert(key, 572); + key.first = "O"; //60 + kHzFreqMap.insert(key, 357); + key.first = "P"; //40 + kHzFreqMap.insert(key, 78); + key.first = "Q"; //30 + kHzFreqMap.insert(key, 140); + key.first = "R"; //20 + kHzFreqMap.insert(key, 78); + key.first = "S"; //17 + kHzFreqMap.insert(key, 104); + key.first = "T"; //15 + kHzFreqMap.insert(key, 78); + key.first = "U"; //12 + kHzFreqMap.insert(key, 919); + key.first = "V"; //28M + kHzFreqMap.insert(key, 78); + + //VHF and EME band/mode/freq + + key.second = 'V'; //SSB + key.first = "A"; // 6M + kHzFreqMap.insert(key, 125); + key.first = "B"; //2M + kHzFreqMap.insert(key, 200); + key.first = "C"; //222 + kHzFreqMap.insert(key, 100); + key.first = "D"; //432 + kHzFreqMap.insert(key, 100); + key.first = "9"; //902 + kHzFreqMap.insert(key, 100); + key.first = "K"; //903 + kHzFreqMap.insert(key, 100); + key.first = "E"; //1296 + kHzFreqMap.insert(key, 100); + key.first = "F"; //2304 + kHzFreqMap.insert(key, 100); + key.first = "G"; //3400 + kHzFreqMap.insert(key, 100); + key.first = "H"; //5760 + kHzFreqMap.insert(key, 100); + key.first = "I"; //10368 + kHzFreqMap.insert(key, 100); + key.first = "J"; //24192 + kHzFreqMap.insert(key, 100); + key.first = "X"; //24048 + kHzFreqMap.insert(key, 100); + key.first = "4"; //8M + kHzFreqMap.insert(key, 680); + key.first = "7"; //4M + kHzFreqMap.insert(key, 200); + + key.second = 'W'; //CW + key.first = "A"; // 6M + kHzFreqMap.insert(key, 90); + key.first = "B"; //2M + kHzFreqMap.insert(key, 100); + key.first = "C"; //222 + kHzFreqMap.insert(key, 100); + key.first = "D"; //432 + kHzFreqMap.insert(key, 100); + key.first = "9"; //902 + kHzFreqMap.insert(key, 100); + key.first = "K"; //903 + kHzFreqMap.insert(key, 100); + key.first = "E"; //1296 + kHzFreqMap.insert(key, 100); + key.first = "F"; //2304 + kHzFreqMap.insert(key, 100); + key.first = "G"; //3400 + kHzFreqMap.insert(key, 100); + key.first = "H"; //5760 + kHzFreqMap.insert(key, 100); + key.first = "I"; //10368 + kHzFreqMap.insert(key, 100); + key.first = "J"; //24192 + kHzFreqMap.insert(key, 100); + key.first = "X"; //24048 + kHzFreqMap.insert(key, 100); + + key.second = '2'; // FM + key.first = "A"; // 6M + kHzFreqMap.insert(key, 525); //region 2 + key.second = '6'; // FM + key.first = "B"; //2M + kHzFreqMap.insert(key, 520); //region 2 + key.second = '3'; // FM + key.first = "C"; //222 + kHzFreqMap.insert(key, 500); //region 2 + key.second = '6'; // FM + key.first = "D"; //432 + kHzFreqMap.insert(key, 000); //region 2 + key.second = '7'; // FM + key.first = "E"; //1296 + kHzFreqMap.insert(key, 500); //region 1 + key.second = '4'; // FM + key.first = "E"; //1296 + kHzFreqMap.insert(key, 500); //region 2 + key.second = '1'; // FM + key.first = "A"; // 6M + kHzFreqMap.insert(key, 800); //region 1 + key.second = '5'; // FM + key.first = "B"; //2M + kHzFreqMap.insert(key, 500); //region 1 + key.second = '3'; // FM + key.first = "D"; //432 + kHzFreqMap.insert(key, 650); //region 1 + + key.second = 'L'; // FT8 + key.first = "A"; // 6M + kHzFreqMap.insert(key, 313); + key.first = "B"; //2M + kHzFreqMap.insert(key, 174); + key.first = "C"; //222 + kHzFreqMap.insert(key, 174); + key.first = "D"; //432 + kHzFreqMap.insert(key, 174); + key.first = "9"; //902 + kHzFreqMap.insert(key, 174); + key.first = "K"; //903 + kHzFreqMap.insert(key, 174); + key.first = "E"; //1296 + kHzFreqMap.insert(key, 174); + key.first = "F"; //2304 + kHzFreqMap.insert(key, 174); + key.first = "G"; //3400 + kHzFreqMap.insert(key, 174); + key.first = "H"; //5760 + kHzFreqMap.insert(key, 174); + key.first = "I"; //10368 + kHzFreqMap.insert(key, 174); + key.first = "J"; //24192 + kHzFreqMap.insert(key, 174); + key.first = "X"; //24048 + kHzFreqMap.insert(key, 174); + key.first = "4"; //8M + kHzFreqMap.insert(key, 680); + key.first = "7"; //4M + kHzFreqMap.insert(key, 154); + + key.second = 'K'; // MSK144 + key.first = "A"; // 6M + kHzFreqMap.insert(key, 280); + key.first = "B"; //2M + kHzFreqMap.insert(key, 150); + key.first = "C"; //222 + kHzFreqMap.insert(key, 150); + key.first = "D"; //432 + kHzFreqMap.insert(key, 150); + + QList<QChar> Q65modes = {'D','E','F','G','H'}; + QList<QChar>::iterator it = Q65modes.begin(); + while (it!=Q65modes.end()) { + key.second = *it; // Q65 submodes D,E,F,G,H + key.first = "A"; // 6M + kHzFreqMap.insert(key, 275); + key.first = "B"; //2M + kHzFreqMap.insert(key, 170); + key.first = "C"; //222 + kHzFreqMap.insert(key, 170); + key.first = "D"; //432 + kHzFreqMap.insert(key, 170); + key.first = "9"; //902 + kHzFreqMap.insert(key, 170); + key.first = "K"; //903 + kHzFreqMap.insert(key, 170); + key.first = "E"; //1296 + kHzFreqMap.insert(key, 170); + key.first = "F"; //2304 + kHzFreqMap.insert(key, 170); + key.first = "G"; //3400 + kHzFreqMap.insert(key, 170); + key.first = "H"; //5760 + kHzFreqMap.insert(key, 170); + key.first = "I"; //10368 + kHzFreqMap.insert(key, 170); + key.first = "J"; //24192 + kHzFreqMap.insert(key, 170); + key.first = "X"; //24048 + kHzFreqMap.insert(key, 170); + ++it; + } + } + +#if (QT_VERSION < QT_VERSION_CHECK(5, 15, 0)) + //VHF + connect(modeButtonGroup, QOverload<int, bool>::of(&QButtonGroup::buttonToggled), [=](int id, bool checked){ + qDebug() << "id" << id << "toggled:" << checked; + QString theBand = getBand(); + QChar theMode = getMode(theBand, configuration_->region()); + setkHzBox(theBand, theMode, ui->tabWidget->currentIndex()); + WriteMessage(ui->DxBaseLabel->text(), theBand, theMode); + }); + + connect(bandButtonGroup, QOverload<int, bool>::of(&QButtonGroup::buttonToggled), [=](int id, bool checked){ + qDebug() << "id" << id << "toggled:" << checked; + QString theBand = getBand(); + if((theBand=="A" || theBand=="B" || theBand=="C" || theBand=="D" || theBand=="E")) setupfmSpinBox(theBand); + QChar theMode = getMode(theBand, configuration_->region()); + setkHzBox(theBand, theMode, ui->tabWidget->currentIndex()); + WriteMessage(ui->DxBaseLabel->text(), theBand, theMode); + }); + //HF + connect(modeButtonGroup2, QOverload<int, bool>::of(&QButtonGroup::buttonToggled), [=](int id, bool checked){ + qDebug() << "id" << id << "toggled:" << checked; + QString theBand = getBand(); + QChar theMode = getMode(theBand, configuration_->region()); + setkHzBox(theBand, theMode, ui->tabWidget->currentIndex()); + WriteMessage(ui->DxBaseLabel->text(), theBand, theMode); + }); + + connect(bandButtonGroup2, QOverload<int, bool>::of(&QButtonGroup::buttonToggled), [=](int id, bool checked){ + qDebug() << "id" << id << "toggled:" << checked; + QString theBand = getBand(); + QChar theMode = getMode(theBand, configuration_->region()); + setkHzBox(theBand, theMode, ui->tabWidget->currentIndex()); + WriteMessage(ui->DxBaseLabel->text(), theBand, theMode); + }); + //EME + connect(modeButtonGroup3, QOverload<int, bool>::of(&QButtonGroup::buttonToggled), [=](int id, bool checked){ + qDebug() << "id" << id << "toggled:" << checked; + QString theBand = getBand(); + QChar theMode = getMode(theBand, configuration_->region()); + setkHzBox(theBand, theMode, ui->tabWidget->currentIndex()); + WriteMessage(ui->DxBaseLabel->text(), theBand, theMode); + }); + + connect(bandButtonGroup3, QOverload<int, bool>::of(&QButtonGroup::buttonToggled), [=](int id, bool checked){ + qDebug() << "id" << id << "toggled:" << checked; + QString theBand = getBand(); + QChar theMode = getMode(theBand, configuration_->region()); + setkHzBox(theBand, theMode, ui->tabWidget->currentIndex()); + WriteMessage(ui->DxBaseLabel->text(), theBand, theMode); + }); + + //General Messages + connect(messageButtonGroup, QOverload<int, bool>::of(&QButtonGroup::buttonToggled), [=](int id, bool checked){ + qDebug() << "id" << id << "toggled:" << checked; + QString message = getGenMessage(); + }); + +#else //VHF + QObject::connect(modeButtonGroup, &QButtonGroup::idToggled, [&](int id, bool checked) { + qDebug() << "Button" << id << "toggled:" << checked; + QString theBand = getBand(); + QChar theMode = getMode(theBand, configuration_->region()); + setkHzBox(theBand, theMode, ui->tabWidget->currentIndex()); + QSYMessageCreator::WriteMessage(ui->DxBaseLabel->text(), theBand, theMode); + }); + + QObject::connect(bandButtonGroup, &QButtonGroup::idToggled, [&](int id, bool checked) { + qDebug() << "Button" << id << "toggled:" << checked; + QString theBand = getBand(); + if((theBand=="A" || theBand=="B" || theBand=="C" || theBand=="D" || theBand=="E")) setupfmSpinBox(theBand); + QChar theMode = getMode(theBand, configuration_->region()); + setkHzBox(theBand, theMode, ui->tabWidget->currentIndex()); + QSYMessageCreator::WriteMessage(ui->DxBaseLabel->text(), theBand, theMode); + }); + //HF + QObject::connect(modeButtonGroup2, &QButtonGroup::idToggled, [&](int id, bool checked) { + qDebug() << "Button" << id << "toggled:" << checked; + QString theBand = getBand(); + QChar theMode = getMode(theBand, configuration_->region()); + setkHzBox(theBand, theMode, ui->tabWidget->currentIndex()); + QSYMessageCreator::WriteMessage(ui->DxBaseLabel->text(), theBand, theMode); + }); + + QObject::connect(bandButtonGroup2, &QButtonGroup::idToggled, [&](int id, bool checked) { + qDebug() << "Button" << id << "toggled:" << checked; + QString theBand = getBand(); + QChar theMode = getMode(theBand, configuration_->region()); + setkHzBox(theBand, theMode, ui->tabWidget->currentIndex()); + QSYMessageCreator::WriteMessage(ui->DxBaseLabel->text(), theBand, theMode); + }); + //EME + QObject::connect(modeButtonGroup3, &QButtonGroup::idToggled, [&](int id, bool checked) { + qDebug() << "Button" << id << "toggled:" << checked; + QString theBand = getBand(); + QChar theMode = getMode(theBand, configuration_->region()); + setkHzBox(theBand, theMode, ui->tabWidget->currentIndex()); + QSYMessageCreator::WriteMessage(ui->DxBaseLabel->text(), theBand, theMode); + }); + + QObject::connect(bandButtonGroup3, &QButtonGroup::idToggled, [&](int id, bool checked) { + qDebug() << "Button" << id << "toggled:" << checked; + QString theBand = getBand(); + QChar theMode = getMode(theBand, configuration_->region()); + setkHzBox(theBand, theMode, ui->tabWidget->currentIndex()); + QSYMessageCreator::WriteMessage(ui->DxBaseLabel->text(), theBand, theMode); + }); + + //General Messages + QObject::connect(messageButtonGroup, &QButtonGroup::idToggled, [&](int id, bool checked) { + qDebug() << "Button" << id << "toggled:" << checked; + QString message = getGenMessage(); + }); + +#endif + + connect(ui->fmSpinBox, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &QSYMessageCreator::onfmSpinBoxValueChanged); //VHF + connect(ui->kHzBox, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &QSYMessageCreator::onkHzBoxValueChanged); //VHF + connect(ui->kHzBox2, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &QSYMessageCreator::onkHzBox2ValueChanged); //HF + connect(ui->kHzBox3, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &QSYMessageCreator::onkHzBox3ValueChanged); //EME + + connect(ui->tabWidget, &QTabWidget::currentChanged, this, &QSYMessageCreator::onTabChanged); + + setup(); +} + +QSYMessageCreator::~QSYMessageCreator() +{ + delete ui; +} + +void QSYMessageCreator::onfmSpinBoxValueChanged() +{ + QString theBand = getBand(); + QChar theMode = getMode(theBand, configuration_->region()); + QString message = WriteMessage(ui->DxBaseLabel->text(), theBand, theMode); + setkHzVHF(ui->kHzBox->value()); + WriteMessage(ui->DxBaseLabel->text(), theBand, theMode); +} + +void QSYMessageCreator::setupfmSpinBox(QString band) { + if ((band =="A" || band == "B" || band == "C" || band == "D" || band == "E") && (configuration_->region () > 0)) { + ui->label_2_FM->setHidden(false); + ui->fmSpinBox->setHidden(false); + ui->label_2_FM->setText("Region " + QString::number(configuration_->region()) + " MHz"); + if (configuration_->region ()==2) { + if(band=="A") { + ui->fmSpinBox->setRange(50,53); + } else if(band=="B") { + ui->fmSpinBox->setRange(144,147); + } else if(band=="C") { + ui->fmSpinBox->setRange(222,223); + } else if(band=="D") { + ui->fmSpinBox->setRange(440,449); + } else if(band=="E") { + ui->fmSpinBox->setRange(1290,1299); + } + } else { //not region 2 + if(band=="A") { + ui->fmSpinBox->setRange(50,53); + } else if(band=="B") { + ui->fmSpinBox->setRange(144,145); + } else if(band=="C") { + ui->label_2_FM->setHidden(true); + } else if(band=="D") { + ui->fmSpinBox->setRange(430,439); + } else if(band=="E") { + ui->fmSpinBox->setRange(1290,1299); + } + } + auto it = MHzFreqMap.find(band); + int defaultValue = -1; + int value = (it != MHzFreqMap.constEnd()) ? it.value() : defaultValue; + if(value >=0) { + ui->fmSpinBox->setValue(value); + } + else { + ui->fmSpinBox->setValue(ui->fmSpinBox->minimum()); + } + } +} + +void QSYMessageCreator::setkHzBox(QString theBand, QChar theMode, int tabNum) +{ + QPair<QString,QChar> key(theBand,theMode); + auto it = kHzFreqMap.find(key); + int defaultValue = -1; + int value = (it != kHzFreqMap.constEnd()) ? it.value() : defaultValue; + + if (value >= 0) { + if(tabNum ==1) { + ui->kHzBox->setValue(value); + setkHzVHF(value); + } else if (tabNum ==0) { + ui->kHzBox2->setValue(value); + setkHzHF(value); + } else if (tabNum ==2) { + ui->kHzBox3->setValue(value); + setkHzEME(value); + } + kHzFreqMap.insert(key, value); + } else { + QMap<QPair<QString, QChar>, int>::const_iterator it = kHzFreqMap.begin(); + bool running = true; + while (running && (it !=kHzFreqMap.end())) { + QPair<QString,QChar> key = it.key(); + if (key.first.contains(theBand)) { + int value = it.value(); + if (tabNum ==1) { + ui->kHzBox->setValue(value); + setkHzVHF(value); + } else if (tabNum ==0) { + ui->kHzBox2->setValue(value); + setkHzHF(value); + } else if (tabNum ==2) { + ui->kHzBox3->setValue(value); + setkHzEME(value); + }; + running = false; + } + ++it; + } + } + + if (value<0 && tabNum == 0) { + if (theBand.compare("L")==0) { + if ((ui->kHzBox2->value() < 472) || ui->kHzBox2->value() > 479) ui->kHzBox2->setValue(472); + } + else if (theBand.compare("M")==0) { + if (ui->kHzBox2->value() < 800 ) ui->kHzBox2->setValue(800); + } + else if (theBand.compare("N")==0) { + if (ui->kHzBox2->value() < 500 ) ui->kHzBox2->setValue(500); + } + else if (theBand.compare("O")==0) { + if (ui->kHzBox2->value() < 330 || ui->kHzBox2->value() > 405) ui->kHzBox2->setValue(357); + } + else if (theBand.compare("P")==0) { + if (ui->kHzBox2->value() > 300) ui->kHzBox2->setValue(0); + } + else if (theBand.compare("Q")==0) { + if (ui->kHzBox2->value() < 100 || ui->kHzBox2->value() > 150) ui->kHzBox2->setValue(100); + } + else if (theBand.compare("R")==0) { + if (ui->kHzBox2->value() > 350) ui->kHzBox2->setValue(0); + } + else if (theBand.compare("S")==0) { + if (ui->kHzBox2->value() < 68 || ui->kHzBox2->value() > 110) ui->kHzBox2->setValue(68); + } + else if (theBand.compare("T")==0) { + if (ui->kHzBox2->value() > 450) ui->kHzBox2->setValue(0); + } + else if (theBand.compare("U")==0) { + if (ui->kHzBox2->value() < 890 || ui->kHzBox2->value() > 930) ui->kHzBox2->setValue(890); + } + else if (theBand.compare("W")==0) { + if (ui->kHzBox2->value() > 700) ui->kHzBox2->setValue(0); + } + else if (theBand.compare("4")==0) { + if (ui->kHzBox2->value() > 680) ui->kHzBox2->setValue(0); + } + else if (theBand.compare("7")==0) { + if (ui->kHzBox2->value() > 200) ui->kHzBox2->setValue(0); + } + } + setkHzHF(ui->kHzBox2->value()); +} + +void QSYMessageCreator::onkHzBoxValueChanged() +{ + QString theBand = getBand(); + QChar theMode = getMode(theBand, configuration_->region()); + QString message = WriteMessage(ui->DxBaseLabel->text(), theBand, theMode); + setkHzVHF(ui->kHzBox->value()); + WriteMessage(ui->DxBaseLabel->text(), theBand, theMode); +} + +void QSYMessageCreator::onkHzBox2ValueChanged() +{ + QString theBand = getBand(); + QChar theMode = getMode(theBand, configuration_->region()); + QString message = WriteMessage(ui->DxBaseLabel->text(), theBand, theMode); + setkHzHF(ui->kHzBox2->value()); + WriteMessage(ui->DxBaseLabel->text(), theBand, theMode); +} + +void QSYMessageCreator::onkHzBox3ValueChanged() +{ + QString theBand = getBand(); + QChar theMode = getMode(theBand, configuration_->region()); + QString message = WriteMessage(ui->DxBaseLabel->text(), theBand, theMode); + setkHzEME(ui->kHzBox3->value()); + WriteMessage(ui->DxBaseLabel->text(), theBand, theMode); +} + +void QSYMessageCreator::setup() +{ + if (configuration_->region() == 0) { + QMessageBox *regionWarning = new QMessageBox(this); + regionWarning->setModal(false); + regionWarning->setIcon(QMessageBox::Warning); + regionWarning->setText("You need to enter your IARU Region\nin Settings or FM frequencies\nwill not be shown!"); + regionWarning->setWindowFlags(regionWarning->windowFlags() | Qt::WindowStaysOnTopHint); + regionWarning->show(); + } else if (configuration_->region() == 2) { + ui->radioBut24192->setText("24192 MHz"); + } else { + ui->radioBut24192->setText("24048 MHz"); + } +} + +void QSYMessageCreator::onTabChanged() +{ + if (configuration_->region() == 2) { + ui->radioBut24192->setText("24192 MHz"); + } else { + ui->radioBut24192->setText("24048 MHz"); + } + getGenMessage(); + QString theBand = getBand(); + QChar theMode = getMode(theBand, configuration_->region()); + setkHzBox(theBand, theMode, ui->tabWidget->currentIndex()); + WriteMessage(ui->DxBaseLabel->text(), theBand, theMode); +} + +void QSYMessageCreator::on_button1_clicked() +{ + QString theBand = getBand(); + QChar theMode = getMode(theBand, configuration_->region()); + QString message = WriteMessage(ui->DxBaseLabel->text(), theBand, theMode); + QPair<QString,QChar>key(theBand,theMode); + kHzFreqMap.insert(key, ui->kHzBox->value()); + if(!theMode.isLetter() && (theBand=="A" || theBand=="B" || theBand=="C" || theBand=="D" || theBand=="E")) MHzFreqMap.insert(theBand, ui->fmSpinBox->value()); + Q_EMIT sendMessage(message); +} + +void QSYMessageCreator::on_saveMHzButton_clicked() +{ + QString theBand = getBand(); + QChar theMode = getMode(theBand, configuration_->region()); + QPair<QString,QChar>key(theBand,theMode); + kHzFreqMap.insert(key, ui->kHzBox->value()); + MHzFreqMap.insert(theBand, ui->fmSpinBox->value()); +} + +void QSYMessageCreator::on_saveMHzButton_2_clicked() +{ + QString theBand = getBand(); + QChar theMode = getMode(theBand, configuration_->region()); + QPair<QString,QChar>key(theBand,theMode); + kHzFreqMap.insert(key, ui->kHzBox2->value()); +} + +void QSYMessageCreator::on_saveMHzButton_3_clicked() +{ + QString theBand = getBand(); + QChar theMode = getMode(theBand, configuration_->region()); + QPair<QString,QChar>key(theBand,theMode); + kHzFreqMap.insert(key, ui->kHzBox3->value()); +} + +void QSYMessageCreator::on_button2_clicked() +{ + QString theBand = getBand(); + QChar theMode = getMode(theBand, configuration_->region()); + QString message = WriteMessage(ui->DxBaseLabel->text(), theBand, theMode); + QPair<QString,QChar>key(theBand,theMode); + kHzFreqMap.insert(key, ui->kHzBox2->value()); + Q_EMIT sendMessage(message); +} + +void QSYMessageCreator::on_button3_clicked() +{ + QString theBand = getBand(); + QChar theMode = getMode(theBand, configuration_->region()); + QString message = WriteMessage(ui->DxBaseLabel->text(), theBand, theMode); + QPair<QString,QChar>key(theBand,theMode); + kHzFreqMap.insert(key, ui->kHzBox3->value()); + Q_EMIT sendMessage(message); +} + +void QSYMessageCreator::on_genButton_clicked() +{ + QString message = getGenMessage(); + Q_EMIT sendMessage(message); +} + +QString QSYMessageCreator::getGenMessage() { + QString message; + if (ui->message1->isChecked()) message = "001"; + else if (ui->message2->isChecked()) message = "002"; + else if (ui->message3->isChecked()) message = "003"; + else if (ui->message4->isChecked()) message = "004"; + else if (ui->message5->isChecked()) message = "005"; + else if (ui->message6->isChecked()) message = "006"; + else if (ui->message7->isChecked()) message = "007"; + else if (ui->message8->isChecked()) message = "008"; + else if (ui->message9->isChecked()) message = "009"; + else if (ui->message10->isChecked()) message = "010"; + else if (ui->message11->isChecked()) message = "011"; + else if (ui->message12->isChecked()) message = "012"; + else if (ui->message13->isChecked()) message = "013"; + else if (ui->message14->isChecked()) message = "014"; + message = ui->DxBaseLabel->text() + ".ZA" + message; + ui->messageLabel4->setText(message); + return message; +} + +void QSYMessageCreator::setQSYMessageCreatorStatusFalse() +{ + Q_EMIT sendQSYMessageCreatorStatus(false); +} + +void QSYMessageCreator::getDxBase(QString value) { + ui->DxBaseLabel->setText(value); + QString theBand = getBand(); + QChar theMode = getMode(theBand, configuration_->region()); + setkHzBox(theBand, theMode, ui->tabWidget->currentIndex()); + WriteMessage(ui->DxBaseLabel->text(), theBand, theMode); + getGenMessage(); +} + +void QSYMessageCreator::closeEvent (QCloseEvent * e) +{ + if ((configuration_->region()) ==2 ) { + ui->radioBut24192->setText("24192 MHz"); + } else { + ui->radioBut24192->setText("24048 MHz"); + } + write_settings(); + setQSYMessageCreatorStatusFalse(); + e->accept(); // was ignore +} + +void QSYMessageCreator::read_settings () +{ + SettingsGroup g (settings_, "QSYMessageCreator"); + move (settings_->value ("window/pos", pos ()).toPoint ()); + + QByteArray readKHzData = settings_->value("kHzFreqMap").toByteArray(); + QDataStream readKHzStream(&readKHzData, QIODevice::ReadOnly); + readKHzStream >> kHzFreqMap; + QByteArray readMHzData = settings_->value("MHzFreqMap").toByteArray(); + QDataStream readMHzStream(&readMHzData, QIODevice::ReadOnly); + readMHzStream >> MHzFreqMap; + + ui->kHzBox3->setValue(settings_->value("kHzEME").toInt()); + setbandEME(settings_->value("bandEME").toString()); + setmodeEME(settings_->value("modeEME").toChar()); + ui->kHzBox->setValue(settings_->value("kHzVHF").toInt()); + setbandVHF(settings_->value("bandVHF").toString()); + setmodeVHF(settings_->value("modeVHF").toChar()); + initVHFMode = settings_->value("modeVHF").toChar(); + ui->kHzBox2->setValue(settings_->value("kHzHF").toInt()); + setbandHF(settings_->value("bandHF").toString()); + setmodeHF(settings_->value("modeHF").toChar()); + ui->tabWidget->setCurrentIndex(settings_->value("whichTab").toInt()); + setkHzVHF(ui->kHzBox->value()); + setkHzEME(ui->kHzBox3->value()); + setkHzHF(ui->kHzBox2->value()); + bool testVHF = true; + bool testHF = true; + bool testEME = true; + if ((settings_->value("bandVHF").toString()).compare("")==0) { + setbandVHF("A"); + testVHF=false; + } + if ((settings_->value("modeVHF").toString()).compare("")==0) { + setmodeVHF('V'); + testVHF=false; + } + if ((settings_->value("bandHF").toString()).compare("")==0) { + setbandHF("M"); + testHF = false; + } + if ((settings_->value("modeHF").toString()).compare("")==0) { + setmodeHF('V'); + testHF = false; + } + if ((settings_->value("bandEME").toString()).compare("")==0) { + setbandEME("A"); + testEME = false; + } + if ((settings_->value("modeEME").toString()).compare("")==0) { + setmodeEME('V'); + testEME = false; + } + if ((settings_->value("kHzVHF").toString()).compare("")==0) { + setkHzVHF(0); + testVHF = false; + } + if ((settings_->value("kHzHF").toString()).compare("")==0) { + setkHzHF(0); + testHF = false; + } + if ((settings_->value("kHzEME").toString()).compare("")==0) { + setkHzEME(0); + testEME = false; + } + + if (testVHF) { + QPair<QString,QChar> key(getbandVHF(),getmodeVHF()); + kHzFreqMap.insert(key,getkHzVHF()); + } + + if (testEME) { + QPair<QString,QChar> key(getbandEME(),getmodeEME()); + kHzFreqMap.insert(key,getkHzEME()); + } + + if (testHF) { + QPair<QString,QChar> key(getbandHF(),getmodeHF()); + kHzFreqMap.insert(key,getkHzHF()); + } + + ui->tabWidget->setCurrentIndex(1); + setBand(getbandVHF()); + setMode(getbandVHF(), getmodeVHF(), configuration_->region()); + if (!testVHF) { + setkHzBox(getbandVHF(),getmodeVHF(),1); + } + setkHzVHF(ui->kHzBox->value());; + WriteMessage(ui->DxBaseLabel->text(), getbandVHF(), getmodeVHF()); + + ui->tabWidget->setCurrentIndex(2); + setBand(getbandEME()); + setMode(getbandEME(), getmodeEME(), configuration_->region()); + if (!testEME) { + setkHzBox(getbandEME(),getmodeEME(),2); + } + setkHzEME(ui->kHzBox3->value());; + WriteMessage(ui->DxBaseLabel->text(), getbandEME(), getmodeEME()); + + ui->tabWidget->setCurrentIndex(0); + setBand(getbandHF()); + setMode(getbandHF(), getmodeHF(), configuration_->region()); + if (!testHF) { + setkHzBox(getbandHF(),getmodeHF(),0); + } + setkHzHF(ui->kHzBox2->value()); + WriteMessage(ui->DxBaseLabel->text(), getbandHF(), getmodeHF()); + + ui->tabWidget->setCurrentIndex(settings_->value("whichTab").toInt()); + +} + +QString QSYMessageCreator::WriteMessage (QString hisCall, QString band, QChar mode) +{ + QString message = ""; + if(ui->tabWidget->currentIndex() == 1) { + qint16 kHzFreq = ui->kHzBox->value(); + QString kHzStr = QStringLiteral("%1").arg(kHzFreq,3,10,QLatin1Char('0')); + message = hisCall + "." + band + mode + kHzStr; + ui->messageLabel->setText(message); + } + else if(ui->tabWidget->currentIndex() == 0) { + qint16 kHzFreq = ui->kHzBox2->value(); + QString kHzStr = QStringLiteral("%1").arg(kHzFreq,3,10,QLatin1Char('0')); + message = hisCall + "." + band + mode + kHzStr; + ui->messageLabel2->setText(message); + } + else if(ui->tabWidget->currentIndex() == 2) { + qint16 kHzFreq = ui->kHzBox3->value(); + QString kHzStr = QStringLiteral("%1").arg(kHzFreq,3,10,QLatin1Char('0')); + message = hisCall + "." + band + mode + kHzStr; + ui->messageLabel3->setText(message); + } + return message; +} + +QString QSYMessageCreator::getBand() +{ + QString band; + if(ui->tabWidget->currentIndex() == 1) { + if (ui->radioBut50->isChecked()) band = "A"; + else if (ui->radioBut144->isChecked()) band = "B"; + else if (ui->radioBut222->isChecked()) band = "C"; + else if (ui->radioBut432->isChecked()) band = "D"; + else if (ui->radioBut902->isChecked()) band = "9"; + else if (ui->radioBut903->isChecked()) band = "K"; + else if (ui->radioBut1296->isChecked()) band = "E"; + else if (ui->radioBut2304->isChecked()) band = "F"; + else if (ui->radioBut3400->isChecked()) band = "G"; + else if (ui->radioBut5760->isChecked()) band = "H"; + else if (ui->radioBut10368->isChecked()) band = "I"; + else if (ui->radioBut24192->isChecked()) band = "J"; + else if (ui->radioBut40->isChecked()) band = "4"; + else if (ui->radioBut70->isChecked()) band = "7"; + setbandVHF(band); + } else if(ui->tabWidget->currentIndex() == 0) { + if (ui->radioBut630M->isChecked()) band = "L"; + else if (ui->radioBut160M->isChecked()) band = "M"; + else if (ui->radioBut80M->isChecked()) band = "N"; + else if (ui->radioBut60M->isChecked()) band = "O"; + else if (ui->radioBut40M->isChecked()) band = "P"; + else if (ui->radioBut30M->isChecked()) band = "Q"; + else if (ui->radioBut20M->isChecked()) band = "R"; + else if (ui->radioBut17M->isChecked()) band = "S"; + else if (ui->radioBut15M->isChecked()) band = "T"; + else if (ui->radioBut12M->isChecked()) band = "U"; + else if (ui->radioBut10M1->isChecked()) band = "V"; + else if (ui->radioBut10M2->isChecked()) band = "W"; + setbandHF(band); + } else if(ui->tabWidget->currentIndex() == 2) { + if (ui->radioBut50A->isChecked()) band = "A"; + else if (ui->radioBut144A->isChecked()) band = "B"; + else if (ui->radioBut222A->isChecked()) band = "C"; + else if (ui->radioBut432A->isChecked()) band = "D"; + else if (ui->radioBut902A->isChecked()) band = "9"; + else if (ui->radioBut903A->isChecked()) band = "K"; + else if (ui->radioBut1296A->isChecked()) band = "E"; + else if (ui->radioBut2304A->isChecked()) band = "F"; + else if (ui->radioBut3400A->isChecked()) band = "G"; + else if (ui->radioBut5760A->isChecked()) band = "H"; + else if (ui->radioBut10368A->isChecked()) band = "I"; + else if (ui->radioBut24048->isChecked()) band = "X"; + setbandEME(band); + } + return band; +} + +void QSYMessageCreator::setBand(QString band) +{ + if(ui->tabWidget->currentIndex() == 1) { + if (band == "A") ui->radioBut50->setChecked(true); + else if (band == "B") ui->radioBut144->setChecked(true); + else if (band == "C") ui->radioBut222->setChecked(true); + else if (band == "D") ui->radioBut432->setChecked(true); + else if (band == "9") ui->radioBut902->setChecked(true); + else if (band == "K") ui->radioBut903->setChecked(true); + else if (band == "E") ui->radioBut1296->setChecked(true); + else if (band == "F") ui->radioBut2304->setChecked(true); + else if (band == "G") ui->radioBut3400->setChecked(true); + else if (band == "H") ui->radioBut5760->setChecked(true); + else if (band == "I") ui->radioBut10368->setChecked(true); + else if (band == "J") ui->radioBut24192->setChecked(true); + else if (band == "4") ui->radioBut40->setChecked(true); + else if (band == "7") ui->radioBut70->setChecked(true); + } else if(ui->tabWidget->currentIndex() == 0) { + if (band == "L") ui->radioBut630M->setChecked(true); + else if (band == "M") ui->radioBut160M->setChecked(true); + else if (band == "N") ui->radioBut80M->setChecked(true); + else if (band == "O") ui->radioBut60M->setChecked(true); + else if (band == "P") ui->radioBut40M->setChecked(true); + else if (band == "Q") ui->radioBut30M->setChecked(true); + else if (band == "R") ui->radioBut20M->setChecked(true); + else if (band == "S") ui->radioBut17M->setChecked(true); + else if (band == "T") ui->radioBut15M->setChecked(true); + else if (band == "U") ui->radioBut12M->setChecked(true); + else if (band == "V") ui->radioBut10M1->setChecked(true); + else if (band == "W") ui->radioBut10M2->setChecked(true); + } else if(ui->tabWidget->currentIndex() == 2) { + if (band == "A") ui->radioBut50A->setChecked(true); + else if (band == "B") ui->radioBut144A->setChecked(true); + else if (band == "C") ui->radioBut222A->setChecked(true); + else if (band == "D") ui->radioBut432A->setChecked(true); + else if (band == "9") ui->radioBut902A->setChecked(true); + else if (band == "K") ui->radioBut903A->setChecked(true); + else if (band == "E") ui->radioBut1296A->setChecked(true); + else if (band == "F") ui->radioBut2304A->setChecked(true); + else if (band == "G") ui->radioBut3400A->setChecked(true); + else if (band == "H") ui->radioBut5760A->setChecked(true); + else if (band == "I") ui->radioBut10368A->setChecked(true); + else if (band == "X") ui->radioBut24048->setChecked(true); + } +} + +void QSYMessageCreator::setMode(QString band, QChar mode, int region) +{ + if(ui->tabWidget->currentIndex() == 1) { //VHF tab + if (mode=='V') { //SSB + ui->radioButSSB->setChecked(true); + ui->label_2_FM->setHidden(true); + ui->fmSpinBox->setHidden(true); + } + else if (mode=='W') { //CW + ui->radioButCW->setChecked(true); + ui->label_2_FM->setHidden(true); + ui->fmSpinBox->setHidden(true); + } + else if (mode=='K') { //MSK144 + ui->radioButMSK->setChecked(true); + ui->label_2_FM->setHidden(true); + ui->fmSpinBox->setHidden(true); + } + else if (mode=='L') { //FT8 + ui->radioButFT8->setChecked(true); + ui->label_2_FM->setHidden(true); + ui->fmSpinBox->setHidden(true); + } + else if (!mode.isLetter()) { + ui->radioButFM->setChecked(true); + if ((band =="A" || band == "B" || band == "C" || band == "D" || band == "E") && (configuration_->region () > 0)) { + ui->label_2_FM->setHidden(false); + ui->fmSpinBox->setHidden(false); + ui->label_2_FM->setText("Region " + QString::number(configuration_->region()) + " MHz"); + if (region==2) { + if(band=="A") { + ui->fmSpinBox->setRange(50,53); + if(mode=='0') ui->fmSpinBox->setValue(50); + if(mode=='1') ui->fmSpinBox->setValue(51); + if(mode=='2') ui->fmSpinBox->setValue(52); + if(mode=='3') ui->fmSpinBox->setValue(53); + } else if(band=="B") { + ui->fmSpinBox->setRange(144,147); + if(mode=='4') ui->fmSpinBox->setValue(144); + if(mode=='5') ui->fmSpinBox->setValue(145); + if(mode=='6') ui->fmSpinBox->setValue(146); + if(mode=='7') ui->fmSpinBox->setValue(147); + } else if(band=="C") { + ui->fmSpinBox->setRange(222,223); + if(mode=='2') ui->fmSpinBox->setValue(222); + if(mode=='3') ui->fmSpinBox->setValue(223); + } else if(band=="D") { + ui->fmSpinBox->setRange(440,449); + if(mode=='0') ui->fmSpinBox->setValue(440); + if(mode=='1') ui->fmSpinBox->setValue(441); + if(mode=='2') ui->fmSpinBox->setValue(442); + if(mode=='3') ui->fmSpinBox->setValue(443); + if(mode=='4') ui->fmSpinBox->setValue(444); + if(mode=='5') ui->fmSpinBox->setValue(445); + if(mode=='6') ui->fmSpinBox->setValue(446); + if(mode=='7') ui->fmSpinBox->setValue(447); + if(mode=='8') ui->fmSpinBox->setValue(448); + if(mode=='9') ui->fmSpinBox->setValue(449); + } else if(band=="E") { + ui->fmSpinBox->setRange(1290,1299); + if(mode=='0') ui->fmSpinBox->setValue(1290); + if(mode=='1') ui->fmSpinBox->setValue(1291); + if(mode=='2') ui->fmSpinBox->setValue(1292); + if(mode=='3') ui->fmSpinBox->setValue(1293); + if(mode=='4') ui->fmSpinBox->setValue(1294); + if(mode=='5') ui->fmSpinBox->setValue(1295); + if(mode=='6') ui->fmSpinBox->setValue(1296); + if(mode=='7') ui->fmSpinBox->setValue(1297); + if(mode=='8') ui->fmSpinBox->setValue(1298); + if(mode=='9') ui->fmSpinBox->setValue(1299); + } + } else { //not region 2 + if(band=="A") { + ui->fmSpinBox->setRange(50,53); + if(mode=='0') ui->fmSpinBox->setValue(50); + if(mode=='1') ui->fmSpinBox->setValue(51); + if(mode=='2') ui->fmSpinBox->setValue(52); + if(mode=='3') ui->fmSpinBox->setValue(53); + } else if(band=="B") { + ui->fmSpinBox->setRange(144,145); + if(mode=='4') ui->fmSpinBox->setValue(144); + if(mode=='5') ui->fmSpinBox->setValue(145); + } else if(band=="C") { + ui->label_2_FM->setHidden(true); + } else if(band=="D") { + ui->fmSpinBox->setRange(430,439); + if(mode=='0') ui->fmSpinBox->setValue(430); + if(mode=='1') ui->fmSpinBox->setValue(431); + if(mode=='2') ui->fmSpinBox->setValue(432); + if(mode=='3') ui->fmSpinBox->setValue(433); + if(mode=='4') ui->fmSpinBox->setValue(434); + if(mode=='5') ui->fmSpinBox->setValue(435); + if(mode=='6') ui->fmSpinBox->setValue(436); + if(mode=='7') ui->fmSpinBox->setValue(437); + if(mode=='8') ui->fmSpinBox->setValue(438); + if(mode=='9') ui->fmSpinBox->setValue(439); + } else if(band=="E") { + ui->fmSpinBox->setRange(1290,1299); + if(mode=='0') ui->fmSpinBox->setValue(1290); + if(mode=='1') ui->fmSpinBox->setValue(1291); + if(mode=='2') ui->fmSpinBox->setValue(1292); + if(mode=='3') ui->fmSpinBox->setValue(1293); + if(mode=='4') ui->fmSpinBox->setValue(1294); + if(mode=='5') ui->fmSpinBox->setValue(1295); + if(mode=='6') ui->fmSpinBox->setValue(1296); + if(mode=='7') ui->fmSpinBox->setValue(1297); + if(mode=='8') ui->fmSpinBox->setValue(1298); + if(mode=='9') ui->fmSpinBox->setValue(1299); + } + } + } else { // is not lower 4 bands FM Mode + ui->label_2_FM->setHidden(true); + ui->fmSpinBox->setHidden(true); + } + QSYMessageCreator::MHzFreqMap.insert(band,ui->fmSpinBox->value()); + } //end mode !isLetter ( is FM ) + } //end vhf tab + else if(ui->tabWidget->currentIndex() == 0) { //HF tab + if (mode=='V') { + ui->radioButSSB2->setChecked(true); + } + else if (mode=='W') { + ui->radioButCW2->setChecked(true); + } + else if (!mode.isLetter()) { + ui->radioButFM2->setChecked(true); + } + else if (mode=='L') { + ui->radioButFT82->setChecked(true); + } + else if (mode=='J') { + ui->radioButFT4->setChecked(true); + } + else if (mode=='K') { + ui->radioButMSK->setChecked(true); + } + else if (mode=='A') { + ui->radioButJT9->setChecked(true); + } + else if (mode=='B') { + ui->radioButJT65->setChecked(true); + } + else if (mode=='C') { + ui->radioButFST4->setChecked(true); + } + } else if(ui->tabWidget->currentIndex() == 2) { //EME tab + if (mode=='D') { + ui->radioButQ6530B->setChecked(true); + } + else if (mode=='W') { + ui->radioButCW3->setChecked(true); + } + else if (mode=='E') { + ui->radioButQ6560C->setChecked(true); + } + else if (mode=='F') { + ui->radioButQ6560D->setChecked(true); + } + else if (mode=='G') { + ui->radioButQ6560E->setChecked(true); + } + else if (mode=='H') { + ui->radioButQ65120D->setChecked(true); + } + } +} + +QChar QSYMessageCreator::modeFromSpinBox(QString band, int MHzVHFInt) +{ + QChar mode = '0'; + if(band=="A") { + if(MHzVHFInt == 50) mode = '0'; + else if(MHzVHFInt == 51) mode = '1'; + else if(MHzVHFInt == 52) mode = '2'; + else if(MHzVHFInt == 53) mode = '3'; + } else if(band=="B") { + if(MHzVHFInt == 144) mode = '4'; + else if(MHzVHFInt == 145) mode = '5'; + else if(MHzVHFInt == 146) mode = '6'; + else if(MHzVHFInt == 147) mode = '7'; + } else if(band=="C") { + if(configuration_->region() ==2) { + if(MHzVHFInt == 222) mode = '2'; + else if(MHzVHFInt == 223) mode = '3'; + } + else { //not region 2 + mode = '0'; + } + } else if(band=="D") { + if(configuration_->region() ==2) { + if(MHzVHFInt == 440) mode = '0'; + else if(MHzVHFInt == 441) mode = '1'; + else if(MHzVHFInt == 442) mode = '2'; + else if(MHzVHFInt == 443) mode = '3'; + else if(MHzVHFInt == 444) mode = '4'; + else if(MHzVHFInt == 445) mode = '5'; + else if(MHzVHFInt == 446) mode = '6'; + else if(MHzVHFInt == 447) mode = '7'; + else if(MHzVHFInt == 448) mode = '8'; + else if(MHzVHFInt == 449) mode = '9'; + } else { //not region 2 + if(MHzVHFInt == 430) mode = '0'; + else if(MHzVHFInt == 431) mode = '1'; + else if(MHzVHFInt == 432) mode = '2'; + else if(MHzVHFInt == 433) mode = '3'; + else if(MHzVHFInt == 434) mode = '4'; + else if(MHzVHFInt == 435) mode = '5'; + else if(MHzVHFInt == 436) mode = '6'; + else if(MHzVHFInt == 437) mode = '7'; + else if(MHzVHFInt == 438) mode = '8'; + else if(MHzVHFInt == 439) mode = '9'; + } + } else if(band=="E") { + if(MHzVHFInt == 1290) mode = '0'; + else if(MHzVHFInt == 1291) mode = '1'; + else if(MHzVHFInt == 1292) mode = '2'; + else if(MHzVHFInt == 1293) mode = '3'; + else if(MHzVHFInt == 1294) mode = '4'; + else if(MHzVHFInt == 1295) mode = '5'; + else if(MHzVHFInt == 1296) mode = '6'; + else if(MHzVHFInt == 1297) mode = '7'; + else if(MHzVHFInt == 1298) mode = '8'; + else if(MHzVHFInt == 1299) mode = '9'; + } + return mode; +} + +QChar QSYMessageCreator::getMode(QString band,int region) +{ + QChar mode; + qDebug() << "band" << band; + qDebug() << "band" << region; + + if(ui->tabWidget->currentIndex() == 1) { + ui->label_2_FM->setHidden(true); + ui->fmSpinBox->setHidden(true); + if (ui->radioButFM->isChecked()) { + if ((band =="A" || band == "B" || band == "C" || band == "D" || band == "E") && (configuration_->region () > 0)) { + if(configuration_->region () !=2 &&(band=="C")) { + ui->label_2_FM->setHidden(true); + ui->fmSpinBox->setHidden(true); + mode = '0'; + } else { + ui->label_2_FM->setText("Region " + QString::number(configuration_->region()) + " MHz"); + ui->label_2_FM->setHidden(false); + ui->fmSpinBox->setHidden(false); + if((ui->fmSpinBox->text().toInt() < getBandEdge(band)) || ((band=="A" ) && (initVHFMode.isLetter()))) { + initVHFMode='0'; + setupfmSpinBox(band); + if(firstTime) { + firstTime = false; + if(region ==2) { + if(band=="A") { + ui->fmSpinBox->setRange(50,53); + ui->fmSpinBox->setValue(52); + ui->kHzBox->setValue(525); + } else if(band=="B") { + ui->fmSpinBox->setRange(144,147); + ui->fmSpinBox->setValue(146); + ui->kHzBox->setValue(520); + } else if(band=="C") { + ui->fmSpinBox->setRange(222,223); + ui->fmSpinBox->setValue(223); + ui->kHzBox->setValue(500); + } else if(band=="D") { + ui->fmSpinBox->setRange(440,449); + ui->fmSpinBox->setValue(446); + ui->kHzBox->setValue(000); + } else if(band=="E") { + ui->fmSpinBox->setRange(1290,1299); + ui->fmSpinBox->setValue(1294); + ui->kHzBox->setValue(000); + } + } else { + if(band=="A") { + ui->fmSpinBox->setRange(50,53); + ui->fmSpinBox->setValue(50); + ui->kHzBox->setValue(800); + } else if(band=="B") { + ui->fmSpinBox->setRange(144,145); + ui->fmSpinBox->setValue(145); + ui->kHzBox->setValue(500); + } else if(band=="D") { + ui->fmSpinBox->setRange(430,439); + ui->fmSpinBox->setValue(433); + ui->kHzBox->setValue(650); + } else if(band=="E") { + ui->fmSpinBox->setRange(1290,1299); + ui->fmSpinBox->setValue(1297); + ui->kHzBox->setValue(500); + } + } + } + } + mode = modeFromSpinBox(band, ui->fmSpinBox->value()); + } + } else { + ui->label_2_FM->setHidden(true); + ui->fmSpinBox->setHidden(true); + mode='0'; + } + } + else if (ui->radioButSSB->isChecked()) { + mode = 'V'; + } + else if (ui->radioButCW->isChecked()) { + mode = 'W'; + } + else if (ui->radioButFT8->isChecked()) { + mode = 'L'; + } + else if (ui->radioButMSK->isChecked()) { + mode = 'K'; + } else mode = 'V'; + setmodeVHF(mode); + } else if(ui->tabWidget->currentIndex() == 0) { + if (ui->radioButSSB2->isChecked()) { + mode = 'V'; + } + else if (ui->radioButFM2->isChecked()) { + mode = '0'; + } + else if (ui->radioButCW2->isChecked()) { + mode = 'W'; + } + else if (ui->radioButFT82->isChecked()) { + mode = 'L'; + } + else if (ui->radioButFT4->isChecked()) { + mode = 'J'; + } + else if (ui->radioButJT9->isChecked()) { + mode = 'A'; + } + else if (ui->radioButJT65->isChecked()) { + mode = 'B'; + } + else if (ui->radioButFST4->isChecked()) { + mode = 'C'; + } else mode = 'V'; + setmodeHF(mode); + } else if(ui->tabWidget->currentIndex() == 2) { + if (ui->radioButQ6530B->isChecked()) { + mode = 'D'; + } + else if (ui->radioButQ6560C->isChecked()) { + mode = 'E'; + } + else if (ui->radioButCW3->isChecked()) { + mode = 'W'; + } + else if (ui->radioButQ6560D->isChecked()) { + mode = 'F'; + } + else if (ui->radioButQ6560E->isChecked()) { + mode = 'G'; + } + else if (ui->radioButQ65120D->isChecked()) { + mode = 'H'; + } else mode = 'V'; + setmodeEME(mode); + } + return mode; +} + +int QSYMessageCreator::getBandEdge(QString band) { + if(band=="A") return 50; + else if(band=="B") return 144; + else if(band=="C") return 222; + else if(band=="D") return 430; + else if(band=="E") return 1290; + else return 50; +} + +void QSYMessageCreator::send_message(const QString message) { + Q_EMIT sendMessage(message); +} + +void QSYMessageCreator::write_settings () +{ + SettingsGroup g (settings_, "QSYMessageCreator"); + settings_->setValue ("window/pos", pos ()); + settings_->setValue ("whichTab", ui->tabWidget->currentIndex()); + settings_->setValue ("bandVHF", getbandVHF()); + settings_->setValue ("modeVHF", getmodeVHF()); + settings_->setValue ("kHzVHF", getkHzVHF()); + settings_->setValue ("bandHF", getbandHF()); + settings_->setValue ("modeHF", getmodeHF()); + settings_->setValue ("kHzHF", getkHzHF()); + settings_->setValue ("bandEME", getbandEME()); + settings_->setValue ("modeEME", getmodeEME()); + settings_->setValue ("kHzEME", getkHzEME()); + QByteArray data; + QDataStream *stream = new QDataStream(&data, QIODevice::WriteOnly); + *stream << kHzFreqMap; + settings_->setValue("kHzFreqMap", data); + QByteArray data2; + QDataStream *stream2 = new QDataStream(&data2, QIODevice::WriteOnly); + *stream2 << MHzFreqMap; + settings_->setValue("MHzFreqMap", data2); + delete stream; + delete stream2; +} diff --git a/widgets/QSYMessageCreator.h b/widgets/QSYMessageCreator.h index 2c5c0137..7d9db48b 100755..100644 --- a/widgets/QSYMessageCreator.h +++ b/widgets/QSYMessageCreator.h @@ -1,131 +1,131 @@ -// -*- Mode: C++ -*-
-#ifndef QSYMESSAGECREATOR_H
-#define QSYMESSAGECREATOR_H
-#include <QWidget>
-#include <QObject>
-#include <QCloseEvent>
-#include <QTabWidget>
-#include <QMap>
-
-class QSettings;
-class Configuration;
-namespace Ui {
- class QSYMessageCreator;
-}
-
-class QSYMessageCreator
- : public QWidget
-{
- Q_OBJECT
- Q_PROPERTY(int kHzVHF READ getkHzVHF WRITE setkHzVHF)
- Q_PROPERTY(QString bandVHF READ getbandVHF WRITE setbandVHF)
- Q_PROPERTY(QChar modeVHF READ getmodeVHF WRITE setmodeVHF)
- Q_PROPERTY(int kHzHF READ getkHzHF WRITE setkHzHF)
- Q_PROPERTY(QString bandHF READ getbandHF WRITE setbandHF)
- Q_PROPERTY(QChar modeHF READ getmodeHF WRITE setmodeHF)
- Q_PROPERTY(int kHzEME READ getkHzEME WRITE setkHzEME)
- Q_PROPERTY(QString bandEME READ getbandEME WRITE setbandEME)
- Q_PROPERTY(QChar modeEME READ getmodeEME WRITE setmodeEME)
-
-public:
- explicit QSYMessageCreator(QSettings * settings, Configuration const *, QWidget * parent = 0);
- ~QSYMessageCreator();
- QString WriteMessage(QString call, QString band, QChar mode);
- QString bandVHF;
- QChar modeVHF;
- int kHzVHF;
- QString bandHF;
- QChar modeHF;
- int kHzHF;
- QString bandEME;
- QChar modeEME;
- int kHzEME;
- int MHzVHFInt;
- bool firstTime = true;
- QChar initVHFMode;
-
- QString getbandVHF () const {return m_bandVHF;}
- QChar getmodeVHF () const {return m_modeVHF;}
- int getkHzVHF () const {return m_kHzVHF;}
- QString getbandHF () const {return m_bandHF;}
- QChar getmodeHF () const {return m_modeHF;}
- int getkHzHF () const {return m_kHzHF;}
- QString getbandEME () const {return m_bandEME;}
- QChar getmodeEME () const {return m_modeEME;}
- int getkHzEME () const {return m_kHzEME;}
-
- void setbandVHF (QString bandVHF) {m_bandVHF = bandVHF;}
- void setmodeVHF (QChar modeVHF) { m_modeVHF = modeVHF;}
- void setkHzVHF (int kHzVHF) {m_kHzVHF = kHzVHF;}
- void setbandHF (QString bandHF) {m_bandHF = bandHF;}
- void setmodeHF (QChar modeHF) { m_modeHF = modeHF;}
- void setkHzHF (int kHzHF) {m_kHzHF = kHzHF;}
- void setbandEME (QString bandEME) {m_bandEME = bandEME;}
- void setmodeEME (QChar modeEME) { m_modeEME = modeEME;}
- void setkHzEME (int kHzEME) {m_kHzEME = kHzEME;}
- QChar modeFromSpinBox (QString band, int MHzVHFInt);
- void setupfmSpinBox(QString band);
- void setMode(QString band, QChar mode, int region);
- QChar getMode(QString band, int region);
- int getBandEdge(QString band);
-
- QMap<QPair<QString, QChar>, int> kHzFreqMap;
- QMap<QString,int> MHzFreqMap;
-
- QTabWidget tabWidget;
-
- Q_SLOT void getDxBase(QString value);
-
-protected:
- void showEvent(QShowEvent *event) override {
- QWidget::showEvent(event); // Call the base class implementation
- }
- void closeEvent(QCloseEvent *event) override;
-
-signals:
- void sendMessage(const QString &value);
- void sendChkBoxChange(const bool &value);
- void sendQSYMessageCreatorStatus(const bool &value);
-
-private:
- QSettings * settings_;
- Configuration const * configuration_;
- Ui::QSYMessageCreator *ui;
- QString getBand();
- void setBand(QString band);
- void setup();
-
- int m_kHzVHF = 123;
- QString m_bandVHF = "D";
- QChar m_modeVHF = 'V';
- int m_kHzHF = 123;
- QString m_bandHF = "D";
- QChar m_modeHF = 'V';
- int m_kHzEME = 123;
- QString m_bandEME = "D";
- QChar m_modeEME = 'V';
-
- void read_settings();
- void write_settings();
- void send_message(const QString message);
- QString getGenMessage();
-
-
-private slots:
- void onTabChanged();
- void on_genButton_clicked();
- void setkHzBox(QString theBand, QChar theMode, int tabNum);//, QMap<QPair<QString,QString>,int> kHzFreqMap);
- void on_button1_clicked();
- void on_button2_clicked();
- void on_button3_clicked();
- void on_saveMHzButton_clicked();
- void on_saveMHzButton_2_clicked();
- void on_saveMHzButton_3_clicked();
- void setQSYMessageCreatorStatusFalse();
- void onfmSpinBoxValueChanged();
- void onkHzBoxValueChanged();
- void onkHzBox2ValueChanged();
- void onkHzBox3ValueChanged();
-};
-
-#endif //QSYMESSAGECREATOR_H
+// -*- Mode: C++ -*- +#ifndef QSYMESSAGECREATOR_H +#define QSYMESSAGECREATOR_H +#include <QWidget> +#include <QObject> +#include <QCloseEvent> +#include <QTabWidget> +#include <QMap> + +class QSettings; +class Configuration; +namespace Ui { + class QSYMessageCreator; +} + +class QSYMessageCreator + : public QWidget +{ + Q_OBJECT + Q_PROPERTY(int kHzVHF READ getkHzVHF WRITE setkHzVHF) + Q_PROPERTY(QString bandVHF READ getbandVHF WRITE setbandVHF) + Q_PROPERTY(QChar modeVHF READ getmodeVHF WRITE setmodeVHF) + Q_PROPERTY(int kHzHF READ getkHzHF WRITE setkHzHF) + Q_PROPERTY(QString bandHF READ getbandHF WRITE setbandHF) + Q_PROPERTY(QChar modeHF READ getmodeHF WRITE setmodeHF) + Q_PROPERTY(int kHzEME READ getkHzEME WRITE setkHzEME) + Q_PROPERTY(QString bandEME READ getbandEME WRITE setbandEME) + Q_PROPERTY(QChar modeEME READ getmodeEME WRITE setmodeEME) + +public: + explicit QSYMessageCreator(QSettings * settings, Configuration const *, QWidget * parent = 0); + ~QSYMessageCreator(); + QString WriteMessage(QString call, QString band, QChar mode); + QString bandVHF; + QChar modeVHF; + int kHzVHF; + QString bandHF; + QChar modeHF; + int kHzHF; + QString bandEME; + QChar modeEME; + int kHzEME; + int MHzVHFInt; + bool firstTime = true; + QChar initVHFMode; + + QString getbandVHF () const {return m_bandVHF;} + QChar getmodeVHF () const {return m_modeVHF;} + int getkHzVHF () const {return m_kHzVHF;} + QString getbandHF () const {return m_bandHF;} + QChar getmodeHF () const {return m_modeHF;} + int getkHzHF () const {return m_kHzHF;} + QString getbandEME () const {return m_bandEME;} + QChar getmodeEME () const {return m_modeEME;} + int getkHzEME () const {return m_kHzEME;} + + void setbandVHF (QString bandVHF) {m_bandVHF = bandVHF;} + void setmodeVHF (QChar modeVHF) { m_modeVHF = modeVHF;} + void setkHzVHF (int kHzVHF) {m_kHzVHF = kHzVHF;} + void setbandHF (QString bandHF) {m_bandHF = bandHF;} + void setmodeHF (QChar modeHF) { m_modeHF = modeHF;} + void setkHzHF (int kHzHF) {m_kHzHF = kHzHF;} + void setbandEME (QString bandEME) {m_bandEME = bandEME;} + void setmodeEME (QChar modeEME) { m_modeEME = modeEME;} + void setkHzEME (int kHzEME) {m_kHzEME = kHzEME;} + QChar modeFromSpinBox (QString band, int MHzVHFInt); + void setupfmSpinBox(QString band); + void setMode(QString band, QChar mode, int region); + QChar getMode(QString band, int region); + int getBandEdge(QString band); + + QMap<QPair<QString, QChar>, int> kHzFreqMap; + QMap<QString,int> MHzFreqMap; + + QTabWidget tabWidget; + + Q_SLOT void getDxBase(QString value); + +protected: + void showEvent(QShowEvent *event) override { + QWidget::showEvent(event); // Call the base class implementation + } + void closeEvent(QCloseEvent *event) override; + +signals: + void sendMessage(const QString &value); + void sendChkBoxChange(const bool &value); + void sendQSYMessageCreatorStatus(const bool &value); + +private: + QSettings * settings_; + Configuration const * configuration_; + Ui::QSYMessageCreator *ui; + QString getBand(); + void setBand(QString band); + void setup(); + + int m_kHzVHF = 123; + QString m_bandVHF = "D"; + QChar m_modeVHF = 'V'; + int m_kHzHF = 123; + QString m_bandHF = "D"; + QChar m_modeHF = 'V'; + int m_kHzEME = 123; + QString m_bandEME = "D"; + QChar m_modeEME = 'V'; + + void read_settings(); + void write_settings(); + void send_message(const QString message); + QString getGenMessage(); + + +private slots: + void onTabChanged(); + void on_genButton_clicked(); + void setkHzBox(QString theBand, QChar theMode, int tabNum);//, QMap<QPair<QString,QString>,int> kHzFreqMap); + void on_button1_clicked(); + void on_button2_clicked(); + void on_button3_clicked(); + void on_saveMHzButton_clicked(); + void on_saveMHzButton_2_clicked(); + void on_saveMHzButton_3_clicked(); + void setQSYMessageCreatorStatusFalse(); + void onfmSpinBoxValueChanged(); + void onkHzBoxValueChanged(); + void onkHzBox2ValueChanged(); + void onkHzBox3ValueChanged(); +}; + +#endif //QSYMESSAGECREATOR_H diff --git a/widgets/QSYMessageCreator.ui b/widgets/QSYMessageCreator.ui index 4bd51bee..2b49e697 100755..100644 --- a/widgets/QSYMessageCreator.ui +++ b/widgets/QSYMessageCreator.ui @@ -1,2212 +1,2212 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>QSYMessageCreator</class>
- <widget class="QWidget" name="QSYMessageCreator">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>315</width>
- <height>385</height>
- </rect>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="windowTitle">
- <string>Message Creator</string>
- </property>
- <layout class="QGridLayout" name="gridLayout" rowstretch="0,0,0">
- <property name="leftMargin">
- <number>6</number>
- </property>
- <property name="topMargin">
- <number>6</number>
- </property>
- <property name="rightMargin">
- <number>6</number>
- </property>
- <property name="bottomMargin">
- <number>6</number>
- </property>
- <property name="horizontalSpacing">
- <number>3</number>
- </property>
- <property name="verticalSpacing">
- <number>0</number>
- </property>
- <item row="2" column="0">
- <widget class="QTabWidget" name="tabWidget">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="currentIndex">
- <number>0</number>
- </property>
- <widget class="QWidget" name="tab_HF">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="windowTitle">
- <string/>
- </property>
- <attribute name="title">
- <string>HF</string>
- </attribute>
- <layout class="QGridLayout" name="gridLayout_5">
- <property name="leftMargin">
- <number>6</number>
- </property>
- <property name="topMargin">
- <number>6</number>
- </property>
- <property name="rightMargin">
- <number>6</number>
- </property>
- <property name="bottomMargin">
- <number>6</number>
- </property>
- <property name="horizontalSpacing">
- <number>3</number>
- </property>
- <property name="verticalSpacing">
- <number>0</number>
- </property>
- <item row="1" column="2" rowspan="5" colspan="2">
- <widget class="QGroupBox" name="groupBox_4">
- <property name="title">
- <string/>
- </property>
- <property name="alignment">
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <property name="spacing">
- <number>0</number>
- </property>
- <property name="leftMargin">
- <number>6</number>
- </property>
- <property name="topMargin">
- <number>6</number>
- </property>
- <property name="rightMargin">
- <number>6</number>
- </property>
- <property name="bottomMargin">
- <number>6</number>
- </property>
- <item>
- <widget class="QRadioButton" name="radioButSSB2">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>SSB</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioButCW2">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>CW</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioButFM2">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>FM</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioButFST4">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>FST4</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioButFT4">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>FT4</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioButFT82">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>FT8</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioButJT9">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>JT9</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioButJT65">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>JT65</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item row="6" column="2" colspan="2">
- <layout class="QVBoxLayout" name="verticalLayout_9">
- <item>
- <widget class="QLabel" name="label82">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="text">
- <string>Message</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="messageLabel2">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="autoFillBackground">
- <bool>false</bool>
- </property>
- <property name="frameShape">
- <enum>QFrame::Panel</enum>
- </property>
- <property name="frameShadow">
- <enum>QFrame::Sunken</enum>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer_4">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Fixed</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>10</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- <item row="1" column="0" rowspan="6" colspan="2">
- <widget class="QGroupBox" name="groupBox_3">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="title">
- <string/>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <property name="spacing">
- <number>0</number>
- </property>
- <property name="leftMargin">
- <number>6</number>
- </property>
- <property name="topMargin">
- <number>6</number>
- </property>
- <property name="rightMargin">
- <number>6</number>
- </property>
- <property name="bottomMargin">
- <number>6</number>
- </property>
- <item>
- <widget class="QRadioButton" name="radioBut630M">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>630 M</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioBut160M">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>160 M</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioBut80M">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>80 M</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioBut60M">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>60 M</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioBut40M">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>40 M</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioBut30M">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>30 M</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioBut20M">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>20 M</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioBut17M">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>17 M</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioBut15M">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>15 M</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioBut12M">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>12 M</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioBut10M1">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>28 MHz</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioBut10M2">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>29 MHz</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item row="0" column="2">
- <widget class="QLabel" name="label_72">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="text">
- <string>Mode</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="0" column="0">
- <widget class="QLabel" name="label_62">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="text">
- <string>Band</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="8" column="1" colspan="3">
- <layout class="QGridLayout" name="gridLayout_13" rowminimumheight="0,0">
- <property name="verticalSpacing">
- <number>0</number>
- </property>
- <item row="1" column="1">
- <widget class="QSpinBox" name="kHzBox2">
- <property name="font">
- <font>
- <pointsize>10</pointsize>
- <bold>true</bold>
- </font>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <property name="maximum">
- <number>999</number>
- </property>
- <property name="value">
- <number>100</number>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QPushButton" name="saveMHzButton_2">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>SAVE</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QLabel" name="label_52">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="text">
- <string>kHz</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="1" column="2">
- <widget class="QPushButton" name="button2">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>30</height>
- </size>
- </property>
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="text">
- <string>Send
-Message</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="tab_VHF">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="windowTitle">
- <string/>
- </property>
- <attribute name="title">
- <string>VHF</string>
- </attribute>
- <layout class="QGridLayout" name="gridLayout_11">
- <property name="leftMargin">
- <number>6</number>
- </property>
- <property name="topMargin">
- <number>6</number>
- </property>
- <property name="rightMargin">
- <number>6</number>
- </property>
- <property name="bottomMargin">
- <number>6</number>
- </property>
- <property name="horizontalSpacing">
- <number>3</number>
- </property>
- <property name="verticalSpacing">
- <number>0</number>
- </property>
- <item row="0" column="0">
- <widget class="QLabel" name="label_6">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="text">
- <string>Band</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="0" column="2">
- <widget class="QLabel" name="label_7">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="text">
- <string>Mode</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="1" column="0" rowspan="9" colspan="2">
- <widget class="QGroupBox" name="groupBox">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="title">
- <string/>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_3">
- <property name="spacing">
- <number>0</number>
- </property>
- <property name="leftMargin">
- <number>6</number>
- </property>
- <property name="topMargin">
- <number>6</number>
- </property>
- <property name="rightMargin">
- <number>6</number>
- </property>
- <property name="bottomMargin">
- <number>6</number>
- </property>
- <item>
- <widget class="QRadioButton" name="radioBut50">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>50 MHz</string>
- </property>
- <property name="checked">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioBut144">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>144 MHz</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioBut222">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>222 MHz</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioBut432">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>432 MHz</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioBut902">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>902 MHz</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioBut903">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>903 MHz</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioBut1296">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>1296 MHz</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioBut2304">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>2304 MHz</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioBut3400">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>3400 MHz</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioBut5760">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>5760 MHz</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioBut10368">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>10368 MHz</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioBut24192">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>24192 MHz</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="Line" name="line">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioBut40">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>40 MHz</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioBut70">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>70 MHz</string>
- </property>
- <property name="checked">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item row="1" column="2" rowspan="4" colspan="2">
- <widget class="QGroupBox" name="groupBox_2">
- <property name="title">
- <string/>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_4">
- <property name="spacing">
- <number>0</number>
- </property>
- <property name="leftMargin">
- <number>6</number>
- </property>
- <property name="topMargin">
- <number>6</number>
- </property>
- <property name="rightMargin">
- <number>6</number>
- </property>
- <property name="bottomMargin">
- <number>6</number>
- </property>
- <item>
- <widget class="QRadioButton" name="radioButSSB">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>SSB</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioButCW">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>CW</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioButFM">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>FM</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioButFT8">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>FT8</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioButMSK">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>MSK144</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item row="5" column="2" rowspan="5" colspan="2">
- <layout class="QGridLayout" name="gridLayout_14">
- <property name="verticalSpacing">
- <number>0</number>
- </property>
- <item row="2" column="1">
- <widget class="QPushButton" name="saveMHzButton">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>SAVE</string>
- </property>
- </widget>
- </item>
- <item row="8" column="0">
- <widget class="QSpinBox" name="kHzBox">
- <property name="font">
- <font>
- <pointsize>10</pointsize>
- <bold>true</bold>
- </font>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <property name="maximum">
- <number>999</number>
- </property>
- <property name="value">
- <number>100</number>
- </property>
- </widget>
- </item>
- <item row="6" column="0">
- <spacer name="verticalSpacer_7">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Fixed</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>15</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="2" column="0">
- <widget class="QSpinBox" name="fmSpinBox">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="palette">
- <palette>
- <active>
- <colorrole role="Highlight">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>170</red>
- <green>255</green>
- <blue>255</blue>
- </color>
- </brush>
- </colorrole>
- <colorrole role="HighlightedText">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>0</red>
- <green>0</green>
- <blue>0</blue>
- </color>
- </brush>
- </colorrole>
- </active>
- <inactive>
- <colorrole role="Highlight">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>170</red>
- <green>255</green>
- <blue>255</blue>
- </color>
- </brush>
- </colorrole>
- <colorrole role="HighlightedText">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>0</red>
- <green>0</green>
- <blue>0</blue>
- </color>
- </brush>
- </colorrole>
- </inactive>
- <disabled>
- <colorrole role="HighlightedText">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>0</red>
- <green>0</green>
- <blue>0</blue>
- </color>
- </brush>
- </colorrole>
- </disabled>
- </palette>
- </property>
- <property name="font">
- <font>
- <pointsize>12</pointsize>
- <bold>true</bold>
- </font>
- </property>
- <property name="styleSheet">
- <string notr="true"/>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <property name="minimum">
- <number>50</number>
- </property>
- <property name="maximum">
- <number>449</number>
- </property>
- <property name="value">
- <number>50</number>
- </property>
- </widget>
- </item>
- <item row="7" column="0">
- <widget class="QLabel" name="label_5">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="text">
- <string>kHz</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="8" column="1">
- <widget class="QPushButton" name="button1">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="text">
- <string>Send
-Message</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_2_FM">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="text">
- <string>FM MHz</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="4" column="0" colspan="2" alignment="Qt::AlignBottom">
- <widget class="QLabel" name="label">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="text">
- <string>Message</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="3" column="0">
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Fixed</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>15</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="5" column="0" colspan="2">
- <widget class="QLabel" name="messageLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="autoFillBackground">
- <bool>false</bool>
- </property>
- <property name="frameShape">
- <enum>QFrame::Panel</enum>
- </property>
- <property name="frameShadow">
- <enum>QFrame::Sunken</enum>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="0" column="0">
- <spacer name="verticalSpacer_8">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Fixed</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>10</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="tab_EME">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="windowTitle">
- <string/>
- </property>
- <attribute name="title">
- <string>EME</string>
- </attribute>
- <layout class="QGridLayout" name="gridLayout_2">
- <property name="leftMargin">
- <number>6</number>
- </property>
- <property name="topMargin">
- <number>6</number>
- </property>
- <property name="rightMargin">
- <number>6</number>
- </property>
- <property name="bottomMargin">
- <number>6</number>
- </property>
- <property name="horizontalSpacing">
- <number>3</number>
- </property>
- <property name="verticalSpacing">
- <number>0</number>
- </property>
- <item row="0" column="2">
- <widget class="QLabel" name="label_73">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="text">
- <string>Mode</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="1" column="0" rowspan="4" colspan="2">
- <widget class="QGroupBox" name="groupBox5">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="title">
- <string/>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_5">
- <property name="spacing">
- <number>0</number>
- </property>
- <property name="leftMargin">
- <number>6</number>
- </property>
- <property name="topMargin">
- <number>6</number>
- </property>
- <property name="rightMargin">
- <number>6</number>
- </property>
- <property name="bottomMargin">
- <number>6</number>
- </property>
- <item>
- <widget class="QRadioButton" name="radioBut50A">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>50 MHz</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioBut144A">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>144 MHz</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioBut222A">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>222 MHz</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioBut432A">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>432 MHz</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioBut902A">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>902 MHz</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioBut903A">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>903 MHz</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioBut1296A">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>1296 MHz</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioBut2304A">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>2304 MHz</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioBut3400A">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>3400 MHz</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioBut5760A">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>5760 MHz</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioBut10368A">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>10368 MHz</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioBut24048">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>24048 MHz</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item row="6" column="1" colspan="3">
- <layout class="QGridLayout" name="gridLayout_15">
- <property name="verticalSpacing">
- <number>3</number>
- </property>
- <item row="1" column="1">
- <widget class="QSpinBox" name="kHzBox3">
- <property name="font">
- <font>
- <pointsize>10</pointsize>
- <bold>true</bold>
- </font>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <property name="maximum">
- <number>999</number>
- </property>
- <property name="value">
- <number>100</number>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QPushButton" name="saveMHzButton_3">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>SAVE</string>
- </property>
- </widget>
- </item>
- <item row="1" column="2">
- <widget class="QPushButton" name="button3">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="text">
- <string>Send
-Message</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QLabel" name="label_53">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="text">
- <string>kHz</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="4" column="2" colspan="2">
- <layout class="QVBoxLayout" name="verticalLayout_8">
- <item>
- <widget class="QLabel" name="label33">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="text">
- <string>Message</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="messageLabel3">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="autoFillBackground">
- <bool>false</bool>
- </property>
- <property name="frameShape">
- <enum>QFrame::Panel</enum>
- </property>
- <property name="frameShadow">
- <enum>QFrame::Sunken</enum>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer_6">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Fixed</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- <item row="1" column="2" rowspan="3" colspan="2">
- <widget class="QGroupBox" name="groupBox_6">
- <property name="title">
- <string/>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_6">
- <property name="spacing">
- <number>0</number>
- </property>
- <property name="leftMargin">
- <number>6</number>
- </property>
- <property name="topMargin">
- <number>6</number>
- </property>
- <property name="rightMargin">
- <number>6</number>
- </property>
- <property name="bottomMargin">
- <number>6</number>
- </property>
- <item>
- <widget class="QRadioButton" name="radioButQ6530B">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>Q65-30B</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioButQ6560C">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>Q65-60C</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioButQ6560D">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>Q65-60D</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioButQ6560E">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>Q65-60E</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioButQ65120D">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>Q65-120D</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioButCW3">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="accessibleName">
- <string/>
- </property>
- <property name="text">
- <string>CW</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item row="0" column="0">
- <widget class="QLabel" name="label_63">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="text">
- <string>Band</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="tab_MSG">
- <attribute name="title">
- <string>General</string>
- </attribute>
- <layout class="QGridLayout" name="gridLayout_12">
- <property name="leftMargin">
- <number>6</number>
- </property>
- <property name="topMargin">
- <number>6</number>
- </property>
- <property name="rightMargin">
- <number>6</number>
- </property>
- <property name="bottomMargin">
- <number>6</number>
- </property>
- <property name="horizontalSpacing">
- <number>3</number>
- </property>
- <property name="verticalSpacing">
- <number>0</number>
- </property>
- <item row="1" column="0" colspan="2">
- <widget class="QGroupBox" name="groupBox_5">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="title">
- <string/>
- </property>
- <layout class="QGridLayout" name="gridLayout_8">
- <property name="leftMargin">
- <number>6</number>
- </property>
- <property name="topMargin">
- <number>6</number>
- </property>
- <property name="rightMargin">
- <number>6</number>
- </property>
- <property name="bottomMargin">
- <number>6</number>
- </property>
- <property name="verticalSpacing">
- <number>0</number>
- </property>
- <item row="1" column="0">
- <widget class="QRadioButton" name="message2">
- <property name="text">
- <string>Please call me by phone</string>
- </property>
- </widget>
- </item>
- <item row="11" column="0">
- <widget class="QRadioButton" name="message12">
- <property name="text">
- <string>Please check Ping Jockey</string>
- </property>
- </widget>
- </item>
- <item row="0" column="0">
- <widget class="QRadioButton" name="message1">
- <property name="text">
- <string>You are in the log</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="5" column="0">
- <widget class="QRadioButton" name="message6">
- <property name="text">
- <string>You are transmitting in the wrong time slot</string>
- </property>
- </widget>
- </item>
- <item row="3" column="0">
- <widget class="QRadioButton" name="message4">
- <property name="text">
- <string>You are not in Contest Mode</string>
- </property>
- </widget>
- </item>
- <item row="8" column="0">
- <widget class="QRadioButton" name="message9">
- <property name="text">
- <string>Your audio is distorted</string>
- </property>
- </widget>
- </item>
- <item row="7" column="0">
- <widget class="QRadioButton" name="message8">
- <property name="text">
- <string>Your transmitter is overmodulated</string>
- </property>
- </widget>
- </item>
- <item row="12" column="0">
- <widget class="QRadioButton" name="message13">
- <property name="text">
- <string>Please check ON4KST</string>
- </property>
- </widget>
- </item>
- <item row="6" column="0">
- <widget class="QRadioButton" name="message7">
- <property name="text">
- <string>Please transmit above 1000 Hz</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QRadioButton" name="message3">
- <property name="text">
- <string>Check your email</string>
- </property>
- </widget>
- </item>
- <item row="10" column="0">
- <widget class="QRadioButton" name="message11">
- <property name="text">
- <string>Please check HB9Q Logger</string>
- </property>
- </widget>
- </item>
- <item row="4" column="0">
- <widget class="QRadioButton" name="message5">
- <property name="text">
- <string>Please check your PC Clock</string>
- </property>
- </widget>
- </item>
- <item row="9" column="0">
- <widget class="QRadioButton" name="message10">
- <property name="text">
- <string>You are transmitting on top of a rare DX station</string>
- </property>
- </widget>
- </item>
- <item row="13" column="0">
- <widget class="QRadioButton" name="message14">
- <property name="text">
- <string>Please QSL via LoTW</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item row="2" column="0">
- <layout class="QHBoxLayout" name="horizontalLayout" stretch="1,0,3,2">
- <item>
- <widget class="QLabel" name="label33_2">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="text">
- <string>Message</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="DxBaseLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>0</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="messageLabel4">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="autoFillBackground">
- <bool>false</bool>
- </property>
- <property name="frameShape">
- <enum>QFrame::Panel</enum>
- </property>
- <property name="frameShadow">
- <enum>QFrame::Sunken</enum>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="genButton">
- <property name="font">
- <font>
- <bold>true</bold>
- </font>
- </property>
- <property name="text">
- <string>Send Message</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
+<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>QSYMessageCreator</class> + <widget class="QWidget" name="QSYMessageCreator"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>315</width> + <height>385</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + <property name="windowTitle"> + <string>Message Creator</string> + </property> + <layout class="QGridLayout" name="gridLayout" rowstretch="0,0,0"> + <property name="leftMargin"> + <number>6</number> + </property> + <property name="topMargin"> + <number>6</number> + </property> + <property name="rightMargin"> + <number>6</number> + </property> + <property name="bottomMargin"> + <number>6</number> + </property> + <property name="horizontalSpacing"> + <number>3</number> + </property> + <property name="verticalSpacing"> + <number>0</number> + </property> + <item row="2" column="0"> + <widget class="QTabWidget" name="tabWidget"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="currentIndex"> + <number>0</number> + </property> + <widget class="QWidget" name="tab_HF"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + <property name="windowTitle"> + <string/> + </property> + <attribute name="title"> + <string>HF</string> + </attribute> + <layout class="QGridLayout" name="gridLayout_5"> + <property name="leftMargin"> + <number>6</number> + </property> + <property name="topMargin"> + <number>6</number> + </property> + <property name="rightMargin"> + <number>6</number> + </property> + <property name="bottomMargin"> + <number>6</number> + </property> + <property name="horizontalSpacing"> + <number>3</number> + </property> + <property name="verticalSpacing"> + <number>0</number> + </property> + <item row="1" column="2" rowspan="5" colspan="2"> + <widget class="QGroupBox" name="groupBox_4"> + <property name="title"> + <string/> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> + </property> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <property name="spacing"> + <number>0</number> + </property> + <property name="leftMargin"> + <number>6</number> + </property> + <property name="topMargin"> + <number>6</number> + </property> + <property name="rightMargin"> + <number>6</number> + </property> + <property name="bottomMargin"> + <number>6</number> + </property> + <item> + <widget class="QRadioButton" name="radioButSSB2"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>SSB</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioButCW2"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>CW</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioButFM2"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>FM</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioButFST4"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>FST4</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioButFT4"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>FT4</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioButFT82"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>FT8</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioButJT9"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>JT9</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioButJT65"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>JT65</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="6" column="2" colspan="2"> + <layout class="QVBoxLayout" name="verticalLayout_9"> + <item> + <widget class="QLabel" name="label82"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>Message</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="messageLabel2"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <property name="frameShape"> + <enum>QFrame::Panel</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Sunken</enum> + </property> + <property name="text"> + <string/> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item> + <spacer name="verticalSpacer_4"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Fixed</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>10</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item row="1" column="0" rowspan="6" colspan="2"> + <widget class="QGroupBox" name="groupBox_3"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string/> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <property name="spacing"> + <number>0</number> + </property> + <property name="leftMargin"> + <number>6</number> + </property> + <property name="topMargin"> + <number>6</number> + </property> + <property name="rightMargin"> + <number>6</number> + </property> + <property name="bottomMargin"> + <number>6</number> + </property> + <item> + <widget class="QRadioButton" name="radioBut630M"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>630 M</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioBut160M"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>160 M</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioBut80M"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>80 M</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioBut60M"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>60 M</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioBut40M"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>40 M</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioBut30M"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>30 M</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioBut20M"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>20 M</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioBut17M"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>17 M</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioBut15M"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>15 M</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioBut12M"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>12 M</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioBut10M1"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>28 MHz</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioBut10M2"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>29 MHz</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="0" column="2"> + <widget class="QLabel" name="label_72"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>Mode</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="label_62"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>Band</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="8" column="1" colspan="3"> + <layout class="QGridLayout" name="gridLayout_13" rowminimumheight="0,0"> + <property name="verticalSpacing"> + <number>0</number> + </property> + <item row="1" column="1"> + <widget class="QSpinBox" name="kHzBox2"> + <property name="font"> + <font> + <pointsize>10</pointsize> + <bold>true</bold> + </font> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="maximum"> + <number>999</number> + </property> + <property name="value"> + <number>100</number> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QPushButton" name="saveMHzButton_2"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>SAVE</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLabel" name="label_52"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>kHz</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QPushButton" name="button2"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>30</height> + </size> + </property> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>Send +Message</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <widget class="QWidget" name="tab_VHF"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + <property name="windowTitle"> + <string/> + </property> + <attribute name="title"> + <string>VHF</string> + </attribute> + <layout class="QGridLayout" name="gridLayout_11"> + <property name="leftMargin"> + <number>6</number> + </property> + <property name="topMargin"> + <number>6</number> + </property> + <property name="rightMargin"> + <number>6</number> + </property> + <property name="bottomMargin"> + <number>6</number> + </property> + <property name="horizontalSpacing"> + <number>3</number> + </property> + <property name="verticalSpacing"> + <number>0</number> + </property> + <item row="0" column="0"> + <widget class="QLabel" name="label_6"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>Band</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QLabel" name="label_7"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>Mode</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="1" column="0" rowspan="9" colspan="2"> + <widget class="QGroupBox" name="groupBox"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string/> + </property> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <property name="spacing"> + <number>0</number> + </property> + <property name="leftMargin"> + <number>6</number> + </property> + <property name="topMargin"> + <number>6</number> + </property> + <property name="rightMargin"> + <number>6</number> + </property> + <property name="bottomMargin"> + <number>6</number> + </property> + <item> + <widget class="QRadioButton" name="radioBut50"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>50 MHz</string> + </property> + <property name="checked"> + <bool>false</bool> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioBut144"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>144 MHz</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioBut222"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>222 MHz</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioBut432"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>432 MHz</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioBut902"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>902 MHz</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioBut903"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>903 MHz</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioBut1296"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>1296 MHz</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioBut2304"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>2304 MHz</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioBut3400"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>3400 MHz</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioBut5760"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>5760 MHz</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioBut10368"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>10368 MHz</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioBut24192"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>24192 MHz</string> + </property> + </widget> + </item> + <item> + <widget class="Line" name="line"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioBut40"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>40 MHz</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioBut70"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>70 MHz</string> + </property> + <property name="checked"> + <bool>false</bool> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="1" column="2" rowspan="4" colspan="2"> + <widget class="QGroupBox" name="groupBox_2"> + <property name="title"> + <string/> + </property> + <layout class="QVBoxLayout" name="verticalLayout_4"> + <property name="spacing"> + <number>0</number> + </property> + <property name="leftMargin"> + <number>6</number> + </property> + <property name="topMargin"> + <number>6</number> + </property> + <property name="rightMargin"> + <number>6</number> + </property> + <property name="bottomMargin"> + <number>6</number> + </property> + <item> + <widget class="QRadioButton" name="radioButSSB"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>SSB</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioButCW"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>CW</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioButFM"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>FM</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioButFT8"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>FT8</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioButMSK"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>MSK144</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="5" column="2" rowspan="5" colspan="2"> + <layout class="QGridLayout" name="gridLayout_14"> + <property name="verticalSpacing"> + <number>0</number> + </property> + <item row="2" column="1"> + <widget class="QPushButton" name="saveMHzButton"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>SAVE</string> + </property> + </widget> + </item> + <item row="8" column="0"> + <widget class="QSpinBox" name="kHzBox"> + <property name="font"> + <font> + <pointsize>10</pointsize> + <bold>true</bold> + </font> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="maximum"> + <number>999</number> + </property> + <property name="value"> + <number>100</number> + </property> + </widget> + </item> + <item row="6" column="0"> + <spacer name="verticalSpacer_7"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Fixed</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>15</height> + </size> + </property> + </spacer> + </item> + <item row="2" column="0"> + <widget class="QSpinBox" name="fmSpinBox"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="palette"> + <palette> + <active> + <colorrole role="Highlight"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>170</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="HighlightedText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + </active> + <inactive> + <colorrole role="Highlight"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>170</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="HighlightedText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + </inactive> + <disabled> + <colorrole role="HighlightedText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + </disabled> + </palette> + </property> + <property name="font"> + <font> + <pointsize>12</pointsize> + <bold>true</bold> + </font> + </property> + <property name="styleSheet"> + <string notr="true"/> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="minimum"> + <number>50</number> + </property> + <property name="maximum"> + <number>449</number> + </property> + <property name="value"> + <number>50</number> + </property> + </widget> + </item> + <item row="7" column="0"> + <widget class="QLabel" name="label_5"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>kHz</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="8" column="1"> + <widget class="QPushButton" name="button1"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>Send +Message</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_2_FM"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>FM MHz</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="4" column="0" colspan="2" alignment="Qt::AlignBottom"> + <widget class="QLabel" name="label"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>Message</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="3" column="0"> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Fixed</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>15</height> + </size> + </property> + </spacer> + </item> + <item row="5" column="0" colspan="2"> + <widget class="QLabel" name="messageLabel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <property name="frameShape"> + <enum>QFrame::Panel</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Sunken</enum> + </property> + <property name="text"> + <string/> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="0" column="0"> + <spacer name="verticalSpacer_8"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Fixed</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>10</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + </layout> + </widget> + <widget class="QWidget" name="tab_EME"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + <property name="windowTitle"> + <string/> + </property> + <attribute name="title"> + <string>EME</string> + </attribute> + <layout class="QGridLayout" name="gridLayout_2"> + <property name="leftMargin"> + <number>6</number> + </property> + <property name="topMargin"> + <number>6</number> + </property> + <property name="rightMargin"> + <number>6</number> + </property> + <property name="bottomMargin"> + <number>6</number> + </property> + <property name="horizontalSpacing"> + <number>3</number> + </property> + <property name="verticalSpacing"> + <number>0</number> + </property> + <item row="0" column="2"> + <widget class="QLabel" name="label_73"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>Mode</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="1" column="0" rowspan="4" colspan="2"> + <widget class="QGroupBox" name="groupBox5"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string/> + </property> + <layout class="QVBoxLayout" name="verticalLayout_5"> + <property name="spacing"> + <number>0</number> + </property> + <property name="leftMargin"> + <number>6</number> + </property> + <property name="topMargin"> + <number>6</number> + </property> + <property name="rightMargin"> + <number>6</number> + </property> + <property name="bottomMargin"> + <number>6</number> + </property> + <item> + <widget class="QRadioButton" name="radioBut50A"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>50 MHz</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioBut144A"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>144 MHz</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioBut222A"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>222 MHz</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioBut432A"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>432 MHz</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioBut902A"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>902 MHz</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioBut903A"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>903 MHz</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioBut1296A"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>1296 MHz</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioBut2304A"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>2304 MHz</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioBut3400A"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>3400 MHz</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioBut5760A"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>5760 MHz</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioBut10368A"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>10368 MHz</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioBut24048"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>24048 MHz</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="6" column="1" colspan="3"> + <layout class="QGridLayout" name="gridLayout_15"> + <property name="verticalSpacing"> + <number>3</number> + </property> + <item row="1" column="1"> + <widget class="QSpinBox" name="kHzBox3"> + <property name="font"> + <font> + <pointsize>10</pointsize> + <bold>true</bold> + </font> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="maximum"> + <number>999</number> + </property> + <property name="value"> + <number>100</number> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QPushButton" name="saveMHzButton_3"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>SAVE</string> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QPushButton" name="button3"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>Send +Message</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLabel" name="label_53"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>kHz</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + </layout> + </item> + <item row="4" column="2" colspan="2"> + <layout class="QVBoxLayout" name="verticalLayout_8"> + <item> + <widget class="QLabel" name="label33"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>Message</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="messageLabel3"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <property name="frameShape"> + <enum>QFrame::Panel</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Sunken</enum> + </property> + <property name="text"> + <string/> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item> + <spacer name="verticalSpacer_6"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Fixed</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item row="1" column="2" rowspan="3" colspan="2"> + <widget class="QGroupBox" name="groupBox_6"> + <property name="title"> + <string/> + </property> + <layout class="QVBoxLayout" name="verticalLayout_6"> + <property name="spacing"> + <number>0</number> + </property> + <property name="leftMargin"> + <number>6</number> + </property> + <property name="topMargin"> + <number>6</number> + </property> + <property name="rightMargin"> + <number>6</number> + </property> + <property name="bottomMargin"> + <number>6</number> + </property> + <item> + <widget class="QRadioButton" name="radioButQ6530B"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>Q65-30B</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioButQ6560C"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>Q65-60C</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioButQ6560D"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>Q65-60D</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioButQ6560E"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>Q65-60E</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioButQ65120D"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>Q65-120D</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioButCW3"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="text"> + <string>CW</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="label_63"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>Band</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="tab_MSG"> + <attribute name="title"> + <string>General</string> + </attribute> + <layout class="QGridLayout" name="gridLayout_12"> + <property name="leftMargin"> + <number>6</number> + </property> + <property name="topMargin"> + <number>6</number> + </property> + <property name="rightMargin"> + <number>6</number> + </property> + <property name="bottomMargin"> + <number>6</number> + </property> + <property name="horizontalSpacing"> + <number>3</number> + </property> + <property name="verticalSpacing"> + <number>0</number> + </property> + <item row="1" column="0" colspan="2"> + <widget class="QGroupBox" name="groupBox_5"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string/> + </property> + <layout class="QGridLayout" name="gridLayout_8"> + <property name="leftMargin"> + <number>6</number> + </property> + <property name="topMargin"> + <number>6</number> + </property> + <property name="rightMargin"> + <number>6</number> + </property> + <property name="bottomMargin"> + <number>6</number> + </property> + <property name="verticalSpacing"> + <number>0</number> + </property> + <item row="1" column="0"> + <widget class="QRadioButton" name="message2"> + <property name="text"> + <string>Please call me by phone</string> + </property> + </widget> + </item> + <item row="11" column="0"> + <widget class="QRadioButton" name="message12"> + <property name="text"> + <string>Please check Ping Jockey</string> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QRadioButton" name="message1"> + <property name="text"> + <string>You are in the log</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="5" column="0"> + <widget class="QRadioButton" name="message6"> + <property name="text"> + <string>You are transmitting in the wrong time slot</string> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QRadioButton" name="message4"> + <property name="text"> + <string>You are not in Contest Mode</string> + </property> + </widget> + </item> + <item row="8" column="0"> + <widget class="QRadioButton" name="message9"> + <property name="text"> + <string>Your audio is distorted</string> + </property> + </widget> + </item> + <item row="7" column="0"> + <widget class="QRadioButton" name="message8"> + <property name="text"> + <string>Your transmitter is overmodulated</string> + </property> + </widget> + </item> + <item row="12" column="0"> + <widget class="QRadioButton" name="message13"> + <property name="text"> + <string>Please check ON4KST</string> + </property> + </widget> + </item> + <item row="6" column="0"> + <widget class="QRadioButton" name="message7"> + <property name="text"> + <string>Please transmit above 1000 Hz</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QRadioButton" name="message3"> + <property name="text"> + <string>Check your email</string> + </property> + </widget> + </item> + <item row="10" column="0"> + <widget class="QRadioButton" name="message11"> + <property name="text"> + <string>Please check HB9Q Logger</string> + </property> + </widget> + </item> + <item row="4" column="0"> + <widget class="QRadioButton" name="message5"> + <property name="text"> + <string>Please check your PC Clock</string> + </property> + </widget> + </item> + <item row="9" column="0"> + <widget class="QRadioButton" name="message10"> + <property name="text"> + <string>You are transmitting on top of a rare DX station</string> + </property> + </widget> + </item> + <item row="13" column="0"> + <widget class="QRadioButton" name="message14"> + <property name="text"> + <string>Please QSL via LoTW</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="2" column="0"> + <layout class="QHBoxLayout" name="horizontalLayout" stretch="1,0,3,2"> + <item> + <widget class="QLabel" name="label33_2"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>Message</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="DxBaseLabel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>0</width> + <height>16777215</height> + </size> + </property> + <property name="text"> + <string/> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="messageLabel4"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <property name="frameShape"> + <enum>QFrame::Panel</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Sunken</enum> + </property> + <property name="text"> + <string/> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="genButton"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>Send Message</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/widgets/RestrictedSpinBox.cpp b/widgets/RestrictedSpinBox.cpp index 90c5c2f9..0c71634b 100755..100644 --- a/widgets/RestrictedSpinBox.cpp +++ b/widgets/RestrictedSpinBox.cpp @@ -1,33 +1,33 @@ -#include "RestrictedSpinBox.hpp"
-
-#include <algorithm>
-#include <utility>
-
-#include <QString>
-
-QValidator::State RestrictedSpinBox::validate (QString& input, int& pos) const
-{
- // start by doing the standard QSpinBox validation
- auto valid = HintedSpinBox::validate (input, pos);
- // extra validation
- if (QValidator::Acceptable == valid
- && values ().end () == std::find (values ().begin (), values ().end (), valueFromText (input)))
- {
- valid = QValidator::Intermediate;
- }
- return valid;
-}
-
-void RestrictedSpinBox::fixup (QString& input) const
-{
- auto iter = std::lower_bound (values ().begin (), values ().end (), valueFromText (input));
- HintedSpinBox::fixup (input);
- if (iter != values ().end ())
- {
- input = textFromValue (*iter);
- }
- else
- {
- input = textFromValue (values ().back ());
- }
-}
+#include "RestrictedSpinBox.hpp" + +#include <algorithm> +#include <utility> + +#include <QString> + +QValidator::State RestrictedSpinBox::validate (QString& input, int& pos) const +{ + // start by doing the standard QSpinBox validation + auto valid = HintedSpinBox::validate (input, pos); + // extra validation + if (QValidator::Acceptable == valid + && values ().end () == std::find (values ().begin (), values ().end (), valueFromText (input))) + { + valid = QValidator::Intermediate; + } + return valid; +} + +void RestrictedSpinBox::fixup (QString& input) const +{ + auto iter = std::lower_bound (values ().begin (), values ().end (), valueFromText (input)); + HintedSpinBox::fixup (input); + if (iter != values ().end ()) + { + input = textFromValue (*iter); + } + else + { + input = textFromValue (values ().back ()); + } +} diff --git a/widgets/RestrictedSpinBox.hpp b/widgets/RestrictedSpinBox.hpp index 32956fa8..e984c377 100755..100644 --- a/widgets/RestrictedSpinBox.hpp +++ b/widgets/RestrictedSpinBox.hpp @@ -1,26 +1,26 @@ -#ifndef RESTRICTED_SPIN_BOX_HPP_
-#define RESTRICTED_SPIN_BOX_HPP_
-
-#include "HintedSpinBox.hpp"
-
-class QString;
-
-//
-// RestrictedSpinBox - select only from a sequence of values
-//
-class RestrictedSpinBox final
- : public HintedSpinBox
-{
-public:
- RestrictedSpinBox (QWidget * parent = nullptr)
- : HintedSpinBox {parent}
- {
- }
-
-protected:
- // override the base class validation
- QValidator::State validate (QString& input, int& pos) const override;
- void fixup (QString& input) const override;
-};
-
-#endif
+#ifndef RESTRICTED_SPIN_BOX_HPP_ +#define RESTRICTED_SPIN_BOX_HPP_ + +#include "HintedSpinBox.hpp" + +class QString; + +// +// RestrictedSpinBox - select only from a sequence of values +// +class RestrictedSpinBox final + : public HintedSpinBox +{ +public: + RestrictedSpinBox (QWidget * parent = nullptr) + : HintedSpinBox {parent} + { + } + +protected: + // override the base class validation + QValidator::State validate (QString& input, int& pos) const override; + void fixup (QString& input) const override; +}; + +#endif diff --git a/widgets/SplashScreen.cpp b/widgets/SplashScreen.cpp index 8487dcf0..561733cc 100755..100644 --- a/widgets/SplashScreen.cpp +++ b/widgets/SplashScreen.cpp @@ -1,48 +1,48 @@ -#include "SplashScreen.hpp"
-
-#include <QPixmap>
-#include <QVBoxLayout>
-#include <QCheckBox>
-#include <QCoreApplication>
-
-#include "revision_utils.hpp"
-#include "pimpl_impl.hpp"
-
-#include "moc_SplashScreen.cpp"
-
-class SplashScreen::impl
-{
-public:
- impl ()
- : checkbox_ {"Do not show this again"}
- {
- main_layout_.addStretch ();
- main_layout_.addWidget (&checkbox_, 0, Qt::AlignRight);
- }
-
- QVBoxLayout main_layout_;
- QCheckBox checkbox_;
-};
-
-SplashScreen::SplashScreen ()
- : QSplashScreen {QPixmap {":/splash.png"}, Qt::WindowStaysOnTopHint}
-{
- setLayout (&m_->main_layout_);
- showMessage ("<h2>" + QString {"WSJT-X v" +
- QCoreApplication::applicationVersion() + " " +
- revision ()}.simplified () + "</h2>"
- "V2.0 has many new features.<br /><br />"
- "The release notes have more details.<br /><br />"
- "Send issue reports to https://wsjtx.groups.io, and be sure to save .wav<br />"
- "files where appropriate.<br /><br />"
- "<b>Open the Help menu and select Release Notes for more details.</b><br />"
- "<img src=\":/icon_128x128.png\" />"
- "<img src=\":/gpl-v3-logo.svg\" height=\"80\" />", Qt::AlignCenter);
- connect (&m_->checkbox_, &QCheckBox::stateChanged, [this] (int s) {
- if (Qt::Checked == s) Q_EMIT disabled ();
- });
-}
-
-SplashScreen::~SplashScreen ()
-{
-}
+#include "SplashScreen.hpp" + +#include <QPixmap> +#include <QVBoxLayout> +#include <QCheckBox> +#include <QCoreApplication> + +#include "revision_utils.hpp" +#include "pimpl_impl.hpp" + +#include "moc_SplashScreen.cpp" + +class SplashScreen::impl +{ +public: + impl () + : checkbox_ {"Do not show this again"} + { + main_layout_.addStretch (); + main_layout_.addWidget (&checkbox_, 0, Qt::AlignRight); + } + + QVBoxLayout main_layout_; + QCheckBox checkbox_; +}; + +SplashScreen::SplashScreen () + : QSplashScreen {QPixmap {":/splash.png"}, Qt::WindowStaysOnTopHint} +{ + setLayout (&m_->main_layout_); + showMessage ("<h2>" + QString {"WSJT-X v" + + QCoreApplication::applicationVersion() + " " + + revision ()}.simplified () + "</h2>" + "V2.0 has many new features.<br /><br />" + "The release notes have more details.<br /><br />" + "Send issue reports to https://wsjtx.groups.io, and be sure to save .wav<br />" + "files where appropriate.<br /><br />" + "<b>Open the Help menu and select Release Notes for more details.</b><br />" + "<img src=\":/icon_128x128.png\" />" + "<img src=\":/gpl-v3-logo.svg\" height=\"80\" />", Qt::AlignCenter); + connect (&m_->checkbox_, &QCheckBox::stateChanged, [this] (int s) { + if (Qt::Checked == s) Q_EMIT disabled (); + }); +} + +SplashScreen::~SplashScreen () +{ +} diff --git a/widgets/SplashScreen.hpp b/widgets/SplashScreen.hpp index eecbc06a..2ec3238c 100755..100644 --- a/widgets/SplashScreen.hpp +++ b/widgets/SplashScreen.hpp @@ -1,24 +1,24 @@ -#ifndef SPLASH_SCREEN_HPP___
-#define SPLASH_SCREEN_HPP___
-
-#include <QSplashScreen>
-
-#include "pimpl_h.hpp"
-
-class SplashScreen final
- : public QSplashScreen
-{
- Q_OBJECT
-
-public:
- SplashScreen ();
- ~SplashScreen ();
-
- Q_SIGNAL void disabled ();
-
-private:
- class impl;
- pimpl<impl> m_;
-};
-
-#endif
+#ifndef SPLASH_SCREEN_HPP___ +#define SPLASH_SCREEN_HPP___ + +#include <QSplashScreen> + +#include "pimpl_h.hpp" + +class SplashScreen final + : public QSplashScreen +{ + Q_OBJECT + +public: + SplashScreen (); + ~SplashScreen (); + + Q_SIGNAL void disabled (); + +private: + class impl; + pimpl<impl> m_; +}; + +#endif diff --git a/widgets/about.cpp b/widgets/about.cpp index c733926a..e9b9edce 100755..100644 --- a/widgets/about.cpp +++ b/widgets/about.cpp @@ -1,42 +1,43 @@ -#include "about.h"
-
-#include <QCoreApplication>
-#include <QString>
-
-#include "revision_utils.hpp"
-
-#include "ui_about.h"
-
-CAboutDlg::CAboutDlg(QWidget *parent) :
- QDialog(parent),
- ui(new Ui::CAboutDlg)
-{
- ui->setupUi(this);
-
- ui->labelTxt->setText ("<h2>" + QString {"WSJT-X v"
- + QCoreApplication::applicationVersion ()
- + " " + revision ()}.simplified () + "</h2>"
-
- "WSJT-X implements a number of digital modes designed for <br />"
- "weak-signal Amateur Radio communication. <br /><br />"
- "© 2001-2025 by Joe Taylor, K1JT, Bill Somerville, G4WJS, <br />"
- "Steve Franke, K9AN, Nico Palermo, IV3NWV, <br />"
- "Uwe Risse, DG2YCB, Brian Moran, N9ADG, <br />"
- "and Roger Rehr, W3SZ.<br /><br />"
- "We gratefully acknowledge contributions from AC6SL, AE4JY,<br />"
- "DF2ET, DJ0OT, DL3WDG, EA4AC, G4KLA, IW3RAB, JA7UDE,<br />"
- "K3WYC, KA1GT, KA6MAL, KA9Q, KB1ZMX, KD6EKQ, KG4IYS, KI7MT,<br />"
- "KK1D, ND0B, PY1ZRJ, PY2SDR, VE1SKY, VK3ACF, VK4BDJ,<br />"
- "VK7MO, VR2UPU, W3DJS, W4TI, W4TV, and W9MDB.<br /><br />"
- "WSJT-X is licensed under the terms of Version 3 <br />"
- "of the GNU General Public License (GPL) <br /><br />"
- "<a href=" TO_STRING__ (PROJECT_HOMEPAGE) ">"
- "<img src=\":/icon_128x128.png\" /></a>"
- "<a href=\"https://www.gnu.org/licenses/gpl-3.0.txt\">"
- "<img src=\":/gpl-v3-logo.svg\" height=\"80\" /><br />"
- "https://www.gnu.org/licenses/gpl-3.0.txt</a>");
-}
-
-CAboutDlg::~CAboutDlg()
-{
-}
+#include "about.h" + +#include <QCoreApplication> +#include <QString> + +#include "revision_utils.hpp" + +#include "ui_about.h" + +CAboutDlg::CAboutDlg(QWidget *parent) : + QDialog(parent), + ui(new Ui::CAboutDlg) +{ + ui->setupUi(this); + + ui->labelTxt->setText ("<h2>" + QString {"WSJT-X v" + + QCoreApplication::applicationVersion () + + " " + revision ()}.simplified () + "<br />" + + "WSJT-X implements a number of digital modes designed for <br />" + "weak-signal Amateur Radio communication. <br /><br />" + "© 2001-2026 by Joe Taylor, K1JT, Bill Somerville, G4WJS, <br />" + "Steve Franke, K9AN, Nico Palermo, IV3NWV, <br />" + "Uwe Risse, DG2YCB, Brian Moran, N9ADG, <br />" + "Roger Rehr, W3SZ, John Nelson, G4KLA, and <br />" + "Charlie Suckling, DL3WDG.<br /><br />" + "We gratefully acknowledge contributions from AC6SL, AE4JY,<br />" + "DF2ET, DJ0OT, DL3WDG, EA4AC, G4KLA, IW3RAB, JA7UDE,<br />" + "K3WYC, KA1GT, KA6MAL, KA9Q, KB1ZMX, KD6EKQ, KG4IYS, KI7MT,<br />" + "KK1D, ND0B, PY1ZRJ, PY2SDR, VE1SKY, VK3ACF, VK4BDJ,<br />" + "VK7MO, VR2UPU, W3DJS, W4TI, W4TV, and W9MDB.<br /><br />" + "WSJT-X is licensed under the terms of Version 3 <br />" + "of the GNU General Public License (GPL) <br /><br />" + "<a href=" TO_STRING__ (PROJECT_HOMEPAGE) ">" + "<img src=\":/icon_128x128.png\" /></a>" + "<a href=\"https://www.gnu.org/licenses/gpl-3.0.txt\">" + "<img src=\":/gpl-v3-logo.svg\" height=\"80\" /><br />" + "https://www.gnu.org/licenses/gpl-3.0.txt</a>"); +} + +CAboutDlg::~CAboutDlg() +{ +} diff --git a/widgets/about.h b/widgets/about.h index bd0356be..460b7eff 100755..100644 --- a/widgets/about.h +++ b/widgets/about.h @@ -1,23 +1,23 @@ -// -*- Mode: C++ -*-
-#ifndef ABOUTDLG_H
-#define ABOUTDLG_H
-
-#include <QDialog>
-#include <QScopedPointer>
-
-namespace Ui {
- class CAboutDlg;
-}
-
-class CAboutDlg
- : public QDialog
-{
-public:
- explicit CAboutDlg(QWidget *parent = nullptr);
- ~CAboutDlg ();
-
-private:
- QScopedPointer<Ui::CAboutDlg> ui;
-};
-
-#endif // ABOUTDLG_H
+// -*- Mode: C++ -*- +#ifndef ABOUTDLG_H +#define ABOUTDLG_H + +#include <QDialog> +#include <QScopedPointer> + +namespace Ui { + class CAboutDlg; +} + +class CAboutDlg + : public QDialog +{ +public: + explicit CAboutDlg(QWidget *parent = nullptr); + ~CAboutDlg (); + +private: + QScopedPointer<Ui::CAboutDlg> ui; +}; + +#endif // ABOUTDLG_H diff --git a/widgets/about.ui b/widgets/about.ui index 84a59c63..84157c4d 100755..100644 --- a/widgets/about.ui +++ b/widgets/about.ui @@ -1,100 +1,100 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>CAboutDlg</class>
- <widget class="QDialog" name="CAboutDlg">
- <property name="windowModality">
- <enum>Qt::NonModal</enum>
- </property>
- <property name="windowTitle">
- <string>About WSJT-X</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <item>
- <widget class="QLabel" name="labelTxt">
- <property name="text">
- <string/>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <property name="openExternalLinks">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QPushButton" name="okButton">
- <property name="text">
- <string>OK</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer_2">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections>
- <connection>
- <sender>okButton</sender>
- <signal>clicked()</signal>
- <receiver>CAboutDlg</receiver>
- <slot>accept()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>321</x>
- <y>120</y>
- </hint>
- <hint type="destinationlabel">
- <x>186</x>
- <y>71</y>
- </hint>
- </hints>
- </connection>
- </connections>
-</ui>
+<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>CAboutDlg</class> + <widget class="QDialog" name="CAboutDlg"> + <property name="windowModality"> + <enum>Qt::NonModal</enum> + </property> + <property name="windowTitle"> + <string>About WSJT-X</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item> + <widget class="QLabel" name="labelTxt"> + <property name="text"> + <string/> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="openExternalLinks"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </item> + <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="okButton"> + <property name="text"> + <string>OK</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + </layout> + </widget> + <resources/> + <connections> + <connection> + <sender>okButton</sender> + <signal>clicked()</signal> + <receiver>CAboutDlg</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel"> + <x>321</x> + <y>120</y> + </hint> + <hint type="destinationlabel"> + <x>186</x> + <y>71</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/widgets/about_wsjtx.cpp b/widgets/about_wsjtx.cpp new file mode 100644 index 00000000..17abd51d --- /dev/null +++ b/widgets/about_wsjtx.cpp @@ -0,0 +1,42 @@ +#include "about.h" + +#include <QCoreApplication> +#include <QString> + +#include "revision_utils.hpp" + +#include "ui_about.h" + +CAboutDlg::CAboutDlg(QWidget *parent) : + QDialog(parent), + ui(new Ui::CAboutDlg) +{ + ui->setupUi(this); + + ui->labelTxt->setText ("<h2>" + QString {"WSJT-X v" + + QCoreApplication::applicationVersion () + + " " + revision ()}.simplified () + "</h2>" + + "WSJT-X implements a number of digital modes designed for <br />" + "weak-signal Amateur Radio communication. <br /><br />" + "© 2001-2025 by Joe Taylor, K1JT, Bill Somerville, G4WJS, <br />" + "Steve Franke, K9AN, Nico Palermo, IV3NWV, <br />" + "Uwe Risse, DG2YCB, Brian Moran, N9ADG, <br />" + "and Roger Rehr, W3SZ.<br /><br />" + "We gratefully acknowledge contributions from AC6SL, AE4JY,<br />" + "DF2ET, DJ0OT, DL3WDG, EA4AC, G4KLA, IW3RAB, JA7UDE,<br />" + "K3WYC, KA1GT, KA6MAL, KA9Q, KB1ZMX, KD6EKQ, KG4IYS, KI7MT,<br />" + "KK1D, ND0B, PY1ZRJ, PY2SDR, VE1SKY, VK3ACF, VK4BDJ,<br />" + "VK7MO, VR2UPU, W3DJS, W4TI, W4TV, and W9MDB.<br /><br />" + "WSJT-X is licensed under the terms of Version 3 <br />" + "of the GNU General Public License (GPL) <br /><br />" + "<a href=" TO_STRING__ (PROJECT_HOMEPAGE) ">" + "<img src=\":/icon_128x128.png\" /></a>" + "<a href=\"https://www.gnu.org/licenses/gpl-3.0.txt\">" + "<img src=\":/gpl-v3-logo.svg\" height=\"80\" /><br />" + "https://www.gnu.org/licenses/gpl-3.0.txt</a>"); +} + +CAboutDlg::~CAboutDlg() +{ +} diff --git a/widgets/activeStations.cpp b/widgets/activeStations.cpp index e5dbaceb..7353501c 100755..100644 --- a/widgets/activeStations.cpp +++ b/widgets/activeStations.cpp @@ -1,236 +1,236 @@ -#include "activeStations.h"
-
-#include <QSettings>
-#include <QApplication>
-#include <QTextCharFormat>
-#include <QDateTime>
-#include <QDebug>
-
-#include "SettingsGroup.hpp"
-#include "qt_helpers.hpp"
-#include "ui_activeStations.h"
-
-#include "moc_activeStations.cpp"
-
-ActiveStations::ActiveStations(QSettings * settings, QFont const& font, QWidget *parent) :
- QWidget(parent),
- settings_ {settings},
- ui(new Ui::ActiveStations)
-{
- ui->setupUi(this);
- setWindowTitle (QApplication::applicationName () + " - " + tr ("Active Stations"));
- ui->RecentStationsPlainTextEdit->setReadOnly (true);
- changeFont (font);
- read_settings ();
- ui->header_label2->setText(" N Call Grid Az S/N Freq Tx Age Pts");
- connect(ui->cbReadyOnly, SIGNAL(toggled(bool)), this, SLOT(on_cbReadyOnly_toggled(bool)));
- connect(ui->cbWantedOnly, SIGNAL(toggled(bool)), this, SLOT(on_cbWantedOnly_toggled(bool)));
- connect(ui->RecentStationsPlainTextEdit, SIGNAL(cursorPositionChanged()), this, SLOT(on_textEdit_clicked()));
-}
-
-ActiveStations::~ActiveStations()
-{
- write_settings ();
-}
-
-void ActiveStations::changeFont (QFont const& font)
-{
- ui->header_label2->setStyleSheet (font_as_stylesheet (font));
- ui->RecentStationsPlainTextEdit->setStyleSheet (font_as_stylesheet (font));
- updateGeometry ();
-}
-
-void ActiveStations::clearStations() {
- m_textbuffer.clear();
- m_decodes_by_frequency.clear();
-}
-
-void ActiveStations::addLine(QString line) {
- QString m_textbuffer = "";
- // "012700 -1 0.2 210 ~ KJ7COA JA2HGF -14"
- unsigned freq = line.mid(16, 4).toUInt();
- m_decodes_by_frequency[freq] = line;
- // show them in frequency order
- QMap<int, QString>::const_iterator i = m_decodes_by_frequency.constBegin();
- m_textbuffer.clear();
- while (i != m_decodes_by_frequency.constEnd()) {
- m_textbuffer.append(i.value());
- ++i;
- }
- this->displayRecentStations(m_mode, m_textbuffer);
-}
-
-void ActiveStations::read_settings ()
-{
- SettingsGroup group {settings_, "ActiveStations"};
- restoreGeometry (settings_->value ("window/geometry").toByteArray ());
- ui->sbMaxRecent->setValue(settings_->value("MaxRecent",10).toInt());
- ui->sbMaxAge->setValue(settings_->value("MaxAge",10).toInt());
- ui->cbReadyOnly->setChecked(settings_->value("ReadyOnly",false).toBool());
- ui->cbWantedOnly->setChecked(settings_->value("# WantedOnly",false).toBool());
-}
-
-void ActiveStations::write_settings ()
-{
- SettingsGroup group {settings_, "ActiveStations"};
- settings_->setValue ("window/geometry", saveGeometry ());
- settings_->setValue("MaxRecent",ui->sbMaxRecent->value());
- settings_->setValue("MaxAge",ui->sbMaxAge->value());
- settings_->setValue("ReadyOnly",ui->cbReadyOnly->isChecked());
- settings_->setValue("WantedOnly",ui->cbWantedOnly->isChecked());
-}
-
-void ActiveStations::setupUi(QString mode) {
- if(mode!=m_mode) {
- m_mode=mode;
- ui->cbReadyOnly->setText(" Ready only");
- if(m_mode=="Q65") {
- ui->header_label2->setText(" N Frx Fsked S/N Q65 Call Grid Tx Age");
- ui->label->setText("QSOs:");
- ui->cbReadyOnly->setText("* CQ only");
- } else if(m_mode=="Q65-pileup") {
- ui->header_label2->setText(" N Freq Call Grid El Age(h)");
- ui->cbWantedOnly->setText(QCoreApplication::translate("ActiveStations", "Wanted only", nullptr));
- } else if(m_mode=="Fox Mode" || m_mode=="SuperFox Mode" ) {
- ui->header_label2->setText(" UTC dB DT Freq " + tr("Message"));
- ui->cbWantedOnly->setText(QCoreApplication::translate("ActiveStations", "My call only", nullptr));
- this->setClickOK(true);
- } else {
- ui->header_label2->setText(" N Call Grid Az S/N Freq Tx Age Pts");
- ui->label->setText("Rate:");
- ui->cbWantedOnly->setText(QCoreApplication::translate("ActiveStations", "Wanted only", nullptr));
- }
- bool b=(m_mode.left(3)=="Q65");
- bool is_fox_mode =(m_mode=="Fox Mode");
- ui->bandChanges->setVisible(!b && !is_fox_mode);
- ui->cbReadyOnly->setVisible(m_mode != "Q65-pileup" && !is_fox_mode);
- ui->cbWantedOnly->setVisible(m_mode != "Q65-pileup"); // this is used for "My call only" in Fox mode
- ui->label_2->setVisible(!b && !is_fox_mode);
- ui->label_3->setVisible(!b && !is_fox_mode);
- ui->score->setVisible(!b && !is_fox_mode);
- ui->sbMaxRecent->setVisible(!b && !is_fox_mode);
-
- b=(m_mode!="Q65-pileup" && !is_fox_mode);
- ui->sbMaxAge->setVisible(b);
- ui->label->setVisible(b);
- ui->rate->setVisible(b);
- }
-}
-
-void ActiveStations::displayRecentStations(QString mode, QString const& t)
-{
- setupUi(mode);
-
- bool bClickOK=m_clickOK;
- m_clickOK=false;
- ui->RecentStationsPlainTextEdit->setPlainText(t);
-
-//White background for Q65-60x decodes, yellow for Q65-30x:
- int i0=0;
- int i1=0;
- int npos=0;
- int nlines=t.count("\n");
- QTextCursor cursor=ui->RecentStationsPlainTextEdit->textCursor();
- QTextCharFormat fmt;
- for(int i=0; i<nlines; i++) {
- i1=t.indexOf("\n",i0);
- npos=t.indexOf(QRegularExpression(" 30[ABCD] "), i0);
- if(npos>0) {
- cursor.setPosition(npos);
- cursor.select(QTextCursor::LineUnderCursor);
- fmt.setBackground(QBrush(Qt::yellow));
- fmt.setForeground(QBrush(Qt::black));
- } else {
- cursor.setPosition(i0+10);
- cursor.select(QTextCursor::LineUnderCursor);
- fmt.clearForeground();
- fmt.clearBackground();
- }
- cursor.setCharFormat(fmt);
- i0=i1+1;
- }
-
- m_clickOK=bClickOK;
-}
-
-int ActiveStations::maxRecent()
-{
- return ui->sbMaxRecent->value();
-}
-
-int ActiveStations::maxAge()
-{
- return ui->sbMaxAge->value();
-}
-
-void ActiveStations::on_textEdit_clicked()
-{
- if(m_clickOK) {
- QTextCursor cursor;
- QString text;
- cursor = ui->RecentStationsPlainTextEdit->textCursor();
- cursor.movePosition(QTextCursor::StartOfBlock);
- cursor.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor);
- text = cursor.selectedText();
- if(text!="") {
- int nline=text.left(2).toInt();
- if(QGuiApplication::keyboardModifiers().testFlag(Qt::ControlModifier)) nline=-nline;
- if ("Fox Mode" != m_mode && "SuperFox Mode" != m_mode)
- emit callSandP(nline);
- else
- emit queueActiveWindowHound(text);
- }
- }
-}
-
-void ActiveStations::setClickOK(bool b)
-{
- m_clickOK=b;
-}
-
-void ActiveStations::erase()
-{
- ui->RecentStationsPlainTextEdit->clear();
-}
-
-bool ActiveStations::readyOnly()
-{
- return ui->cbReadyOnly->isChecked();
-}
-
-void ActiveStations::on_cbReadyOnly_toggled(bool b)
-{
- m_bReadyOnly=b;
- emit activeStationsDisplay();
-}
-
-bool ActiveStations::wantedOnly()
-{
- return ui->cbWantedOnly->isChecked();
-}
-
-void ActiveStations::on_cbWantedOnly_toggled(bool b)
-{
- m_bWantedOnly=b;
- emit activeStationsDisplay();
-}
-
-void ActiveStations::setRate(int n)
-{
- ui->rate->setText(QString::number(n));
-}
-
-void ActiveStations::setScore(int n)
-{
- ui->score->setText(QLocale(QLocale::English).toString(n));
-}
-
-void ActiveStations::setBandChanges(int n)
-{
- if(n >= 8) {
- ui->bandChanges->setStyleSheet("QLineEdit{background: rgb(255, 64, 64)}");
- } else {
- ui->bandChanges->setStyleSheet ("");
- }
- ui->bandChanges->setText(QString::number(n));
-}
+#include "activeStations.h" + +#include <QSettings> +#include <QApplication> +#include <QTextCharFormat> +#include <QDateTime> +#include <QDebug> + +#include "SettingsGroup.hpp" +#include "qt_helpers.hpp" +#include "ui_activeStations.h" + +#include "moc_activeStations.cpp" + +ActiveStations::ActiveStations(QSettings * settings, QFont const& font, QWidget *parent) : + QWidget(parent), + settings_ {settings}, + ui(new Ui::ActiveStations) +{ + ui->setupUi(this); + setWindowTitle (QApplication::applicationName () + " - " + tr ("Active Stations")); + ui->RecentStationsPlainTextEdit->setReadOnly (true); + changeFont (font); + read_settings (); + ui->header_label2->setText(" N Call Grid Az S/N Freq Tx Age Pts"); + connect(ui->cbReadyOnly, SIGNAL(toggled(bool)), this, SLOT(on_cbReadyOnly_toggled(bool))); + connect(ui->cbWantedOnly, SIGNAL(toggled(bool)), this, SLOT(on_cbWantedOnly_toggled(bool))); + connect(ui->RecentStationsPlainTextEdit, SIGNAL(cursorPositionChanged()), this, SLOT(on_textEdit_clicked())); +} + +ActiveStations::~ActiveStations() +{ + write_settings (); +} + +void ActiveStations::changeFont (QFont const& font) +{ + ui->header_label2->setStyleSheet (font_as_stylesheet (font)); + ui->RecentStationsPlainTextEdit->setStyleSheet (font_as_stylesheet (font)); + updateGeometry (); +} + +void ActiveStations::clearStations() { + m_textbuffer.clear(); + m_decodes_by_frequency.clear(); +} + +void ActiveStations::addLine(QString line) { + QString m_textbuffer = ""; + // "012700 -1 0.2 210 ~ KJ7COA JA2HGF -14" + unsigned freq = line.mid(16, 4).toUInt(); + m_decodes_by_frequency[freq] = line; + // show them in frequency order + QMap<int, QString>::const_iterator i = m_decodes_by_frequency.constBegin(); + m_textbuffer.clear(); + while (i != m_decodes_by_frequency.constEnd()) { + m_textbuffer.append(i.value()); + ++i; + } + this->displayRecentStations(m_mode, m_textbuffer); +} + +void ActiveStations::read_settings () +{ + SettingsGroup group {settings_, "ActiveStations"}; + restoreGeometry (settings_->value ("window/geometry").toByteArray ()); + ui->sbMaxRecent->setValue(settings_->value("MaxRecent",10).toInt()); + ui->sbMaxAge->setValue(settings_->value("MaxAge",10).toInt()); + ui->cbReadyOnly->setChecked(settings_->value("ReadyOnly",false).toBool()); + ui->cbWantedOnly->setChecked(settings_->value("# WantedOnly",false).toBool()); +} + +void ActiveStations::write_settings () +{ + SettingsGroup group {settings_, "ActiveStations"}; + settings_->setValue ("window/geometry", saveGeometry ()); + settings_->setValue("MaxRecent",ui->sbMaxRecent->value()); + settings_->setValue("MaxAge",ui->sbMaxAge->value()); + settings_->setValue("ReadyOnly",ui->cbReadyOnly->isChecked()); + settings_->setValue("WantedOnly",ui->cbWantedOnly->isChecked()); +} + +void ActiveStations::setupUi(QString mode) { + if(mode!=m_mode) { + m_mode=mode; + ui->cbReadyOnly->setText(" Ready only"); + if(m_mode=="Q65") { + ui->header_label2->setText(" N Frx Fsked S/N Q65 Call Grid Tx Age"); + ui->label->setText("QSOs:"); + ui->cbReadyOnly->setText("* CQ only"); + } else if(m_mode=="Q65-pileup") { + ui->header_label2->setText(" N Freq Call Grid El Age(h)"); + ui->cbWantedOnly->setText(QCoreApplication::translate("ActiveStations", "Wanted only", nullptr)); + } else if(m_mode=="Fox Mode" || m_mode=="SuperFox Mode" ) { + ui->header_label2->setText(" UTC dB DT Freq " + tr("Message")); + ui->cbWantedOnly->setText(QCoreApplication::translate("ActiveStations", "My call only", nullptr)); + this->setClickOK(true); + } else { + ui->header_label2->setText(" N Call Grid Az S/N Freq Tx Age Pts"); + ui->label->setText("Rate:"); + ui->cbWantedOnly->setText(QCoreApplication::translate("ActiveStations", "Wanted only", nullptr)); + } + bool b=(m_mode.left(3)=="Q65"); + bool is_fox_mode =(m_mode=="Fox Mode"); + ui->bandChanges->setVisible(!b && !is_fox_mode); + ui->cbReadyOnly->setVisible(m_mode != "Q65-pileup" && !is_fox_mode); + ui->cbWantedOnly->setVisible(m_mode != "Q65-pileup"); // this is used for "My call only" in Fox mode + ui->label_2->setVisible(!b && !is_fox_mode); + ui->label_3->setVisible(!b && !is_fox_mode); + ui->score->setVisible(!b && !is_fox_mode); + ui->sbMaxRecent->setVisible(!b && !is_fox_mode); + + b=(m_mode!="Q65-pileup" && !is_fox_mode); + ui->sbMaxAge->setVisible(b); + ui->label->setVisible(b); + ui->rate->setVisible(b); + } +} + +void ActiveStations::displayRecentStations(QString mode, QString const& t) +{ + setupUi(mode); + + bool bClickOK=m_clickOK; + m_clickOK=false; + ui->RecentStationsPlainTextEdit->setPlainText(t); + +//White background for Q65-60x decodes, yellow for Q65-30x: + int i0=0; + int i1=0; + int npos=0; + int nlines=t.count("\n"); + QTextCursor cursor=ui->RecentStationsPlainTextEdit->textCursor(); + QTextCharFormat fmt; + for(int i=0; i<nlines; i++) { + i1=t.indexOf("\n",i0); + npos=t.indexOf(QRegularExpression(" 30[ABCD] "), i0); + if(npos>0) { + cursor.setPosition(npos); + cursor.select(QTextCursor::LineUnderCursor); + fmt.setBackground(QBrush(Qt::yellow)); + fmt.setForeground(QBrush(Qt::black)); + } else { + cursor.setPosition(i0+10); + cursor.select(QTextCursor::LineUnderCursor); + fmt.clearForeground(); + fmt.clearBackground(); + } + cursor.setCharFormat(fmt); + i0=i1+1; + } + + m_clickOK=bClickOK; +} + +int ActiveStations::maxRecent() +{ + return ui->sbMaxRecent->value(); +} + +int ActiveStations::maxAge() +{ + return ui->sbMaxAge->value(); +} + +void ActiveStations::on_textEdit_clicked() +{ + if(m_clickOK) { + QTextCursor cursor; + QString text; + cursor = ui->RecentStationsPlainTextEdit->textCursor(); + cursor.movePosition(QTextCursor::StartOfBlock); + cursor.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor); + text = cursor.selectedText(); + if(text!="") { + int nline=text.left(2).toInt(); + if(QGuiApplication::keyboardModifiers().testFlag(Qt::ControlModifier)) nline=-nline; + if ("Fox Mode" != m_mode && "SuperFox Mode" != m_mode) + emit callSandP(nline); + else + emit queueActiveWindowHound(text); + } + } +} + +void ActiveStations::setClickOK(bool b) +{ + m_clickOK=b; +} + +void ActiveStations::erase() +{ + ui->RecentStationsPlainTextEdit->clear(); +} + +bool ActiveStations::readyOnly() +{ + return ui->cbReadyOnly->isChecked(); +} + +void ActiveStations::on_cbReadyOnly_toggled(bool b) +{ + m_bReadyOnly=b; + emit activeStationsDisplay(); +} + +bool ActiveStations::wantedOnly() +{ + return ui->cbWantedOnly->isChecked(); +} + +void ActiveStations::on_cbWantedOnly_toggled(bool b) +{ + m_bWantedOnly=b; + emit activeStationsDisplay(); +} + +void ActiveStations::setRate(int n) +{ + ui->rate->setText(QString::number(n)); +} + +void ActiveStations::setScore(int n) +{ + ui->score->setText(QLocale(QLocale::English).toString(n)); +} + +void ActiveStations::setBandChanges(int n) +{ + if(n >= 8) { + ui->bandChanges->setStyleSheet("QLineEdit{background: rgb(255, 64, 64)}"); + } else { + ui->bandChanges->setStyleSheet (""); + } + ui->bandChanges->setText(QString::number(n)); +} diff --git a/widgets/activeStations.h b/widgets/activeStations.h index c3951272..60cdc700 100755..100644 --- a/widgets/activeStations.h +++ b/widgets/activeStations.h @@ -1,62 +1,62 @@ -// -*- Mode: C++ -*-
-#ifndef ARRL_DIGI_H_
-#define ARRL_DIGI_H_
-
-#include <QWidget>
-#include <QMap>
-
-class QSettings;
-class QFont;
-
-namespace Ui {
- class ActiveStations;
-}
-
-class ActiveStations
- : public QWidget
-{
- Q_OBJECT
-
-public:
- explicit ActiveStations(QSettings *, QFont const&, QWidget * parent = 0);
- ~ActiveStations();
- void displayRecentStations(QString mode, QString const&);
- void setupUi(QString display_mode);
- void changeFont (QFont const&);
- int maxRecent();
- int maxAge();
- void setClickOK(bool b);
- void erase();
- bool readyOnly();
- bool wantedOnly();
- void setRate(int n);
- void setBandChanges(int n);
- void setScore(int n);
- void clearStations();
- void addLine(QString);
-
- bool m_clickOK=false;
- bool m_bReadyOnly;
- bool m_bWantedOnly;
-
-private:
- void read_settings ();
- void write_settings ();
- Q_SIGNAL void callSandP(int nline);
- Q_SIGNAL void activeStationsDisplay();
- Q_SIGNAL void cursorPositionChanged();
- Q_SIGNAL void queueActiveWindowHound(QString text);
-
- Q_SLOT void on_cbReadyOnly_toggled(bool b);
- Q_SLOT void on_cbWantedOnly_toggled(bool b);
- Q_SLOT void on_textEdit_clicked();
-
- QString m_mode="";
- QSettings * settings_;
- QString m_textbuffer=""; // F/H mode band decodes
- QMap<int, QString> m_decodes_by_frequency; // store decodes for F/H band awareness by frequency
-
- QScopedPointer<Ui::ActiveStations> ui;
-};
-
-#endif
+// -*- Mode: C++ -*- +#ifndef ARRL_DIGI_H_ +#define ARRL_DIGI_H_ + +#include <QWidget> +#include <QMap> + +class QSettings; +class QFont; + +namespace Ui { + class ActiveStations; +} + +class ActiveStations + : public QWidget +{ + Q_OBJECT + +public: + explicit ActiveStations(QSettings *, QFont const&, QWidget * parent = 0); + ~ActiveStations(); + void displayRecentStations(QString mode, QString const&); + void setupUi(QString display_mode); + void changeFont (QFont const&); + int maxRecent(); + int maxAge(); + void setClickOK(bool b); + void erase(); + bool readyOnly(); + bool wantedOnly(); + void setRate(int n); + void setBandChanges(int n); + void setScore(int n); + void clearStations(); + void addLine(QString); + + bool m_clickOK=false; + bool m_bReadyOnly; + bool m_bWantedOnly; + +private: + void read_settings (); + void write_settings (); + Q_SIGNAL void callSandP(int nline); + Q_SIGNAL void activeStationsDisplay(); + Q_SIGNAL void cursorPositionChanged(); + Q_SIGNAL void queueActiveWindowHound(QString text); + + Q_SLOT void on_cbReadyOnly_toggled(bool b); + Q_SLOT void on_cbWantedOnly_toggled(bool b); + Q_SLOT void on_textEdit_clicked(); + + QString m_mode=""; + QSettings * settings_; + QString m_textbuffer=""; // F/H mode band decodes + QMap<int, QString> m_decodes_by_frequency; // store decodes for F/H band awareness by frequency + + QScopedPointer<Ui::ActiveStations> ui; +}; + +#endif diff --git a/widgets/activeStations.ui b/widgets/activeStations.ui index aab57cfd..e09d6718 100755..100644 --- a/widgets/activeStations.ui +++ b/widgets/activeStations.ui @@ -1,224 +1,224 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>ActiveStations</class>
- <widget class="QWidget" name="ActiveStations">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>400</width>
- <height>340</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Message Averaging</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <layout class="QGridLayout" name="gridLayout">
- <item row="2" column="0">
- <layout class="QGridLayout" name="gridLayout_2" columnstretch="1,0,1,0,0,1">
- <item row="1" column="0">
- <widget class="QLabel" name="label_3">
- <property name="text">
- <string>Band Changes:</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="1" column="5">
- <widget class="QLineEdit" name="score">
- <property name="toolTip">
- <string><html><head/><body><p>Total score accumulated since most recent reset of Cabrillo log.</p></body></html></string>
- </property>
- <property name="text">
- <string>0</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- <property name="readOnly">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="0" column="5">
- <widget class="QLineEdit" name="rate">
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string><html><head/><body><p>Points logged during the past hour.</p></body></html></string>
- </property>
- <property name="text">
- <string>0</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- <property name="readOnly">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="0" column="3">
- <widget class="QCheckBox" name="cbReadyOnly">
- <property name="toolTip">
- <string><html><head/><body><p>Check this box to show only stations ready to be called.</p></body></html></string>
- </property>
- <property name="text">
- <string>Ready only</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QCheckBox" name="cbWantedOnly">
- <property name="visible">
- <bool>false</bool>
- </property>
- <property name="text">
- <string># Wanted only</string>
- </property>
- </widget>
- </item>
- <item row="1" column="4">
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>Score:</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="0" column="4">
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Rate:</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="0" column="0">
- <widget class="QSpinBox" name="sbMaxAge">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string><html><head/><body><p>Set maximum elapsed number of T/R sequences.</p></body></html></string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <property name="prefix">
- <string>Max Age </string>
- </property>
- <property name="minimum">
- <number>0</number>
- </property>
- <property name="maximum">
- <number>60</number>
- </property>
- <property name="value">
- <number>4</number>
- </property>
- </widget>
- </item>
- <item row="0" column="2">
- <widget class="QSpinBox" name="sbMaxRecent">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>0</height>
- </size>
- </property>
- <property name="toolTip">
- <string><html><head/><body><p>Set maximum number of displayed lines.</p></body></html></string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <property name="prefix">
- <string>Max N </string>
- </property>
- <property name="maximum">
- <number>50</number>
- </property>
- <property name="value">
- <number>10</number>
- </property>
- </widget>
- </item>
- <item row="1" column="2">
- <widget class="QLineEdit" name="bandChanges">
- <property name="toolTip">
- <string><html><head/><body><p>Number of band changes during the past hour.</p></body></html></string>
- </property>
- <property name="text">
- <string>0</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- <property name="readOnly">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="1" column="0">
- <widget class="QPlainTextEdit" name="RecentStationsPlainTextEdit">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>1</verstretch>
- </sizepolicy>
- </property>
- <property name="toolTip">
- <string><html><head/><body><p>Click on a line to call that station. </p><p>When using QMAP, single click to transfer QSO data and sked frequency to WSJT-X, and double click to call that station.</p></body></html></string>
- </property>
- </widget>
- </item>
- <item row="0" column="0">
- <widget class="QLabel" name="header_label2">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
+<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>ActiveStations</class> + <widget class="QWidget" name="ActiveStations"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>340</height> + </rect> + </property> + <property name="windowTitle"> + <string>Message Averaging</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <layout class="QGridLayout" name="gridLayout"> + <item row="2" column="0"> + <layout class="QGridLayout" name="gridLayout_2" columnstretch="1,0,1,0,0,1"> + <item row="1" column="0"> + <widget class="QLabel" name="label_3"> + <property name="text"> + <string>Band Changes:</string> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="1" column="5"> + <widget class="QLineEdit" name="score"> + <property name="toolTip"> + <string><html><head/><body><p>Total score accumulated since most recent reset of Cabrillo log.</p></body></html></string> + </property> + <property name="text"> + <string>0</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="0" column="5"> + <widget class="QLineEdit" name="rate"> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + <property name="toolTip"> + <string><html><head/><body><p>Points logged during the past hour.</p></body></html></string> + </property> + <property name="text"> + <string>0</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="0" column="3"> + <widget class="QCheckBox" name="cbReadyOnly"> + <property name="toolTip"> + <string><html><head/><body><p>Check this box to show only stations ready to be called.</p></body></html></string> + </property> + <property name="text"> + <string>Ready only</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QCheckBox" name="cbWantedOnly"> + <property name="visible"> + <bool>false</bool> + </property> + <property name="text"> + <string># Wanted only</string> + </property> + </widget> + </item> + <item row="1" column="4"> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>Score:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="0" column="4"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Rate:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QSpinBox" name="sbMaxAge"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + <property name="toolTip"> + <string><html><head/><body><p>Set maximum elapsed number of T/R sequences.</p></body></html></string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="prefix"> + <string>Max Age </string> + </property> + <property name="minimum"> + <number>0</number> + </property> + <property name="maximum"> + <number>60</number> + </property> + <property name="value"> + <number>4</number> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QSpinBox" name="sbMaxRecent"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="toolTip"> + <string><html><head/><body><p>Set maximum number of displayed lines.</p></body></html></string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="prefix"> + <string>Max N </string> + </property> + <property name="maximum"> + <number>50</number> + </property> + <property name="value"> + <number>10</number> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QLineEdit" name="bandChanges"> + <property name="toolTip"> + <string><html><head/><body><p>Number of band changes during the past hour.</p></body></html></string> + </property> + <property name="text"> + <string>0</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </item> + <item row="1" column="0"> + <widget class="QPlainTextEdit" name="RecentStationsPlainTextEdit"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>1</verstretch> + </sizepolicy> + </property> + <property name="toolTip"> + <string><html><head/><body><p>Click on a line to call that station. </p><p>When using QMAP, single click to transfer QSO data and sked frequency to WSJT-X, and double click to call that station.</p></body></html></string> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="header_label2"> + <property name="text"> + <string/> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/widgets/astro.cpp b/widgets/astro.cpp index 0622d82f..c96eee6e 100755..100644 --- a/widgets/astro.cpp +++ b/widgets/astro.cpp @@ -1,416 +1,438 @@ -#include "astro.h"
-
-#include <stdio.h>
-
-#include <QApplication>
-#include <QFile>
-#include <QTextStream>
-#include <QSettings>
-#include <QDateTime>
-#include <QTimeZone>
-#include <QDir>
-#include <QCloseEvent>
-#include <QDebug>
-#include <math.h>
-
-#include "commons.h"
-#include "MessageBox.hpp"
-#include "Configuration.hpp"
-#include "SettingsGroup.hpp"
-#include "qt_helpers.hpp"
-
-#include "ui_astro.h"
-#include "moc_astro.cpp"
-
-
-extern "C" {
- void astrosub(int nyear, int month, int nday, double uth, double freqMoon,
- const char * mygrid, const char * hisgrid,
- double * azsun, double * elsun, double * azmoon,
- double * elmoon, double * azmoondx, double * elmoondx, int * ntsky,
- int * ndop, int * ndop00, double * ramoon, double * decmoon, double * dgrd,
- double * poloffset, double * xnr, bool extraazel, double * techo, double * width1,
- double * width2, bool bTx, const char * AzElFileName,
- const char * jpleph);
-}
-
-Astro::Astro(QSettings * settings, Configuration const * configuration, QWidget * parent)
- : QDialog {parent, Qt::WindowTitleHint}
- , settings_ {settings}
- , configuration_ {configuration}
- , ui_ {new Ui::Astro}
- , m_DopplerMethod {0}
- , m_dop {0}
- , m_dop00 {0}
- //, m_dx_two_way_dop {0}
-{
- ui_->setupUi (this);
- setWindowTitle (QApplication::applicationName () + " - " + tr ("Astronomical Data"));
- setBackgroundRole (QPalette::Base);
- setAutoFillBackground (true);
- connect (ui_->cbDopplerTracking, &QAbstractButton::toggled, ui_->doppler_widget, &QWidget::setVisible);
- read_settings ();
- ui_->text_label->clear ();
-}
-
-Astro::~Astro ()
-{
- Q_EMIT tracking_update ();
- if (isVisible ()) write_settings ();
-}
-
-void Astro::closeEvent (QCloseEvent * e)
-{
- write_settings ();
- e->ignore (); // do not allow closure by the window system
-}
-
-void Astro::read_settings ()
-{
- SettingsGroup g (settings_, "Astro");
- bool b=settings_->value("DopplerTracking",false).toBool();
-// bool sh=settings_->value("EnableShift",false).toBool();
- ui_->cbDopplerTracking->setChecked(b);
- ui_->doppler_widget->setVisible (ui_->cbDopplerTracking->isChecked ());
-// ui_->cbEnableShift->setChecked(sh);
- m_DopplerMethod=settings_->value("DopplerMethod",0).toInt();
- int shVal=settings_->value("ShiftValue",0).toInt();
- ui_->sbibShift->setValue(shVal);
-
- switch (m_DopplerMethod)
- {
- case 0: ui_->rbNoDoppler->setChecked (true); break;
- case 1: ui_->rbFullTrack->setChecked (true); break;
- case 2: ui_->rbConstFreqOnMoon->setChecked (true); break;
- case 3: ui_->rbOwnEcho->setChecked (true); break;
- case 4: ui_->rbOnDxEcho->setChecked (true); break;
- case 5: ui_->rbCallDx->setChecked (true); break;
- case 10: ui_->rbNoDoppler->setChecked (true); break;
- }
- move (settings_->value ("window/pos", pos ()).toPoint ());
-}
-
-void Astro::write_settings ()
-{
- SettingsGroup g (settings_, "Astro");
- settings_->setValue ("DopplerTracking", ui_->cbDopplerTracking->isChecked());
- settings_->setValue ("DopplerMethod",m_DopplerMethod);
- settings_->setValue ("window/pos", pos ());
- settings_->setValue ("EnableShift", ui_->cbEnableShift->isChecked());
- settings_->setValue ("ShiftValue",ui_->sbibShift->value());
-}
-
-auto Astro::astroUpdate(QDateTime const& t, QString const& mygrid, QString const& hisgrid, Frequency freq,
- bool bEchoMode, bool bTx, bool bAuto, bool no_tx_QSY, double TR_period) -> Correction
-{
- Frequency freq_moon {freq};
- double azsun,elsun,azmoon,elmoon,azmoondx,elmoondx;
- double ramoon,decmoon,dgrd,poloffset,xnr,techo,width1,width2;
- int ntsky;
- QString date {t.date().toString("yyyy MMM dd").trimmed ()};
- QString utc {t.time().toString().trimmed ()};
- int nyear {t.date().year()};
- int month {t.date().month()};
- int nday {t.date().day()};
- int nhr {t.time().hour()};
- int nmin {t.time().minute()};
- double sec {t.time().second() + 0.001*t.time().msec()};
- double uth {nhr + nmin/60.0 + sec/3600.0};
- if(freq_moon < 1) freq_moon = 144000000;
- auto const& AzElFileName = QDir::toNativeSeparators (configuration_->azel_directory ().absoluteFilePath ("azel.dat"));
- auto const& jpleph = configuration_->data_dir ().absoluteFilePath ("JPLEPH");
- SettingsGroup g (settings_, "Configuration");
- bool extraazel=settings_->value("AzElExtraLines",false).toBool();
- astrosub(nyear, month, nday, uth, static_cast<double> (freq_moon),
- mygrid.toLatin1 ().data (),
- hisgrid.toLatin1().data(),
- &azsun, &elsun, &azmoon, &elmoon,
- &azmoondx, &elmoondx, &ntsky, &m_dop, &m_dop00, &ramoon, &decmoon,
- &dgrd, &poloffset, &xnr, extraazel, &techo, &width1, &width2,
- bTx,
- AzElFileName.toLocal8Bit ().constData (),
- jpleph.toLocal8Bit ().constData ());
-
- QString message;
- {
- QTextStream out {&message};
- out << " " << date << "\n"
- "UTC: " << utc << "\n"
-#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
- << Qt::fixed
-#else
- << fixed
-#endif
- << qSetFieldWidth (6)
- << qSetRealNumberPrecision (1)
- << "Az: " << azmoon << "\n"
- "El: " << elmoon << "\n"
- "SelfDop:" << m_dop00 << "\n"
- "Width: " << int(width1+0.5) << "\n"
- << qSetRealNumberPrecision (2)
- << "Delay: " << techo << "\n"
- << qSetRealNumberPrecision (1)
- << "DxAz: " << azmoondx << "\n"
- "DxEl: " << elmoondx << "\n"
- "DxDop: " << m_dop << "\n"
- "DxWid: " << int(width2+0.5) << "\n"
- "Dec: " << decmoon << "\n"
- "SunAz: " << azsun << "\n"
- "SunEl: " << elsun << "\n"
- "Freq: " << freq / 1.e6 << "\n";
- if(freq>=5000000ull) { //Suppress data not relevant below VHF
- out << "Tsky: " << ntsky << "\n"
- "Dpol: " << poloffset << "\n"
- "MNR: " << xnr << "\n"
- "Dist: " << int((techo*149896)) << "\n" //wdg
- "Dgrd: " << dgrd;
- }
- }
- ui_->text_label->setText(message);
-
- Correction correction;
- correction.dop=m_dop00;
- correction.width=width1;
- if(hisgrid!="" and !bAuto) {
- correction.dop=m_dop;
- correction.width=width2;
- }
- //ibShift=2000000;
-
- if (ui_->cbEnableShift->isChecked()) {
- ibShift=ui_->sbibShift->value();
- ibShift=1000000*ibShift;
- }else{
- ibShift=0;
- }
-
- if (ui_->cbDopplerTracking->isChecked()) {
- ui_->sbRIT->setEnabled(bEchoMode and m_DopplerMethod==0);
- switch (m_DopplerMethod)
- {
- case 10: correction.rx = 0;
- break;
- case 1: // All Doppler correction done here; DX station stays at nominal dial frequency.
- correction.rx = m_dop;
- break;
- case 4: // All Doppler correction done here; DX station stays at nominal dial frequency. (Trial for OnDxEcho)
- correction.rx = m_dop;
- break;
- //case 5: // All Doppler correction done here; DX station stays at nominal dial frequency.
- case 3: // Both stations do full correction on Rx and none on Tx
- //correction.rx = bEchoMode ? m_dop00 : m_dop;
- correction.rx = m_dop00; // Now always sets RX to *own* echo freq
- break;
- case 2:
- // Doppler correction to constant frequency on Moon
- correction.rx = m_dop00 / 2;
- break;
- default: correction.rx = 0;
- break;
- }
- switch (m_DopplerMethod)
- {
- case 10: correction.tx = ibShift;
- break;
- case 1: correction.tx = -correction.rx + ibShift;
- break;
- //case 2: correction.tx = -correction.rx;
- case 2: correction.tx = -correction.rx + ibShift;
- break;
- case 3: correction.tx = 0;
- break;
- case 4: // correction.tx = m_dop - m_dop00;
- correction.tx = ibShift+(2 * (m_dop - (m_dop00/2))) - m_dop;
- break;
- case 5: correction.tx = ibShift- m_dop00;
- break;
- default: correction.tx = ibShift;
- break;
- }
-
-
- if(bEchoMode && m_DopplerMethod == 1) correction.rx = 0;
- if(10==m_DopplerMethod) {
- correction.tx = ibShift;
- correction.rx = 0;
- }
-
- if (no_tx_QSY && 3 != m_DopplerMethod && 0 != m_DopplerMethod)
- {
- // calculate a single correction for transmit half way through
- // the period as a compromise for rigs that can't CAT QSY
- // while transmitting
- //
- // use a base time of (secs-since-epoch + 2) so as to be sure
- // we do the next period if we calculate just before it starts
- auto sec_since_epoch = t.toMSecsSinceEpoch ()/1000 + 2;
- auto target_sec = sec_since_epoch - fmod(double(sec_since_epoch),TR_period) + 0.5*TR_period;
- auto target_date_time = QDateTime::fromMSecsSinceEpoch (target_sec * 1000, Qt::UTC);
- int nyear {target_date_time.date().year()};
- int month {target_date_time.date().month()};
- int nday {target_date_time.date().day()};
- int nhr {target_date_time.time().hour()};
- int nmin {target_date_time.time().minute()};
- double sec {target_date_time.time().second() + 0.001*target_date_time.time().msec()};
- double uth {nhr + nmin/60.0 + sec/3600.0};
- astrosub(nyear, month, nday, uth, static_cast<double> (freq_moon),
- mygrid.toLatin1 ().data (),
- hisgrid.toLatin1().data(),
- &azsun, &elsun, &azmoon, &elmoon,
- &azmoondx, &elmoondx, &ntsky, &m_dop, &m_dop00, &ramoon, &decmoon,
- &dgrd, &poloffset, &xnr, extraazel, &techo, &width1, &width2,
- bTx,
- nullptr, // don't overwrite azel.dat
- jpleph.toLocal8Bit ().constData ());
-
- FrequencyDelta offset {0};
- switch (m_DopplerMethod)
- {
- case 10:
- offset = -ibShift;// version for _7// maybe +?
- break;
- case 1:
- // All Doppler correction done here; DX station stays at nominal dial frequency.
- offset = bEchoMode ? (m_dop00 - ibShift) : (m_dop - ibShift);
- break;
-
- case 2:
- // Doppler correction to constant frequency on Moon
- offset = (m_dop00 / 2) - ibShift;
- break;
-
- case 4:
- // Doppler correction for OnDxEcho
- offset = m_dop - (2 * (m_dop - (m_dop00/2))) - ibShift;// maybe +?
- break;
-
- //case 5: correction.tx = - m_dop00;
- case 5: offset = m_dop00 - ibShift;// version for _7// maybe +?
- break;
- default: offset = -ibShift;// version for _7// maybe +?
- break;
- }
- correction.tx = -offset;
- //qDebug () << "correction.tx (no tx qsy):" << correction.tx;
- }
- }
- correction.techo=techo;
-// qDebug() << "AA0" << m_DopplerMethod << bAuto << correction.tx << correction.rx << correction.width;
- return correction;
-}
-
-void Astro::check_split ()
-{
- /* TEMPORARILY DISABLE
- if (doppler_tracking () && !configuration_->split_mode ())
- {
- MessageBox::warning_message (this, tr ("Doppler Tracking Error"),
- tr ("Split operating is required for Doppler tracking"),
- tr ("Go to \"Menu->File->Settings->Radio\" to enable split operation"));
- ui_->rbNoDoppler->click ();
- }
- */
-}
-
-void Astro::on_rbFullTrack_clicked(bool)
-{
- m_DopplerMethod = 1;
- check_split ();
- Q_EMIT tracking_update ();
-}
-
-void Astro::on_rbOnDxEcho_clicked(bool)
-{
- m_DopplerMethod = 4;
- check_split ();
- //if (checked) {
- // m_dx_two_way_dop = 2 * (m_dop - (m_dop00/2));
- // qDebug () << "Starting Doppler:" << m_dx_two_way_dop;
- //}
- Q_EMIT tracking_update ();
-}
-
-void Astro::on_rbOwnEcho_clicked(bool)
-{
- m_DopplerMethod = 3;
- check_split ();
- Q_EMIT tracking_update ();
-}
-
-void Astro::on_rbCallDx_clicked(bool)
-{
- m_DopplerMethod = 5;
- check_split ();
- Q_EMIT tracking_update ();
-}
-
-void Astro::on_rbConstFreqOnMoon_clicked(bool)
-{
- m_DopplerMethod = 2;
- check_split ();
- Q_EMIT tracking_update ();
-}
-
-void Astro::on_rbNoDoppler_clicked(bool)
-{
- if (ui_->cbEnableShift->isChecked()) {
- m_DopplerMethod = 10;
- } else {
- m_DopplerMethod = 0;
- }
- check_split ();
- Q_EMIT tracking_update ();
-}
-
-bool Astro::doppler_tracking () const
-{
- return ui_->cbDopplerTracking->isChecked () && m_DopplerMethod;
-}
-
-void Astro::on_cbDopplerTracking_toggled(bool)
-{
- check_split ();
- Q_EMIT tracking_update ();
-}
-
-void Astro::nominal_frequency (Frequency rx, Frequency tx)
-{
- ui_->sked_frequency_label->setText (Radio::pretty_frequency_MHz_string (rx));
- ui_->sked_tx_frequency_label->setText (Radio::pretty_frequency_MHz_string (tx));
- if (ui_->cbEnableShift->isChecked()) ui_->sked_tx_frequency_label->setText ("N/A Tx Shift!");
-}
-
-void Astro::hideEvent (QHideEvent * e)
-{
- Q_EMIT tracking_update ();
- QWidget::hideEvent (e);
-}
-
-bool Astro::bDither()
-{
- return ui_->cbDither->isChecked();
-}
-
-void Astro::selectOwnEcho()
-{
- ui_->rbOwnEcho->click();
-}
-
-void Astro::selectOnDxEcho()
-{
- ui_->rbOnDxEcho->click();
-}
-
-qint32 Astro::nfRIT()
-{
- if(m_DopplerMethod==0) {
- return ui_->sbRIT->value();
- } else {
- return 0;
- }
-}
-
-qint32 Astro::DopplerMethod()
-{
- return m_DopplerMethod;
-}
+#include "astro.h" + +#include <stdio.h> + +#include <QApplication> +#include <QFile> +#include <QTextStream> +#include <QSettings> +#include <QDateTime> +#include <QTimeZone> +#include <QDir> +#include <QCloseEvent> +#include <QDebug> +#include <math.h> + +#include "commons.h" +#include "MessageBox.hpp" +#include "Configuration.hpp" +#include "SettingsGroup.hpp" +#include "qt_helpers.hpp" +#include "mycustomspinbox.h" + +#include "ui_astro.h" +#include "moc_astro.cpp" + + +extern "C" { + void astrosub(int nyear, int month, int nday, double uth, double freqMoon, + const char * mygrid, const char * hisgrid, + double * azsun, double * elsun, double * azmoon, + double * elmoon, double * azmoondx, double * elmoondx, int * ntsky, + int * ndop, int * ndop00, double * ramoon, double * decmoon, double * dgrd, + double * poloffset, double * xnr, bool extraazel, double * techo, double * width1, + double * width2, bool bTx, const char * AzElFileName, + const char * jpleph); +} + +Astro::Astro(QSettings * settings, Configuration const * configuration, QWidget * parent) + : QDialog {parent, Qt::WindowTitleHint} + , settings_ {settings} + , configuration_ {configuration} + , ui_ {new Ui::Astro} + , m_DopplerMethod {0} + , m_dop {0} + , m_dop00 {0} + //, m_dx_two_way_dop {0} +{ + ui_->setupUi (this); + setWindowTitle (QApplication::applicationName () + " - " + tr ("Astronomical Data")); + setBackgroundRole (QPalette::Base); + setAutoFillBackground (true); + connect (ui_->cbDopplerTracking, &QAbstractButton::toggled, ui_->doppler_widget, &QWidget::setVisible); + read_settings (); + ui_->text_label->clear (); +} + +Astro::~Astro () +{ + Q_EMIT tracking_update (); + if (isVisible ()) write_settings (); +} + +void Astro::closeEvent (QCloseEvent * e) +{ + write_settings (); + e->ignore (); // do not allow closure by the window system +} + +void Astro::read_settings () +{ + SettingsGroup g (settings_, "Astro"); + bool b=settings_->value("DopplerTracking",false).toBool(); +// bool sh=settings_->value("EnableShift",false).toBool(); + ui_->cbDopplerTracking->setChecked(b); + ui_->doppler_widget->setVisible (ui_->cbDopplerTracking->isChecked ()); +// ui_->cbEnableShift->setChecked(sh); + m_DopplerMethod=settings_->value("DopplerMethod",0).toInt(); + int shVal=settings_->value("ShiftValue",0).toInt(); + ui_->sbibShift->setValue(shVal); + bool c=settings_->value("LockSkedFreq",false).toBool(); + ui_->cbLockSkedFreq->setChecked(c); + + switch (m_DopplerMethod) + { + case 0: ui_->rbNoDoppler->setChecked (true); break; + case 1: ui_->rbFullTrack->setChecked (true); break; + case 2: ui_->rbConstFreqOnMoon->setChecked (true); break; + case 3: ui_->rbOwnEcho->setChecked (true); break; + case 4: ui_->rbOnDxEcho->setChecked (true); break; + case 5: ui_->rbCallDx->setChecked (true); break; + case 10: ui_->rbNoDoppler->setChecked (true); break; + } + move (settings_->value ("window/pos", pos ()).toPoint ()); +} + +void Astro::write_settings () +{ + SettingsGroup g (settings_, "Astro"); + settings_->setValue ("DopplerTracking", ui_->cbDopplerTracking->isChecked()); + settings_->setValue ("DopplerMethod",m_DopplerMethod); + settings_->setValue ("window/pos", pos ()); + settings_->setValue ("EnableShift", ui_->cbEnableShift->isChecked()); + settings_->setValue ("ShiftValue",ui_->sbibShift->value()); + settings_->setValue ("LockSkedFreq",ui_->cbLockSkedFreq->isChecked()); +} + +auto Astro::astroUpdate(QDateTime const& t, QString const& mygrid, QString const& hisgrid, Frequency freq, + bool bEchoMode, bool bTx, bool bAuto, bool no_tx_QSY, double TR_period) -> Correction +{ + Frequency freq_moon {freq}; + double azsun,elsun,azmoon,elmoon,azmoondx,elmoondx; + double ramoon,decmoon,dgrd,poloffset,xnr,techo,width1,width2; + int ntsky; + QString date {t.date().toString("yyyy MMM dd").trimmed ()}; + QString utc {t.time().toString().trimmed ()}; + int nyear {t.date().year()}; + int month {t.date().month()}; + int nday {t.date().day()}; + int nhr {t.time().hour()}; + int nmin {t.time().minute()}; + double sec {t.time().second() + 0.001*t.time().msec()}; + double uth {nhr + nmin/60.0 + sec/3600.0}; + if(freq_moon < 1) freq_moon = 144000000; + auto const& AzElFileName = QDir::toNativeSeparators (configuration_->azel_directory ().absoluteFilePath ("azel.dat")); + auto const& jpleph = configuration_->data_dir ().absoluteFilePath ("JPLEPH"); + SettingsGroup g (settings_, "Configuration"); + bool extraazel=settings_->value("AzElExtraLines",false).toBool(); + astrosub(nyear, month, nday, uth, static_cast<double> (freq_moon), + mygrid.toLatin1 ().data (), + hisgrid.toLatin1().data(), + &azsun, &elsun, &azmoon, &elmoon, + &azmoondx, &elmoondx, &ntsky, &m_dop, &m_dop00, &ramoon, &decmoon, + &dgrd, &poloffset, &xnr, extraazel, &techo, &width1, &width2, + bTx, + AzElFileName.toLocal8Bit ().constData (), + jpleph.toLocal8Bit ().constData ()); + + QString message; + { + QTextStream out {&message}; + out << " " << date << "\n" + "UTC: " << utc << "\n" +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + << Qt::fixed +#else + << fixed +#endif + << qSetFieldWidth (6) + << qSetRealNumberPrecision (1) + << "Az: " << azmoon << "\n" + "El: " << elmoon << "\n" + "SelfDop:" << m_dop00 << "\n" + "Width: " << int(width1+0.5) << "\n" + << qSetRealNumberPrecision (2) + << "Delay: " << techo << "\n" + << qSetRealNumberPrecision (1) + << "DxAz: " << azmoondx << "\n" + "DxEl: " << elmoondx << "\n" + "DxDop: " << m_dop << "\n" + "DxWid: " << int(width2+0.5) << "\n" + "Dec: " << decmoon << "\n" + "SunAz: " << azsun << "\n" + "SunEl: " << elsun << "\n" + "Freq: " << freq / 1.e6 << "\n"; + if(freq>=5000000ull) { //Suppress data not relevant below VHF + out << "Tsky: " << ntsky << "\n" + "Dpol: " << poloffset << "\n" + "MNR: " << xnr << "\n" + "Dist: " << int((techo*149896)) << "\n" //wdg + "Dgrd: " << dgrd; + } + } + ui_->text_label->setText(message); + + Correction correction; + correction.dop=m_dop00; + correction.width=width1; + if(hisgrid!="" and !bAuto) { + correction.dop=m_dop; + correction.width=width2; + } + //ibShift=2000000; + + if (ui_->cbEnableShift->isChecked()) { + ibShift=ui_->sbibShift->value(); + ibShift=1000000*ibShift; + }else{ + ibShift=0; + } + + if (ui_->cbDopplerTracking->isChecked()) { + ui_->sbRIT->setEnabled(bEchoMode and m_DopplerMethod==0); + switch (m_DopplerMethod) + { + case 10: correction.rx = 0; + break; + case 1: // All Doppler correction done here; DX station stays at nominal dial frequency. + correction.rx = m_dop; + break; + case 4: // All Doppler correction done here; DX station stays at nominal dial frequency. (Trial for OnDxEcho) + correction.rx = m_dop; + break; + //case 5: // All Doppler correction done here; DX station stays at nominal dial frequency. + case 3: // Both stations do full correction on Rx and none on Tx + //correction.rx = bEchoMode ? m_dop00 : m_dop; + correction.rx = m_dop00; // Now always sets RX to *own* echo freq + break; + case 2: + // Doppler correction to constant frequency on Moon + correction.rx = m_dop00 / 2; + break; + default: correction.rx = 0; + break; + } + switch (m_DopplerMethod) + { + case 10: correction.tx = ibShift; + break; + case 1: correction.tx = -correction.rx + ibShift; + break; + //case 2: correction.tx = -correction.rx; + case 2: correction.tx = -correction.rx + ibShift; + break; + case 3: correction.tx = 0; + break; + case 4: // correction.tx = m_dop - m_dop00; + correction.tx = ibShift+(2 * (m_dop - (m_dop00/2))) - m_dop; + break; + case 5: correction.tx = ibShift- m_dop00; + break; + default: correction.tx = ibShift; + break; + } + + + if(bEchoMode && m_DopplerMethod == 1) correction.rx = 0; + if(10==m_DopplerMethod) { + correction.tx = ibShift; + correction.rx = 0; + } + + if (no_tx_QSY && 3 != m_DopplerMethod && 0 != m_DopplerMethod) + { + // calculate a single correction for transmit half way through + // the period as a compromise for rigs that can't CAT QSY + // while transmitting + // + // use a base time of (secs-since-epoch + 2) so as to be sure + // we do the next period if we calculate just before it starts + auto sec_since_epoch = t.toMSecsSinceEpoch ()/1000 + 2; + auto target_sec = sec_since_epoch - fmod(double(sec_since_epoch),TR_period) + 0.5*TR_period; + auto target_date_time = QDateTime::fromMSecsSinceEpoch (target_sec * 1000, Qt::UTC); + int nyear {target_date_time.date().year()}; + int month {target_date_time.date().month()}; + int nday {target_date_time.date().day()}; + int nhr {target_date_time.time().hour()}; + int nmin {target_date_time.time().minute()}; + double sec {target_date_time.time().second() + 0.001*target_date_time.time().msec()}; + double uth {nhr + nmin/60.0 + sec/3600.0}; + astrosub(nyear, month, nday, uth, static_cast<double> (freq_moon), + mygrid.toLatin1 ().data (), + hisgrid.toLatin1().data(), + &azsun, &elsun, &azmoon, &elmoon, + &azmoondx, &elmoondx, &ntsky, &m_dop, &m_dop00, &ramoon, &decmoon, + &dgrd, &poloffset, &xnr, extraazel, &techo, &width1, &width2, + bTx, + nullptr, // don't overwrite azel.dat + jpleph.toLocal8Bit ().constData ()); + + FrequencyDelta offset {0}; + switch (m_DopplerMethod) + { + case 10: + offset = -ibShift;// version for _7// maybe +? + break; + case 1: + // All Doppler correction done here; DX station stays at nominal dial frequency. + offset = bEchoMode ? (m_dop00 - ibShift) : (m_dop - ibShift); + break; + + case 2: + // Doppler correction to constant frequency on Moon + offset = (m_dop00 / 2) - ibShift; + break; + + case 4: + // Doppler correction for OnDxEcho + offset = m_dop - (2 * (m_dop - (m_dop00/2))) - ibShift;// maybe +? + break; + + //case 5: correction.tx = - m_dop00; + case 5: offset = m_dop00 - ibShift;// version for _7// maybe +? + break; + default: offset = -ibShift;// version for _7// maybe +? + break; + } + correction.tx = -offset; + //qDebug () << "correction.tx (no tx qsy):" << correction.tx; + } + } + correction.techo=techo; +// qDebug() << "AA0" << m_DopplerMethod << bAuto << correction.tx << correction.rx << correction.width; + return correction; +} + +void Astro::check_split () +{ + /* TEMPORARILY DISABLE + if (doppler_tracking () && !configuration_->split_mode ()) + { + MessageBox::warning_message (this, tr ("Doppler Tracking Error"), + tr ("Split operating is required for Doppler tracking"), + tr ("Go to \"Menu->File->Settings->Radio\" to enable split operation")); + ui_->rbNoDoppler->click (); + } + */ +} + +void Astro::on_rbFullTrack_clicked(bool) +{ + m_DopplerMethod = 1; + check_split (); + Q_EMIT tracking_update (); +} + +void Astro::on_rbOnDxEcho_clicked(bool) +{ + m_DopplerMethod = 4; + check_split (); + //if (checked) { + // m_dx_two_way_dop = 2 * (m_dop - (m_dop00/2)); + // qDebug () << "Starting Doppler:" << m_dx_two_way_dop; + //} + Q_EMIT tracking_update (); +} + +void Astro::on_rbOwnEcho_clicked(bool) +{ + m_DopplerMethod = 3; + check_split (); + Q_EMIT tracking_update (); +} + +void Astro::on_rbCallDx_clicked(bool) +{ + m_DopplerMethod = 5; + check_split (); + Q_EMIT tracking_update (); +} + +void Astro::on_rbConstFreqOnMoon_clicked(bool) +{ + m_DopplerMethod = 2; + check_split (); + Q_EMIT tracking_update (); +} + +void Astro::on_rbNoDoppler_clicked(bool) +{ + if (ui_->cbEnableShift->isChecked()) { + m_DopplerMethod = 10; + } else { + m_DopplerMethod = 0; + } + check_split (); + Q_EMIT tracking_update (); +} + +bool Astro::doppler_tracking () const +{ + return ui_->cbDopplerTracking->isChecked () && m_DopplerMethod; +} + +void Astro::on_cbDopplerTracking_toggled(bool) +{ + check_split (); + Q_EMIT tracking_update (); +} + +void Astro::nominal_frequency (Frequency rx, Frequency tx) +{ + if (!ui_->cbLockSkedFreq->isChecked() or astroStart or QGuiApplication::keyboardModifiers().testFlag(Qt::ControlModifier)) { + ui_->sked_frequency_label->setText (Radio::pretty_frequency_MHz_string (rx)); + ui_->sked_tx_frequency_label->setText (Radio::pretty_frequency_MHz_string (tx)); + if (ui_->cbEnableShift->isChecked()) ui_->sked_tx_frequency_label->setText ("N/A Tx Shift!"); + if (rx > 450000) astroStart = false; + } +} + +void Astro::hideEvent (QHideEvent * e) +{ + Q_EMIT tracking_update (); + QWidget::hideEvent (e); +} + +bool Astro::bDither() +{ + return ui_->cbDither->isChecked(); +} + +void Astro::selectOwnEcho() +{ + ui_->rbOwnEcho->click(); +} + +void Astro::selectOnDxEcho() +{ + ui_->rbOnDxEcho->click(); +} + +qint32 Astro::nfRIT() +{ + if(m_DopplerMethod==0) { + return ui_->sbRIT->value(); + } else { + return 0; + } +} + +qint32 Astro::DopplerMethod() +{ + return m_DopplerMethod; +} + +void Astro::on_pbSet_clicked() +{ + double freqMHz=int(m_skedFreq) + 0.001*ui_->sbSked_kHz->value(); + if (ui_->pbSet->hasFocus()) emit skedFreq(freqMHz); + ui_->pbSet->clearFocus(); +} + +void Astro::setSkedFreq(double freqMHz) +{ + m_skedFreq=freqMHz; + int MHz=m_skedFreq; + int kHz=qRound(1000*(m_skedFreq - MHz)); + ui_->sbSked_kHz->setValue(kHz); +} diff --git a/widgets/astro.h b/widgets/astro.h index 02554a42..f9d09154 100755..100644 --- a/widgets/astro.h +++ b/widgets/astro.h @@ -1,118 +1,123 @@ -// -*- Mode: C++ -*-
-#ifndef ASTRO_H
-#define ASTRO_H
-
-#include <utility>
-
-#include <QDialog>
-#include <QScopedPointer>
-
-#include "Radio.hpp"
-
-class QSettings;
-class Configuration;
-namespace Ui {
- class Astro;
-}
-
-class Astro final
- : public QDialog
-{
- Q_OBJECT;
-
-public:
- using Frequency = Radio::Frequency;
- using FrequencyDelta = Radio::FrequencyDelta;
-
- explicit Astro(QSettings * settings, Configuration const *, QWidget * parent = nullptr);
- ~Astro ();
-
- struct Correction
- {
- Correction ()
- : rx {0}
- , tx {0}
- , dop {0}
- , width {0}
- , techo {0}
- {}
- Correction (Correction const&) = default;
- Correction& operator = (Correction const&) = default;
-
- // testing facility used to test Doppler corrections on
- // terrestrial links
- void reverse ()
- {
- std::swap (rx, tx);
- }
-
- FrequencyDelta rx;
- FrequencyDelta tx;
- double dop;
- double width;
- double techo;
- };
-
- Correction astroUpdate(QDateTime const& t,
- QString const& mygrid,
- QString const& hisgrid,
- Frequency frequency,
- bool dx_is_self,
- bool bTx,
- bool bAuto,
- bool no_tx_QSY,
- double TR_period);
-
- bool doppler_tracking () const;
- bool bDither();
- void selectOwnEcho();
- void selectOnDxEcho();
- qint32 nfRIT();
- qint32 DopplerMethod();
- qint32 largeOffset();
-
- Q_SLOT void nominal_frequency (Frequency rx, Frequency tx);
- Q_SIGNAL void tracking_update () const;
-
-protected:
- void hideEvent (QHideEvent *) override;
- void closeEvent (QCloseEvent *) override;
-
-private slots:
- void on_rbConstFreqOnMoon_clicked(bool);
- void on_rbFullTrack_clicked(bool);
- void on_rbNoDoppler_clicked(bool);
- void on_rbOwnEcho_clicked(bool);
- void on_rbOnDxEcho_clicked(bool);
- void on_rbCallDx_clicked(bool);
- void on_cbDopplerTracking_toggled(bool);
-
-private:
- void read_settings ();
- void write_settings ();
- void check_split ();
-
- QSettings * settings_;
- Configuration const * configuration_;
- QScopedPointer<Ui::Astro> ui_;
-
- qint32 m_DopplerMethod;
- int m_dop;
- int m_dop00;
- int ibShift;
- //int m_dx_two_way_dop;
-};
-
-inline
-bool operator == (Astro::Correction const& lhs, Astro::Correction const& rhs)
-{
- return lhs.rx == rhs.rx && lhs.tx == rhs.tx;
-}
-
-inline
-bool operator != (Astro::Correction const& lhs, Astro::Correction const& rhs)
-{
- return !(lhs == rhs);
-}
-
-#endif // ASTRO_H
+// -*- Mode: C++ -*- +#ifndef ASTRO_H +#define ASTRO_H + +#include <utility> + +#include <QDialog> +#include <QScopedPointer> + +#include "Radio.hpp" + +class QSettings; +class Configuration; +namespace Ui { + class Astro; +} + +class Astro final + : public QDialog +{ + Q_OBJECT; + +public: + using Frequency = Radio::Frequency; + using FrequencyDelta = Radio::FrequencyDelta; + + explicit Astro(QSettings * settings, Configuration const *, QWidget * parent = nullptr); + ~Astro (); + + struct Correction + { + Correction () + : rx {0} + , tx {0} + , dop {0} + , width {0} + , techo {0} + {} + Correction (Correction const&) = default; + Correction& operator = (Correction const&) = default; + + // testing facility used to test Doppler corrections on + // terrestrial links + void reverse () + { + std::swap (rx, tx); + } + + FrequencyDelta rx; + FrequencyDelta tx; + double dop; + double width; + double techo; + }; + + Correction astroUpdate(QDateTime const& t, + QString const& mygrid, + QString const& hisgrid, + Frequency frequency, + bool dx_is_self, + bool bTx, + bool bAuto, + bool no_tx_QSY, + double TR_period); + + bool doppler_tracking () const; + bool bDither(); + void selectOwnEcho(); + void selectOnDxEcho(); + void setSkedFreq(double freqMHz); + qint32 nfRIT(); + qint32 DopplerMethod(); + qint32 largeOffset(); + + Q_SLOT void nominal_frequency (Frequency rx, Frequency tx); + Q_SIGNAL void tracking_update () const; + Q_SIGNAL void skedFreq(double freqMHz) const; + +protected: + void hideEvent (QHideEvent *) override; + void closeEvent (QCloseEvent *) override; + +private slots: + void on_rbConstFreqOnMoon_clicked(bool); + void on_rbFullTrack_clicked(bool); + void on_rbNoDoppler_clicked(bool); + void on_rbOwnEcho_clicked(bool); + void on_rbOnDxEcho_clicked(bool); + void on_rbCallDx_clicked(bool); + void on_cbDopplerTracking_toggled(bool); + void on_pbSet_clicked(); + +private: + void read_settings (); + void write_settings (); + void check_split (); + + QSettings * settings_; + Configuration const * configuration_; + QScopedPointer<Ui::Astro> ui_; + + double m_skedFreq; + qint32 m_DopplerMethod; + int m_dop; + int m_dop00; + int ibShift; + //int m_dx_two_way_dop; + bool astroStart = true; +}; + +inline +bool operator == (Astro::Correction const& lhs, Astro::Correction const& rhs) +{ + return lhs.rx == rhs.rx && lhs.tx == rhs.tx; +} + +inline +bool operator != (Astro::Correction const& lhs, Astro::Correction const& rhs) +{ + return !(lhs == rhs); +} + +#endif // ASTRO_H diff --git a/widgets/astro.ui b/widgets/astro.ui index 56a1428e..342dde42 100755..100644 --- a/widgets/astro.ui +++ b/widgets/astro.ui @@ -1,367 +1,469 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>Astro</class>
- <widget class="QWidget" name="Astro">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>356</width>
- <height>446</height>
- </rect>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <layout class="QGridLayout" name="gridLayout">
- <property name="sizeConstraint">
- <enum>QLayout::SetFixedSize</enum>
- </property>
- <item row="0" column="1">
- <widget class="QWidget" name="doppler_widget" native="true">
- <property name="styleSheet">
- <string notr="true">* {
- font-weight: normal;
-}</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QGroupBox" name="groupBox">
- <property name="title">
- <string>Doppler tracking</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <item>
- <widget class="QRadioButton" name="rbFullTrack">
- <property name="toolTip">
- <string><html><head/><body><p>One station does all Doppler shift correction, their QSO partner receives and transmits on the sked frequency.</p><p>If the rig does not accept CAT QSY commands while transmitting a single correction is applied for the whole transmit period.</p></body></html></string>
- </property>
- <property name="text">
- <string>Full Doppler to DX Grid</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="rbOwnEcho">
- <property name="toolTip">
- <string><html><head/><body><p>Transmit takes place on sked frequency and receive frequency is corrected for own echoes. </p><p>This mode can be used for calling CQ, or when using Echo mode.</p></body></html></string>
- </property>
- <property name="text">
- <string>Own Echo</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="rbConstFreqOnMoon">
- <property name="toolTip">
- <string><html><head/><body><p>Both stations correct for Doppler shift such that they would be heard on the moon at the sked frequency.</p><p>If the rig does not accept CAT QSY commands while transmitting a single correction is applied for the whole transmit period.</p><p>Use this option also for Echo mode.</p></body></html></string>
- </property>
- <property name="text">
- <string>Constant frequency on Moon</string>
- </property>
- <property name="checked">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="rbOnDxEcho">
- <property name="toolTip">
- <string><html><head/><body><p>DX station announces their TX Freq, which is entered as the Sked Freq. Correction applied to RX and TX so you appear on the DX's station's own echo Freq.</p><p>If the rig does not accept CAT QSY commands while transmitting a single correction is applied for the whole transmit period.</p></body></html></string>
- </property>
- <property name="text">
- <string>On DX Echo</string>
- </property>
- <property name="checked">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="rbCallDx">
- <property name="toolTip">
- <string><html><head/><body><p>Tune radio manually and select this mode to put your echo on the same frequency.</p><p>If the rig does not accept CAT QSY commands while transmitting a single correction is applied for the whole transmit period.</p></body></html></string>
- </property>
- <property name="text">
- <string>Call DX</string>
- </property>
- <property name="checked">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="rbNoDoppler">
- <property name="toolTip">
- <string><html><head/><body><p>No Doppler shift correction is applied. This may be used when the QSO partner does full Doppler correction to your grid square.</p></body></html></string>
- </property>
- <property name="text">
- <string>None</string>
- </property>
- <property name="checked">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="groupBox_3">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="title">
- <string>Sked frequency</string>
- </property>
- <layout class="QGridLayout" name="gridLayout_2" columnstretch="0,1">
- <item row="1" column="1">
- <widget class="QLabel" name="sked_tx_frequency_label">
- <property name="styleSheet">
- <string notr="true">* {
- font-family: Courier;
- font-size: 12pt;
- font-weight: bold;
-}</string>
- </property>
- <property name="text">
- <string>0</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QLabel" name="sked_frequency_label">
- <property name="styleSheet">
- <string notr="true">* {
- font-family: Courier;
- font-size: 12pt;
- font-weight: bold;
-}</string>
- </property>
- <property name="text">
- <string>0</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="0" column="0">
- <widget class="QLabel" name="label">
- <property name="styleSheet">
- <string notr="true">* {
- font-family: Courier;
- font-size: 12pt;
- font-weight: bold;
-}</string>
- </property>
- <property name="text">
- <string>Rx:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_2">
- <property name="styleSheet">
- <string notr="true">* {
- font-family: Courier;
- font-size: 12pt;
- font-weight: bold;
-}</string>
- </property>
- <property name="text">
- <string>Tx:</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0" colspan="2">
- <widget class="QLabel" name="label_3">
- <property name="text">
- <string><html><head/><body><p>Press and hold the CTRL key to adjust the sked frequency manually with the rig's VFO dial or enter frequency directly into the band entry field on the main window.</p></body></html></string>
- </property>
- <property name="textFormat">
- <enum>Qt::AutoText</enum>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="groupBox_2">
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>50</height>
- </size>
- </property>
- <property name="title">
- <string>Echo Mode</string>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout_3">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <item>
- <widget class="QSpinBox" name="sbRIT">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <property name="suffix">
- <string> Hz</string>
- </property>
- <property name="prefix">
- <string>RIT </string>
- </property>
- <property name="minimum">
- <number>-20000</number>
- </property>
- <property name="maximum">
- <number>20000</number>
- </property>
- <property name="singleStep">
- <number>100</number>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QCheckBox" name="cbDither">
- <property name="text">
- <string>Dither</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="groupBox_4">
- <property name="title">
- <string>Tx Shift relative to Rx Sked Freq</string>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout_4">
- <item>
- <widget class="QSpinBox" name="sbibShift">
- <property name="toolTip">
- <string>Enter large offset</string>
- </property>
- <property name="suffix">
- <string> MHz</string>
- </property>
- <property name="prefix">
- <string>Shift </string>
- </property>
- <property name="minimum">
- <number>-30</number>
- </property>
- <property name="maximum">
- <number>30</number>
- </property>
- <property name="singleStep">
- <number>1</number>
- </property>
- <property name="value">
- <number>0</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="cbEnableShift">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Enable</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item row="0" column="0">
- <layout class="QVBoxLayout" name="verticalLayout_3">
- <item alignment="Qt::AlignHCenter">
- <widget class="QLabel" name="text_label">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="styleSheet">
- <string notr="true">* {
- font-family: Courier;
- font-size: 12pt;
- font-weight: bold;
-}</string>
- </property>
- <property name="frameShadow">
- <enum>QFrame::Sunken</enum>
- </property>
- <property name="text">
- <string>Astro Data</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <property name="margin">
- <number>6</number>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QCheckBox" name="cbDopplerTracking">
- <property name="styleSheet">
- <string notr="true"/>
- </property>
- <property name="text">
- <string>Doppler tracking</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
+<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>Astro</class> + <widget class="QWidget" name="Astro"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>343</width> + <height>451</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <layout class="QGridLayout" name="gridLayout"> + <property name="sizeConstraint"> + <enum>QLayout::SetFixedSize</enum> + </property> + <item row="0" column="1"> + <widget class="QWidget" name="doppler_widget" native="true"> + <property name="styleSheet"> + <string notr="true">* { + font-weight: normal; +}</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <property name="leftMargin"> + <number>6</number> + </property> + <property name="topMargin"> + <number>6</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>3</number> + </property> + <item> + <widget class="QGroupBox" name="dt_groupBox"> + <property name="title"> + <string>Doppler tracking</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <property name="rightMargin"> + <number>6</number> + </property> + <item> + <widget class="QRadioButton" name="rbFullTrack"> + <property name="toolTip"> + <string><html><head/><body><p>One station does all Doppler shift correction, their QSO partner receives and transmits on the sked frequency.</p><p>If the rig does not accept CAT QSY commands while transmitting a single correction is applied for the whole transmit period.</p></body></html></string> + </property> + <property name="text"> + <string>Full Doppler to DX Grid</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="rbOwnEcho"> + <property name="toolTip"> + <string><html><head/><body><p>Transmit takes place on sked frequency and receive frequency is corrected for own echoes. </p><p>This mode can be used for calling CQ, or when using Echo mode.</p></body></html></string> + </property> + <property name="text"> + <string>Own Echo</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="rbConstFreqOnMoon"> + <property name="toolTip"> + <string><html><head/><body><p>Both stations correct for Doppler shift such that they would be heard on the moon at the sked frequency.</p><p>If the rig does not accept CAT QSY commands while transmitting a single correction is applied for the whole transmit period.</p><p>Use this option also for Echo mode.</p></body></html></string> + </property> + <property name="text"> + <string>Constant frequency on Moon</string> + </property> + <property name="checked"> + <bool>false</bool> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="rbOnDxEcho"> + <property name="toolTip"> + <string><html><head/><body><p>DX station announces their TX Freq, which is entered as the Sked Freq. Correction applied to RX and TX so you appear on the DX's station's own echo Freq.</p><p>If the rig does not accept CAT QSY commands while transmitting a single correction is applied for the whole transmit period.</p></body></html></string> + </property> + <property name="text"> + <string>On DX Echo</string> + </property> + <property name="checked"> + <bool>false</bool> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="rbCallDx"> + <property name="toolTip"> + <string><html><head/><body><p>Tune radio manually and select this mode to put your echo on the same frequency.</p><p>If the rig does not accept CAT QSY commands while transmitting a single correction is applied for the whole transmit period.</p></body></html></string> + </property> + <property name="text"> + <string>Call DX</string> + </property> + <property name="checked"> + <bool>false</bool> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="rbNoDoppler"> + <property name="toolTip"> + <string><html><head/><body><p>No Doppler shift correction is applied. This may be used when the QSO partner does full Doppler correction to your grid square.</p></body></html></string> + </property> + <property name="text"> + <string>None</string> + </property> + <property name="checked"> + <bool>false</bool> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="sf_groupBox"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="title"> + <string>Sked frequency</string> + </property> + <layout class="QGridLayout" name="gridLayout_2" columnstretch="1,1"> + <property name="rightMargin"> + <number>6</number> + </property> + <item row="3" column="0" colspan="2"> + <layout class="QGridLayout" name="gridLayout_sf" rowstretch="0,0" columnstretch="0,1"> + <property name="horizontalSpacing"> + <number>6</number> + </property> + <item row="0" column="0"> + <widget class="QLabel" name="label"> + <property name="styleSheet"> + <string notr="true">* { + font-family: Courier; + font-size: 12pt; + font-weight: bold; +}</string> + </property> + <property name="text"> + <string>Rx:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLabel" name="sked_frequency_label"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="styleSheet"> + <string notr="true">* { + font-family: Courier; + font-size: 12pt; + font-weight: bold; +}</string> + </property> + <property name="text"> + <string>0</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_2"> + <property name="styleSheet"> + <string notr="true">* { + font-family: Courier; + font-size: 12pt; + font-weight: bold; +}</string> + </property> + <property name="text"> + <string>Tx:</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLabel" name="sked_tx_frequency_label"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="styleSheet"> + <string notr="true">* { + font-family: Courier; + font-size: 12pt; + font-weight: bold; +}</string> + </property> + <property name="text"> + <string>0</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + </layout> + </item> + <item row="0" column="0" colspan="2"> + <layout class="QHBoxLayout" name="horizontalLayout_sf1" stretch="1,1"> + <item> + <widget class="MyCustomSpinBox" name="sbSked_kHz"> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="suffix"> + <string> kHz</string> + </property> + <property name="maximum"> + <number>999</number> + </property> + <property name="value"> + <number>65</number> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="pbSet"> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> + <property name="text"> + <string>Set kHz</string> + </property> + </widget> + </item> + </layout> + </item> + <item row="4" column="0" colspan="2"> + <layout class="QHBoxLayout" name="horizontalLayout_sf2" stretch="0,0"> + <item> + <widget class="QSpinBox" name="sbibShift"> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="toolTip"> + <string><html><head/><body><p>Tx shift relative to Rx sked frequency</p></body></html></string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="suffix"> + <string> MHz</string> + </property> + <property name="prefix"> + <string>Tx Shift </string> + </property> + <property name="minimum"> + <number>-30</number> + </property> + <property name="maximum"> + <number>30</number> + </property> + <property name="singleStep"> + <number>1</number> + </property> + <property name="value"> + <number>0</number> + </property> + </widget> + </item> + <item alignment="Qt::AlignRight"> + <widget class="QCheckBox" name="cbEnableShift"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Enable</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="em_groupBox"> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="title"> + <string>Echo Mode</string> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_3" stretch="0"> + <property name="rightMargin"> + <number>6</number> + </property> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_em" stretch="0,0"> + <item> + <widget class="QSpinBox" name="sbRIT"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="suffix"> + <string> Hz</string> + </property> + <property name="prefix"> + <string>RIT </string> + </property> + <property name="minimum"> + <number>-20000</number> + </property> + <property name="maximum"> + <number>20000</number> + </property> + <property name="singleStep"> + <number>100</number> + </property> + </widget> + </item> + <item alignment="Qt::AlignRight"> + <widget class="QCheckBox" name="cbDither"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Dither </string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_locksSkedFreq"> + <property name="leftMargin"> + <number>9</number> + </property> + <item> + <widget class="QCheckBox" name="cbLockSkedFreq"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Ctl-Lock Sked Freq</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + </item> + <item row="0" column="0"> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <item alignment="Qt::AlignHCenter"> + <widget class="QLabel" name="text_label"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="styleSheet"> + <string notr="true">* { + font-family: Courier; + font-size: 12pt; + font-weight: bold; +}</string> + </property> + <property name="frameShadow"> + <enum>QFrame::Sunken</enum> + </property> + <property name="text"> + <string>Astro Data</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="margin"> + <number>6</number> + </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QCheckBox" name="cbDopplerTracking"> + <property name="styleSheet"> + <string notr="true"/> + </property> + <property name="text"> + <string>Doppler tracking</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </item> + </layout> + </widget> + <customwidgets> + <customwidget> + <class>MyCustomSpinBox</class> + <extends>QSpinBox</extends> + <header location="global">mycustomspinbox.h</header> + </customwidget> + </customwidgets> + <resources/> + <connections/> +</ui> diff --git a/widgets/colorhighlighting.cpp b/widgets/colorhighlighting.cpp index 0723a1d3..e7e9dedd 100755..100644 --- a/widgets/colorhighlighting.cpp +++ b/widgets/colorhighlighting.cpp @@ -1,130 +1,130 @@ -#include "colorhighlighting.h"
-
-#include <QApplication>
-#include <QString>
-
-#include "SettingsGroup.hpp"
-#include "models/DecodeHighlightingModel.hpp"
-
-#include "ui_colorhighlighting.h"
-#include "moc_colorhighlighting.cpp"
-
-ColorHighlighting::ColorHighlighting (QSettings * settings, DecodeHighlightingModel const& highlight_model, QWidget * parent)
- : QDialog {parent}
- , ui {new Ui::ColorHighlighting}
- , settings_ {settings}
-{
- ui->setupUi(this);
- setWindowTitle (QApplication::applicationName () + " - Colors");
- read_settings ();
- set_items (highlight_model);
-}
-
-ColorHighlighting::~ColorHighlighting()
-{
- if (isVisible ()) write_settings ();
-}
-
-void ColorHighlighting::read_settings ()
-{
- SettingsGroup group {settings_, "ColorScheme"};
- restoreGeometry (settings_->value ("window/geometry").toByteArray ());
-}
-
-void ColorHighlighting::write_settings ()
-{
- SettingsGroup group {settings_, "ColorScheme"};
- settings_->setValue ("window/geometry", saveGeometry ());
-}
-
-void ColorHighlighting::set_items (DecodeHighlightingModel const& highlighting_model)
-{
- int index {0};
- for (auto const& item : highlighting_model.items ())
- {
- QLabel * example;
- QLabel * label;
- switch (index++)
- {
- case 0:
- example = ui->example1_label;
- label = ui->p1_label;
- break;
- case 1:
- example = ui->example2_label;
- label = ui->p2_label;
- break;
- case 2:
- example = ui->example3_label;
- label = ui->p3_label;
- break;
- case 3:
- example = ui->example4_label;
- label = ui->p4_label;
- break;
- case 4:
- example = ui->example5_label;
- label = ui->p5_label;
- break;
- case 5:
- example = ui->example6_label;
- label = ui->p6_label;
- break;
- case 6:
- example = ui->example7_label;
- label = ui->p7_label;
- break;
- case 7:
- example = ui->example8_label;
- label = ui->p8_label;
- break;
- case 8:
- example = ui->example9_label;
- label = ui->p9_label;
- break;
- case 9:
- example = ui->example10_label;
- label = ui->p10_label;
- break;
- case 10:
- example = ui->example11_label;
- label = ui->p11_label;
- break;
- case 11:
- example = ui->example12_label;
- label = ui->p12_label;
- break;
- case 12:
- example = ui->example13_label;
- label = ui->p13_label;
- break;
- case 13:
- example = ui->example14_label;
- label = ui->p14_label;
- break;
- case 14:
- example = ui->example15_label;
- label = ui->p15_label;
- break;
- case 15:
- example = ui->example16_label;
- label = ui->p16_label;
- break;
- default:
- continue;
- }
- auto style_sheet = example->parentWidget ()->styleSheet ();
- if (Qt::NoBrush != item.background_.style ())
- {
- style_sheet += QString {"; background-color: #%1"}.arg (item.background_.color ().rgb (), 8, 16, QLatin1Char {'0'});
- }
- if (Qt::NoBrush != item.foreground_.style ())
- {
- style_sheet += QString {"; color: #%1"}.arg (item.foreground_.color ().rgb (), 8, 16, QLatin1Char {'0'});
- }
- example->setStyleSheet (style_sheet);
- example->setEnabled (item.enabled_);
- label->setText (DecodeHighlightingModel::highlight_name (item.type_));
- label->setEnabled (item.enabled_);
- }
-}
+#include "colorhighlighting.h" + +#include <QApplication> +#include <QString> + +#include "SettingsGroup.hpp" +#include "models/DecodeHighlightingModel.hpp" + +#include "ui_colorhighlighting.h" +#include "moc_colorhighlighting.cpp" + +ColorHighlighting::ColorHighlighting (QSettings * settings, DecodeHighlightingModel const& highlight_model, QWidget * parent) + : QDialog {parent} + , ui {new Ui::ColorHighlighting} + , settings_ {settings} +{ + ui->setupUi(this); + setWindowTitle (QApplication::applicationName () + " - Colors"); + read_settings (); + set_items (highlight_model); +} + +ColorHighlighting::~ColorHighlighting() +{ + if (isVisible ()) write_settings (); +} + +void ColorHighlighting::read_settings () +{ + SettingsGroup group {settings_, "ColorScheme"}; + restoreGeometry (settings_->value ("window/geometry").toByteArray ()); +} + +void ColorHighlighting::write_settings () +{ + SettingsGroup group {settings_, "ColorScheme"}; + settings_->setValue ("window/geometry", saveGeometry ()); +} + +void ColorHighlighting::set_items (DecodeHighlightingModel const& highlighting_model) +{ + int index {0}; + for (auto const& item : highlighting_model.items ()) + { + QLabel * example; + QLabel * label; + switch (index++) + { + case 0: + example = ui->example1_label; + label = ui->p1_label; + break; + case 1: + example = ui->example2_label; + label = ui->p2_label; + break; + case 2: + example = ui->example3_label; + label = ui->p3_label; + break; + case 3: + example = ui->example4_label; + label = ui->p4_label; + break; + case 4: + example = ui->example5_label; + label = ui->p5_label; + break; + case 5: + example = ui->example6_label; + label = ui->p6_label; + break; + case 6: + example = ui->example7_label; + label = ui->p7_label; + break; + case 7: + example = ui->example8_label; + label = ui->p8_label; + break; + case 8: + example = ui->example9_label; + label = ui->p9_label; + break; + case 9: + example = ui->example10_label; + label = ui->p10_label; + break; + case 10: + example = ui->example11_label; + label = ui->p11_label; + break; + case 11: + example = ui->example12_label; + label = ui->p12_label; + break; + case 12: + example = ui->example13_label; + label = ui->p13_label; + break; + case 13: + example = ui->example14_label; + label = ui->p14_label; + break; + case 14: + example = ui->example15_label; + label = ui->p15_label; + break; + case 15: + example = ui->example16_label; + label = ui->p16_label; + break; + default: + continue; + } + auto style_sheet = example->parentWidget ()->styleSheet (); + if (Qt::NoBrush != item.background_.style ()) + { + style_sheet += QString {"; background-color: #%1"}.arg (item.background_.color ().rgb (), 8, 16, QLatin1Char {'0'}); + } + if (Qt::NoBrush != item.foreground_.style ()) + { + style_sheet += QString {"; color: #%1"}.arg (item.foreground_.color ().rgb (), 8, 16, QLatin1Char {'0'}); + } + example->setStyleSheet (style_sheet); + example->setEnabled (item.enabled_); + label->setText (DecodeHighlightingModel::highlight_name (item.type_)); + label->setEnabled (item.enabled_); + } +} diff --git a/widgets/colorhighlighting.h b/widgets/colorhighlighting.h index 15831015..69e0391c 100755..100644 --- a/widgets/colorhighlighting.h +++ b/widgets/colorhighlighting.h @@ -1,33 +1,33 @@ -#ifndef COLORHIGHLIGHTING_H_
-#define COLORHIGHLIGHTING_H_
-
-#include <QDialog>
-#include <QScopedPointer>
-
-class QSettings;
-class DecodeHighlightingModel;
-
-namespace Ui {
- class ColorHighlighting;
-}
-
-class ColorHighlighting final
-: public QDialog
-{
- Q_OBJECT;
-
- public:
- explicit ColorHighlighting(QSettings *, DecodeHighlightingModel const&, QWidget * parent = nullptr);
- ~ColorHighlighting ();
-
- Q_SLOT void set_items (DecodeHighlightingModel const&);
-
- private:
- void read_settings ();
- void write_settings ();
-
- QScopedPointer<Ui::ColorHighlighting> ui;
- QSettings * settings_;
-};
-
-#endif
+#ifndef COLORHIGHLIGHTING_H_ +#define COLORHIGHLIGHTING_H_ + +#include <QDialog> +#include <QScopedPointer> + +class QSettings; +class DecodeHighlightingModel; + +namespace Ui { + class ColorHighlighting; +} + +class ColorHighlighting final +: public QDialog +{ + Q_OBJECT; + + public: + explicit ColorHighlighting(QSettings *, DecodeHighlightingModel const&, QWidget * parent = nullptr); + ~ColorHighlighting (); + + Q_SLOT void set_items (DecodeHighlightingModel const&); + + private: + void read_settings (); + void write_settings (); + + QScopedPointer<Ui::ColorHighlighting> ui; + QSettings * settings_; +}; + +#endif diff --git a/widgets/colorhighlighting.ui b/widgets/colorhighlighting.ui index 258a718e..5242c402 100755..100644 --- a/widgets/colorhighlighting.ui +++ b/widgets/colorhighlighting.ui @@ -1,338 +1,338 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>ColorHighlighting</class>
- <widget class="QDialog" name="ColorHighlighting">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>382</width>
- <height>253</height>
- </rect>
- </property>
- <layout class="QGridLayout" name="gridLayout">
- <item row="1" column="0">
- <widget class="QLabel" name="example2_label">
- <property name="autoFillBackground">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>K1ABC</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="0" column="0">
- <widget class="QLabel" name="example1_label">
- <property name="autoFillBackground">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>K1ABC</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QLabel" name="p1_label">
- <property name="text">
- <string>CQ in message</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="example3_label">
- <property name="autoFillBackground">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>K1ABC</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QLabel" name="p2_label">
- <property name="text">
- <string>My Call in message</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QLabel" name="p3_label">
- <property name="text">
- <string>Transmitted message</string>
- </property>
- </widget>
- </item>
- <item row="3" column="0">
- <widget class="QLabel" name="example4_label">
- <property name="autoFillBackground">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>K1ABC</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="3" column="1">
- <widget class="QLabel" name="p4_label">
- <property name="text">
- <string>New DXCC</string>
- </property>
- </widget>
- </item>
- <item row="5" column="1">
- <widget class="QLabel" name="p6_label">
- <property name="text">
- <string>New Grid</string>
- </property>
- </widget>
- </item>
- <item row="4" column="1">
- <widget class="QLabel" name="p5_label">
- <property name="text">
- <string>New DXCC on Band</string>
- </property>
- </widget>
- </item>
- <item row="4" column="0">
- <widget class="QLabel" name="example5_label">
- <property name="autoFillBackground">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>K1ABC</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="5" column="0">
- <widget class="QLabel" name="example6_label">
- <property name="autoFillBackground">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>K1ABC</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="6" column="0">
- <widget class="QLabel" name="example7_label">
- <property name="autoFillBackground">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>K1ABC</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="7" column="1">
- <widget class="QLabel" name="p8_label">
- <property name="text">
- <string>New Call</string>
- </property>
- </widget>
- </item>
- <item row="6" column="1">
- <widget class="QLabel" name="p7_label">
- <property name="text">
- <string>New Grid on Band</string>
- </property>
- </widget>
- </item>
- <item row="7" column="0">
- <widget class="QLabel" name="example8_label">
- <property name="autoFillBackground">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>K1ABC</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="0" column="2">
- <widget class="QLabel" name="example9_label">
- <property name="autoFillBackground">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>K1ABC</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="1" column="2">
- <widget class="QLabel" name="example10_label">
- <property name="autoFillBackground">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>K1ABC</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="0" column="3">
- <widget class="QLabel" name="p9_label">
- <property name="text">
- <string>New Call on Band</string>
- </property>
- </widget>
- </item>
- <item row="1" column="3">
- <widget class="QLabel" name="p10_label">
- <property name="text">
- <string>Uploads to LotW</string>
- </property>
- </widget>
- </item>
- <item row="2" column="2">
- <widget class="QLabel" name="example11_label">
- <property name="autoFillBackground">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>K1ABC</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="3" column="2">
- <widget class="QLabel" name="example12_label">
- <property name="autoFillBackground">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>K1ABC</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="4" column="2">
- <widget class="QLabel" name="example13_label">
- <property name="autoFillBackground">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>K1ABC</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="5" column="2">
- <widget class="QLabel" name="example14_label">
- <property name="autoFillBackground">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>K1ABC</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="6" column="2">
- <widget class="QLabel" name="example15_label">
- <property name="autoFillBackground">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>K1ABC</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="7" column="2">
- <widget class="QLabel" name="example16_label">
- <property name="autoFillBackground">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>K1ABC</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="2" column="3">
- <widget class="QLabel" name="p11_label">
- <property name="text">
- <string>New Continent</string>
- </property>
- </widget>
- </item>
- <item row="3" column="3">
- <widget class="QLabel" name="p12_label">
- <property name="text">
- <string>New Continent on Band</string>
- </property>
- </widget>
- </item>
- <item row="4" column="3">
- <widget class="QLabel" name="p13_label">
- <property name="text">
- <string>New CQ Zone</string>
- </property>
- </widget>
- </item>
- <item row="5" column="3">
- <widget class="QLabel" name="p14_label">
- <property name="text">
- <string>New CQ Zone on Band</string>
- </property>
- </widget>
- </item>
- <item row="6" column="3">
- <widget class="QLabel" name="p15_label">
- <property name="text">
- <string>New ITU Zone</string>
- </property>
- </widget>
- </item>
- <item row="7" column="3">
- <widget class="QLabel" name="p16_label">
- <property name="text">
- <string>New ITU Zone on Band</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
+<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>ColorHighlighting</class> + <widget class="QDialog" name="ColorHighlighting"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>382</width> + <height>253</height> + </rect> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="1" column="0"> + <widget class="QLabel" name="example2_label"> + <property name="autoFillBackground"> + <bool>true</bool> + </property> + <property name="text"> + <string>K1ABC</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="example1_label"> + <property name="autoFillBackground"> + <bool>true</bool> + </property> + <property name="text"> + <string>K1ABC</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLabel" name="p1_label"> + <property name="text"> + <string>CQ in message</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="example3_label"> + <property name="autoFillBackground"> + <bool>true</bool> + </property> + <property name="text"> + <string>K1ABC</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLabel" name="p2_label"> + <property name="text"> + <string>My Call in message</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QLabel" name="p3_label"> + <property name="text"> + <string>Transmitted message</string> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="example4_label"> + <property name="autoFillBackground"> + <bool>true</bool> + </property> + <property name="text"> + <string>K1ABC</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QLabel" name="p4_label"> + <property name="text"> + <string>New DXCC</string> + </property> + </widget> + </item> + <item row="5" column="1"> + <widget class="QLabel" name="p6_label"> + <property name="text"> + <string>New Grid</string> + </property> + </widget> + </item> + <item row="4" column="1"> + <widget class="QLabel" name="p5_label"> + <property name="text"> + <string>New DXCC on Band</string> + </property> + </widget> + </item> + <item row="4" column="0"> + <widget class="QLabel" name="example5_label"> + <property name="autoFillBackground"> + <bool>true</bool> + </property> + <property name="text"> + <string>K1ABC</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="5" column="0"> + <widget class="QLabel" name="example6_label"> + <property name="autoFillBackground"> + <bool>true</bool> + </property> + <property name="text"> + <string>K1ABC</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="6" column="0"> + <widget class="QLabel" name="example7_label"> + <property name="autoFillBackground"> + <bool>true</bool> + </property> + <property name="text"> + <string>K1ABC</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="7" column="1"> + <widget class="QLabel" name="p8_label"> + <property name="text"> + <string>New Call</string> + </property> + </widget> + </item> + <item row="6" column="1"> + <widget class="QLabel" name="p7_label"> + <property name="text"> + <string>New Grid on Band</string> + </property> + </widget> + </item> + <item row="7" column="0"> + <widget class="QLabel" name="example8_label"> + <property name="autoFillBackground"> + <bool>true</bool> + </property> + <property name="text"> + <string>K1ABC</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QLabel" name="example9_label"> + <property name="autoFillBackground"> + <bool>true</bool> + </property> + <property name="text"> + <string>K1ABC</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QLabel" name="example10_label"> + <property name="autoFillBackground"> + <bool>true</bool> + </property> + <property name="text"> + <string>K1ABC</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="0" column="3"> + <widget class="QLabel" name="p9_label"> + <property name="text"> + <string>New Call on Band</string> + </property> + </widget> + </item> + <item row="1" column="3"> + <widget class="QLabel" name="p10_label"> + <property name="text"> + <string>Uploads to LotW</string> + </property> + </widget> + </item> + <item row="2" column="2"> + <widget class="QLabel" name="example11_label"> + <property name="autoFillBackground"> + <bool>true</bool> + </property> + <property name="text"> + <string>K1ABC</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="3" column="2"> + <widget class="QLabel" name="example12_label"> + <property name="autoFillBackground"> + <bool>true</bool> + </property> + <property name="text"> + <string>K1ABC</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="4" column="2"> + <widget class="QLabel" name="example13_label"> + <property name="autoFillBackground"> + <bool>true</bool> + </property> + <property name="text"> + <string>K1ABC</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="5" column="2"> + <widget class="QLabel" name="example14_label"> + <property name="autoFillBackground"> + <bool>true</bool> + </property> + <property name="text"> + <string>K1ABC</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="6" column="2"> + <widget class="QLabel" name="example15_label"> + <property name="autoFillBackground"> + <bool>true</bool> + </property> + <property name="text"> + <string>K1ABC</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="7" column="2"> + <widget class="QLabel" name="example16_label"> + <property name="autoFillBackground"> + <bool>true</bool> + </property> + <property name="text"> + <string>K1ABC</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="2" column="3"> + <widget class="QLabel" name="p11_label"> + <property name="text"> + <string>New Continent</string> + </property> + </widget> + </item> + <item row="3" column="3"> + <widget class="QLabel" name="p12_label"> + <property name="text"> + <string>New Continent on Band</string> + </property> + </widget> + </item> + <item row="4" column="3"> + <widget class="QLabel" name="p13_label"> + <property name="text"> + <string>New CQ Zone</string> + </property> + </widget> + </item> + <item row="5" column="3"> + <widget class="QLabel" name="p14_label"> + <property name="text"> + <string>New CQ Zone on Band</string> + </property> + </widget> + </item> + <item row="6" column="3"> + <widget class="QLabel" name="p15_label"> + <property name="text"> + <string>New ITU Zone</string> + </property> + </widget> + </item> + <item row="7" column="3"> + <widget class="QLabel" name="p16_label"> + <property name="text"> + <string>New ITU Zone on Band</string> + </property> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/widgets/displaytext.cpp b/widgets/displaytext.cpp index df410d74..1e2f6423 100755..100644 --- a/widgets/displaytext.cpp +++ b/widgets/displaytext.cpp @@ -1,1207 +1,1203 @@ -#include "displaytext.h"
-
-#include <vector>
-#include <algorithm>
-
-#include <QAudio>
-#include <QAudioOutput>
-#include <QSound>
-#include <QDir>
-#include <QCoreApplication>
-#include <QTimer>
-#include <QMouseEvent>
-#include <QDateTime>
-#include <QTextCharFormat>
-#include <QTextCursor>
-#include <QTextBlock>
-#include <QMenu>
-#include <QAction>
-#include <QListIterator>
-#include <QRegularExpression>
-#include <QScrollBar>
-
-#include "Configuration.hpp"
-#include "Decoder/decodedtext.h"
-#include "Network/LotWUsers.hpp"
-#include "models/DecodeHighlightingModel.hpp"
-#include "logbook/logbook.h"
-#include "Logger.hpp"
-
-#include "qt_helpers.hpp"
-#include "moc_displaytext.cpp"
-
-bool play_CQ = false;
-bool play_MyCall = false;
-bool play_DXCC = false;
-bool play_DXCCOB = false;
-bool play_Grid = false;
-bool play_GridOB = false;
-bool play_Continent = false;
-bool play_ContinentOB = false;
-bool play_CQZ = false;
-bool play_CQZOB = false;
-bool play_ITUZ = false;
-bool play_ITUZOB = false;
-bool muted = false;
-
-using SpecOp = Configuration::SpecialOperatingActivity;
-
-DisplayText::DisplayText(QWidget *parent)
- : QTextEdit(parent)
- , m_config {nullptr}
- , erase_action_ {new QAction {tr ("&Erase"), this}}
- , high_volume_ {false}
- , modified_vertical_scrollbar_max_ {-1}
-{
- setReadOnly (true);
- setUndoRedoEnabled (false);
- viewport ()->setCursor (Qt::ArrowCursor);
- setWordWrapMode (QTextOption::NoWrap);
-
- // max lines to limit heap usage
- document ()->setMaximumBlockCount (5000);
-
- // context menu erase action
- setContextMenuPolicy (Qt::CustomContextMenu);
- connect (this, &DisplayText::customContextMenuRequested, [this] (QPoint const& position) {
- auto * menu = createStandardContextMenu (position);
- menu->addAction (erase_action_);
- menu->exec (mapToGlobal (position));
- delete menu;
- });
- connect (erase_action_, &QAction::triggered, this, &DisplayText::erase);
-}
-
-void DisplayText::erase ()
-{
- clear ();
- Q_EMIT erased ();
-}
-
-void DisplayText::setContentFont(QFont const& font)
-{
- char_font_ = font;
- selectAll ();
- auto cursor = textCursor ();
- cursor.beginEditBlock ();
- auto char_format = cursor.charFormat ();
- char_format.setFont (char_font_);
- cursor.mergeCharFormat (char_format);
- cursor.clearSelection ();
- cursor.movePosition (QTextCursor::End);
-
- // position so viewport scrolled to left
- cursor.movePosition (QTextCursor::Up);
- cursor.movePosition (QTextCursor::StartOfLine);
- cursor.endEditBlock ();
-
- if (!high_volume_ || !m_config || !m_config->decodes_from_top ())
- {
- setTextCursor (cursor);
- ensureCursorVisible ();
- }
-}
-
-void DisplayText::mouseDoubleClickEvent(QMouseEvent *e)
-{
- Q_EMIT selectCallsign(e->modifiers ());
-}
-
-void DisplayText::insertLineSpacer(QString const& line)
-{
- insertText (line, "#d3d3d3");
-}
-
-namespace
-{
- using Highlight = DecodeHighlightingModel::Highlight;
- using highlight_types = std::vector<Highlight>;
- Highlight set_colours (Configuration const * config, QColor * bg, QColor * fg, highlight_types const& types)
- {
- Highlight result = Highlight::CQ;
- if (config)
- {
- QListIterator<DecodeHighlightingModel::HighlightInfo> it {config->decode_highlighting ().items ()};
- // iterate in reverse to honor priorities
- it.toBack ();
- while (it.hasPrevious ())
- {
- auto const& item = it.previous ();
- auto const& type = std::find (types.begin (), types.end (), item.type_);
- if (type != types.end () && item.enabled_)
- {
- if (item.background_.style () != Qt::NoBrush)
- {
- *bg = item.background_.color ();
- }
- if (item.foreground_.style () != Qt::NoBrush)
- {
- *fg = item.foreground_.color ();
- }
- result = item.type_;
- }
- }
- }
- return result; // highest priority enabled highlighting
- }
-}
-
-void DisplayText::insertText(QString const& text, QColor bg, QColor fg
- , QString const& call1, QString const& call2, QTextCursor::MoveOperation location)
-{
- auto cursor = textCursor ();
- cursor.movePosition (location);
- auto block_format = cursor.blockFormat ();
- auto format = cursor.blockCharFormat ();
- format.setFont (char_font_);
- block_format.clearBackground ();
- if (bg.isValid ())
- {
- block_format.setBackground (bg);
- }
- format.clearForeground ();
- if (fg.isValid ())
- {
- format.setForeground (fg);
- }
- if (cursor.position ())
- {
- cursor.insertBlock (block_format, format);
- }
- else
- {
- cursor.setBlockFormat (block_format);
- cursor.setBlockCharFormat (format);
- }
-
- int text_index {0};
- auto temp_format = format;
- if (call1.size ())
- {
- auto call_index = text.indexOf (call1);
- if (call_index != -1) // sanity check
- {
- auto pos = highlighted_calls_.find (call1);
- if (pos != highlighted_calls_.end ())
- {
- cursor.insertText(text.left (call_index));
- if (pos.value ().first.isValid ())
- {
- temp_format.setBackground (pos.value ().first);
- }
- if (pos.value ().second.isValid ())
- {
- temp_format.setForeground (pos.value ().second);
- }
- cursor.insertText(text.mid (call_index, call1.size ()), temp_format);
- text_index = call_index + call1.size ();
- }
- }
- }
- if (call2.size ())
- {
- auto call_index = text.indexOf (call2, text_index);
- if (call_index != -1) // sanity check
- {
- auto pos = highlighted_calls_.find (call2);
- if (pos != highlighted_calls_.end ())
- {
- temp_format = format;
- cursor.insertText(text.mid (text_index, call_index - text_index), format);
- if (pos.value ().second.isValid ())
- {
- temp_format.setBackground (pos.value ().first);
- }
- if (pos.value ().second.isValid ())
- {
- temp_format.setForeground (pos.value ().second);
- }
- cursor.insertText(text.mid (call_index, call2.size ()), temp_format);
- text_index = call_index + call2.size ();
- }
- }
- }
- cursor.insertText(text.mid (text_index), format);
-
- // position so viewport scrolled to left
- cursor.movePosition (QTextCursor::StartOfLine);
- if (!high_volume_ || !m_config || !m_config->decodes_from_top ())
- {
- setTextCursor (cursor);
- ensureCursorVisible ();
- }
- document ()->setMaximumBlockCount (document ()->maximumBlockCount ());
-}
-
-void DisplayText::extend_vertical_scrollbar (int min, int max)
-{
- if (high_volume_ && m_config && m_config->decodes_from_top ())
- {
- if (max && max != modified_vertical_scrollbar_max_)
- {
- setViewportMargins (0,4,0,0); // ensure first line is readable
- auto vp_margins = viewportMargins ();
- // add enough to vertical scroll bar range to allow last
- // decode to just scroll of the top of the view port
- max += viewport ()->height () - vp_margins.top () - vp_margins.bottom ();
- modified_vertical_scrollbar_max_ = max;
- }
- verticalScrollBar ()->setRange (min, max);
- }
-}
-
-void DisplayText::new_period ()
-{
- if (m_config->decodes_from_top ()) {
- document ()->setMaximumBlockCount (4800);
- document ()->setMaximumBlockCount (5000);
- }
- alertsTimer.stop ();
- disconnect (&alertsTimer, &QTimer::timeout, this, &DisplayText::AudioAlerts);
- if((m_config->alert_Enabled()) && ((m_config->alert_DXCC()) || (m_config->alert_DXCCOB()) || (m_config->alert_Grid()) ||
- (m_config->alert_GridOB()) || (m_config->alert_Continent()) || (m_config->alert_ContinentOB()) || (m_config->alert_CQZ()) ||
- (m_config->alert_CQZOB()) || (m_config->alert_ITUZ()) || (m_config->alert_ITUZOB()) || (m_config->alert_CQ()))) {
- connect (&alertsTimer, &QTimer::timeout, this, &DisplayText::AudioAlerts);
- alertsTimer.setSingleShot (true);
- alertsTimer.start (1000);
- }
-
- extend_vertical_scrollbar (verticalScrollBar ()->minimum (), verticalScrollBar ()->maximum ());
- if (high_volume_ && m_config && m_config->decodes_from_top () && !vertical_scroll_connection_)
- {
- vertical_scroll_connection_ = connect (verticalScrollBar (), &QScrollBar::rangeChanged
- , [this] (int min, int max) {
- extend_vertical_scrollbar (min, max );
- });
- }
- verticalScrollBar ()->setSliderPosition (verticalScrollBar ()->maximum ());
-}
-
-QString DisplayText::appendWorkedB4 (QString message, QString call, QString const& grid,
- QColor * bg, QColor * fg, LogBook const& logBook,
- QString const& currentBand, QString const& currentMode,
- QString extra)
-{
- QString countryName;
- bool callB4;
- bool callB4onBand;
- bool countryB4;
- bool countryB4onBand;
- bool gridB4;
- bool gridB4onBand;
- bool continentB4;
- bool continentB4onBand;
- bool CQZoneB4;
- bool CQZoneB4onBand;
- bool ITUZoneB4;
- bool ITUZoneB4onBand;
-
- if(call.length()==2) {
- int i0=message.indexOf("CQ "+call);
- call=message.mid(i0+6,-1);
- i0=call.indexOf(" ");
- call=call.mid(0,i0);
- }
- if(call.length()<3) return message;
- if(!call.contains(QRegExp("[0-9]|[A-Z]"))) return message;
-
- auto const& looked_up = logBook.countries ()->lookup (call);
- logBook.match (call, currentMode, grid, looked_up, callB4, countryB4, gridB4, continentB4, CQZoneB4, ITUZoneB4);
- logBook.match (call, currentMode, grid, looked_up, callB4onBand, countryB4onBand, gridB4onBand,
- continentB4onBand, CQZoneB4onBand, ITUZoneB4onBand, currentBand);
- if(grid=="") {
- gridB4=true;
- gridB4onBand=true;
- }
-
- if(callB4onBand) m_points=0;
-
- message = message.trimmed ();
-
- highlight_types types;
- // no shortcuts here as some types may be disabled
- if (!countryB4) {
- types.push_back (Highlight::DXCC);
- if (m_config->alert_DXCC()) {
- if (!muted) play_DXCC = true;
- }
- }
- if(!countryB4onBand) {
- types.push_back (Highlight::DXCCBand);
- if (m_config->alert_DXCCOB()) {
- if (!muted) play_DXCCOB = true;
- }
- }
- if(!gridB4) {
- types.push_back (Highlight::Grid);
- if (m_config->alert_Grid()) {
- if (!muted) play_Grid = true;
- }
- }
- if(!gridB4onBand) {
- types.push_back (Highlight::GridBand);
- if (m_config->alert_GridOB()) {
- if (!muted) play_GridOB = true;
- }
- }
- if (!callB4) {
- types.push_back (Highlight::Call);
- }
- if(!callB4onBand) {
- types.push_back (Highlight::CallBand);
- }
- if (!continentB4) {
- types.push_back (Highlight::Continent);
- if (m_config->alert_Continent()) {
- if (!muted) play_Continent = true;
- }
- }
- if(!continentB4onBand) {
- types.push_back (Highlight::ContinentBand);
- if (m_config->alert_ContinentOB()) {
- if (!muted) play_ContinentOB = true;
- }
- }
- if (!CQZoneB4) {
- types.push_back (Highlight::CQZone);
- if (m_config->alert_CQZ()) {
- if (!muted) play_CQZ = true;
- }
- }
- if(!CQZoneB4onBand) {
- types.push_back (Highlight::CQZoneBand);
- if (m_config->alert_CQZOB()) {
- if (!muted) play_CQZOB = true;
- }
- }
- if (!ITUZoneB4) {
- types.push_back (Highlight::ITUZone);
- if (m_config->alert_ITUZ()) {
- if (!muted) play_ITUZ = true;
- }
- }
- if(!ITUZoneB4onBand) {
- types.push_back (Highlight::ITUZoneBand);
- if (m_config->alert_ITUZOB()) {
- if (!muted) play_ITUZOB = true;
- }
- }
- if (m_config && m_config->lotw_users ().user (call))
- {
- types.push_back (Highlight::LotW);
- }
- types.push_back (Highlight::CQ);
- auto top_highlight = set_colours (m_config, bg, fg, types);
-
- switch (top_highlight)
- {
- case Highlight::Continent:
- case Highlight::ContinentBand:
- extra += AD1CCty::continent (looked_up.continent);
- break;
- case Highlight::CQZone:
- case Highlight::CQZoneBand:
- extra += QString {"CQ Zone %1"}.arg (looked_up.CQ_zone);
- break;
- case Highlight::ITUZone:
- case Highlight::ITUZoneBand:
- extra += QString {"ITU Zone %1"}.arg (looked_up.ITU_zone);
- break;
- default:
- if (m_bPrincipalPrefix)
- {
- extra += looked_up.primary_prefix;
- }
- else
- {
- auto countryName = looked_up.entity_name;
-
- // do some obvious abbreviations
- countryName.replace ("Islands", "Is.");
- countryName.replace ("Island", "Is.");
- countryName.replace ("North ", "N. ");
- countryName.replace ("Northern ", "N. ");
- countryName.replace ("South ", "S. ");
- countryName.replace ("East ", "E. ");
- countryName.replace ("Eastern ", "E. ");
- countryName.replace ("West ", "W. ");
- countryName.replace ("Western ", "W. ");
- countryName.replace ("Central ", "C. ");
- countryName.replace (" and ", " & ");
- countryName.replace ("Republic", "Rep.");
- countryName.replace ("United States of America", "U.S.A.");
- countryName.replace ("United States", "U.S.A.");
- countryName.replace ("Fed. Rep. of ", "");
- countryName.replace ("French ", "Fr.");
- countryName.replace ("Asiatic", "AS");
- countryName.replace ("European", "EU");
- countryName.replace ("African", "AF");
-
- // assign WAE entities to the correct DXCC when "Include extra WAE entities" is not selected
- if (!(m_config->include_WAE_entities())) {
- countryName.replace ("Bear Is.", "Svalbard");
- countryName.replace ("Shetland Is.", "Scotland");
- countryName.replace ("AF Italy", "Italy");
- countryName.replace ("Sicily", "Italy");
- countryName.replace ("Vienna Intl Ctr", "Austria");
- countryName.replace ("AF Turkey", "Turkey");
- countryName.replace ("EU Turkey", "Turkey");
- }
-
- extra += countryName;
- }
- }
- m_CQPriority=DecodeHighlightingModel::highlight_name(top_highlight);
-
- if(((m_points == 00) or (m_points == -1)) and m_bDisplayPoints) return message;
- return leftJustifyAppendage (message, extra);
-}
-
-QString DisplayText::leftJustifyAppendage (QString message, QString const& appendage0) const
-{
- QString appendage=appendage0;
- if(m_bDisplayPoints and (m_points>0)) {
- appendage=" " + QString::number(m_points);
- if(m_points<10) appendage=" " + appendage;
- }
- if (appendage.size ())
- {
- // allow for seconds
- int padding {message.indexOf (" ") > 4 ? 2 : 0};
-
- // use a nbsp to save the start of appended text so we can find
- // it again later, align appended data at a fixed column if
- // there is space otherwise let it float to the right
- int space_count;
- space_count = (40 + m_config->align_steps() + padding - message.size ());
- if (space_count > 0) {
- message += QString {space_count, QChar {' '}};
- }
- message += QChar::Nbsp + appendage;
- }
- return message;
-}
-
-void DisplayText::displayDecodedText(DecodedText const& decodedText, QString const& myCall,
- QString const& mode,
- bool displayDXCCEntity, LogBook const& logBook,
- QString const& currentBand, bool ppfx, bool bCQonly,
- bool haveFSpread, float fSpread, bool bDisplayPoints,
- int points, QString distance, bool alertsMuted)
-{
- m_points=points;
- m_bDisplayPoints=bDisplayPoints;
- m_bPrincipalPrefix=ppfx;
- muted=alertsMuted;
- QColor bg;
- QColor fg;
- bool CQcall = false;
- auto is_73 = decodedText.messageWords().filter (QRegularExpression {"^(73|RR73)$"}).size();
- if (decodedText.string ().contains (" CQ ")) {
- if (m_config->alert_CQ()) {
- if (!muted) play_CQ = true;
- }
- }
- if (decodedText.string ().contains (" CQ ")
- || decodedText.string ().contains (" CQDX ")
- || decodedText.string ().contains (" QRZ ")
- || (is_73 && (m_config->highlight_73 ())))
- {
- CQcall = true;
- }
- else
- {
- if (bCQonly) return;
- }
- auto message = decodedText.string();
- QString dxCall;
- QString dxGrid;
- decodedText.deCallAndGrid (/*out*/ dxCall, dxGrid);
- QRegularExpression grid_regexp {"\\A(?![Rr]{2}73)[A-Ra-r]{2}[0-9]{2}([A-Xa-x]{2}){0,1}\\z"};
- if(!dxGrid.contains(grid_regexp)) dxGrid="";
- message = message.left (message.indexOf (QChar::Nbsp)).trimmed (); // strip appended info
- QString extra;
- QString state; // NJ0A
-
- if (displayDXCCEntity && dxGrid.length() > 0 && logBook.countries ()->lookup (dxCall).primary_prefix == "K") {
- //std::cout << dxCall << " -> " << dxGrid << " " << logBook.countries ()->lookup (dxCall).primary_prefix <<"\n";
- if (m_config->GridMap()) {
- if (CQcall || is_73 || m_config->GridMapAll()) {
- state = logBook.countries ()->findState(dxGrid);
- }
- }
- }
- //NJ0A
-
- if (haveFSpread)
- {
- extra += QString {"%1"}.arg (fSpread, 5, 'f', fSpread < 0.95 ? 3 : 2) + QChar {' '};
- }
- auto ap_pos = message.lastIndexOf (QRegularExpression {R"((?:\?\s)?(?:a[0-9]|q[0-9][0-9*]?)$)"});
- if (ap_pos >= 0)
- {
- extra += message.mid (ap_pos) + QChar {' '};
- message = message.left (ap_pos).trimmed ();
- }
- m_CQPriority="";
- if (CQcall || (is_73 && m_config->highlight_73()) || (mode == "FT4" && m_config->highlight_73() && m_config->NCCC_Sprint()
- && (SpecOp::NA_VHF == m_config->special_op_id()) && decodedText.string().contains(" R ")))
- {
- if (displayDXCCEntity)
- {
- // if enabled add the DXCC entity and B4 status to the end of the
- // preformated text line t1
- auto currentMode = mode;
- message = appendWorkedB4 (message, dxCall, dxGrid, &bg, &fg
- , logBook, currentBand, currentMode, extra);
- }
- else
- {
- message = leftJustifyAppendage (message, extra);
- highlight_types types {Highlight::CQ};
- if (m_config && m_config->lotw_users ().user (decodedText.CQersCall()))
- {
- types.push_back (Highlight::LotW);
- }
- set_colours (m_config, &bg, &fg, types);
- }
- }
- else
- {
- if (m_config->show_country_names())
- {
- auto const& looked_up = logBook.countries ()->lookup (dxCall);
- auto countryName = looked_up.entity_name;
-
- if (m_bPrincipalPrefix) {
- extra += looked_up.primary_prefix;
- } else {
- // do some obvious abbreviations
- countryName.replace ("Islands", "Is.");
- countryName.replace ("Island", "Is.");
- countryName.replace ("North ", "N. ");
- countryName.replace ("Northern ", "N. ");
- countryName.replace ("South ", "S. ");
- countryName.replace ("East ", "E. ");
- countryName.replace ("Eastern ", "E. ");
- countryName.replace ("West ", "W. ");
- countryName.replace ("Western ", "W. ");
- countryName.replace ("Central ", "C. ");
- countryName.replace (" and ", " & ");
- countryName.replace ("Republic", "Rep.");
- countryName.replace ("United States of America", "U.S.A.");
- countryName.replace ("United States", "U.S.A.");
- countryName.replace ("Fed. Rep. of ", "");
- countryName.replace ("French ", "Fr.");
- countryName.replace ("Asiatic", "AS");
- countryName.replace ("European", "EU");
- countryName.replace ("African", "AF");
-
- // assign WAE entities to the correct DXCC when "Include extra WAE entities" is not selected
- if (!(m_config->include_WAE_entities())) {
- countryName.replace ("Bear Is.", "Svalbard");
- countryName.replace ("Shetland Is.", "Scotland");
- countryName.replace ("AF Italy", "Italy");
- countryName.replace ("Sicily", "Italy");
- countryName.replace ("Vienna Intl Ctr", "Austria");
- countryName.replace ("AF Turkey", "Turkey");
- countryName.replace ("EU Turkey", "Turkey");
- }
-
- extra += countryName;
- }
- message = leftJustifyAppendage(message, extra);
- }
- else
- {
- message = leftJustifyAppendage (message, extra);
- }
- }
-
- if (myCall.size ())
- {
- QString regexp {"[ <]" + myCall + "[ >]"};
- if (Radio::is_compound_callsign (myCall))
- {
- regexp = "(?:" + regexp + "|[ <]" + Radio::base_callsign (myCall) + "[ >])";
- }
- if ((decodedText.clean_string () + " ").contains (QRegularExpression {regexp}))
- {
- QStringList tw;
- if (mode == "FT8" or mode == "FT4" or mode == "MSK144") {
- tw=decodedText.string().mid(24).split(" ",SkipEmptyParts);
- } else {
- tw=decodedText.string().mid(22).split(" ",SkipEmptyParts);
- }
- if ((tw.size () > 0 && tw[0].contains(myCall)) or decodedText.clean_string().contains("; " + myCall)) {
- highlight_types types {Highlight::MyCall};
- set_colours (m_config, &bg, &fg, types);
- if (m_config->alert_MyCall()) play_MyCall = true;
- } else {
- highlight_types types {Highlight::Tx};
- set_colours (m_config, &bg, &fg, types);
- }
- }
- }
-
- if (m_config->GridMap() && !m_bDisplayPoints) {
- if (ppfx) { //NJ0A
- extra = " ";
- } else {
- extra = " ";
- }
- message = leftJustifyAppendage(message, state); //NJ0A
- }
-
- // display distance and azimuth
- if (distance.length() > 0) {
- if (m_config->align()) {
- if (!displayDXCCEntity) {
- message = leftJustifyAppendage (message, "[" + distance + "]");
- } else {
- QString space = " ";
- if (m_bPrincipalPrefix) {
- if (message.length() < (49 + m_config->align_steps() + m_config->align_steps2())) {
- message = leftJustifyAppendage ((message + (space.repeated(30))).left(48 + m_config->align_steps() + m_config->align_steps2()), "[" + distance + "]");
- } else {
- message = leftJustifyAppendage (message, " [" + distance + "]");
- }
- } else {
- if (message.length() < 59 + m_config->align_steps() + m_config->align_steps2()) {
- message = leftJustifyAppendage ((message + (space.repeated(40))).left(59 + m_config->align_steps() + m_config->align_steps2()), "[" + distance + "]");
- } else {
- message = leftJustifyAppendage (message, "[" + distance + "]");
- }
- }
- }
- } else {
- message = leftJustifyAppendage (message, "[" + distance + "]");
- }
- }
-
- // initialize audible alerts for MSK144 (still experimental)
- if(mode=="MSK144") {
- if ((m_config->alert_Enabled()) && ((m_config->alert_DXCC()) || (m_config->alert_DXCCOB()) || (m_config->alert_Grid()) ||
- (m_config->alert_GridOB()) || (m_config->alert_Continent()) || (m_config->alert_ContinentOB()) || (m_config->alert_CQZ()) ||
- (m_config->alert_CQZOB()) || (m_config->alert_ITUZ()) || (m_config->alert_ITUZOB()) || (m_config->alert_CQ()))) {
- alertsTimer.stop ();
- disconnect (&alertsTimer, &QTimer::timeout, this, &DisplayText::AudioAlerts);
- connect (&alertsTimer, &QTimer::timeout, this, &DisplayText::AudioAlerts);
- alertsTimer.setSingleShot (true);
- alertsTimer.start (1000);
- }
- }
-
- insertText (message.trimmed (), bg, fg, decodedText.call (), dxCall);
-}
-
-void DisplayText::displayTransmittedText(QString text, QString modeTx, qint32 txFreq,
- bool bFastMode, double TRperiod,bool bSuperfox)
-{
- QString t1=" @ ";
- if(modeTx=="FT4") t1=" + ";
- if(modeTx.contains("FT8")) t1=" ~ ";
- if(modeTx=="JT4") t1=" $ ";
- if(modeTx=="Q65") t1=" : ";
- if(modeTx=="JT65") t1=" # ";
- if(modeTx=="MSK144") t1=" & ";
- if(modeTx=="FST4") t1=" ` ";
- QString t2;
- t2 = t2.asprintf("%4d",txFreq);
- QString t;
- if(bFastMode or modeTx=="FT8" or modeTx=="FT4" or (TRperiod<60) or
- (modeTx=="Q65" and TRperiod==60)) {
- t = QDateTime::currentDateTimeUtc().toString("hhmmss") + \
- " Tx " + t2 + t1 + text;
- } else if(modeTx.mid(0,6)=="FT8fox") {
- t = QDateTime::currentDateTimeUtc().toString("hhmmss") + \
- " Tx" + modeTx.mid(7) + " " + text;
- } else {
- t = QDateTime::currentDateTimeUtc().toString("hhmm") + \
- " Tx " + t2 + t1 + text;
- }
- QColor bg;
- QColor fg;
- highlight_types types {Highlight::Tx};
- set_colours (m_config, &bg, &fg, types);
- if(bSuperfox and t.contains(";")) {
- int i0=t.indexOf(";");
- int i1=t.indexOf("<");
- int i2=t.indexOf(">");
- QString foxcall=t.mid(i1+1,i2-i1-1);
- t2=t.left(i0).replace(" RR73", " " + foxcall + " RR73");
- QString t3=t.left(24) + t.mid(i0+2,-1).remove("<").remove(">");
- insertText (t2, bg, fg);
- insertText (t3, bg, fg);
- } else {
- insertText (t, bg, fg);
- }
-}
-
-void DisplayText::displayQSY(QString text)
-{
- QString t = QDateTime::currentDateTimeUtc().toString("hhmmss") + " " + text;
- insertText (t, "hotpink");
-}
-
-void DisplayText::displayHoundToBeCalled(QString t, bool bAtTop, QColor bg, QColor fg)
-{
- if (bAtTop) t = t + "\n"; // need a newline when insertion at top
- insertText(t, bg, fg, "", "", bAtTop ? QTextCursor::Start : QTextCursor::End);
-}
-
-void DisplayText::setHighlightedHoundText(QString t) {
- QColor bg=QColor{255,255,255};
- QColor fg=QColor{0,0,0};
- highlight_types types{Highlight::Call};
- set_colours(m_config, &bg, &fg, types);
- // t is multiple lines of text, each line is a hound calling
- // iterate through each line and highlight the callsign
- auto lines = t.split(QChar('\n'), SkipEmptyParts);
- clear();
- foreach (auto line, lines)
- {
- auto fields = line.split(QChar(' '), SkipEmptyParts);
- insertText(line, bg, fg, fields.first(), QString{});
- }
-}
-
-namespace
-{
- void update_selection (QTextCursor& cursor, QColor const& bg, QColor const& fg)
- {
- QTextCharFormat format {cursor.charFormat ()};
- if (bg.isValid ())
- {
- format.setBackground (bg);
- }
- else
- {
- format.clearBackground ();
- }
- if (fg.isValid ())
- {
- format.setForeground (fg);
- }
- else
- {
- format.clearForeground ();
- }
- cursor.mergeCharFormat (format);
- }
-
- void reset_selection (QTextCursor& cursor)
- {
- // restore previous text format, we rely on the text
- // char format at he start of the selection being the
- // old one which should be the case
- auto c2 = cursor;
- c2.setPosition (c2.selectionStart ());
- cursor.setCharFormat (c2.charFormat ());
- }
-}
-
-namespace
-{
- QString get_timestamp (QTextCursor& cursor)
- {
- QString timestamp;
- if (cursor.movePosition (QTextCursor::PreviousCharacter)
- && cursor.movePosition (QTextCursor::StartOfLine)
- && cursor.movePosition (QTextCursor::EndOfWord, QTextCursor::KeepAnchor)
- && cursor.hasSelection ())
- {
- timestamp = cursor.selectedText ();
- cursor.movePosition (QTextCursor::StartOfLine);
- }
- return timestamp;
- }
-}
-
-void DisplayText::highlight_callsign (QString const& callsign, QColor const& bg,
- QColor const& fg, bool last_period_only)
-{
- auto regexp = callsign;
- if (!callsign.size () || callsign == "" || callsign == " " || callsign == "0")
- {
- return;
- }
- if (callsign == "CLEARALL!") // programmatic means of clearing all highlighting
- {
- highlighted_calls_.clear();
- return;
- }
- // allow for hashed callsigns and escape any regexp metacharacters
- QRegularExpression target {QString {"<?"}
- + regexp.replace (QLatin1Char {'+'}, QLatin1String {"\\+"})
- .replace (QLatin1Char {'.'}, QLatin1String {"\\."})
- .replace (QLatin1Char {'?'}, QLatin1String {"\\?"})
- + QString {">?"}
- , QRegularExpression::DontCaptureOption};
- QTextCharFormat old_format {currentCharFormat ()};
- QTextCursor cursor {document ()};
- if (last_period_only)
- {
- // highlight each instance of the given callsign (word) in the
- // current period
- cursor.movePosition (QTextCursor::End);
- QTextCursor period_start {cursor};
- QTextCursor prior {cursor};
- auto period_timestamp = get_timestamp (period_start);
- while (period_timestamp.size () && period_timestamp == get_timestamp (prior))
- {
- period_start = prior;
- }
- cursor = period_start;
- while (!cursor.isNull ())
- {
- cursor = document ()->find (target, cursor, QTextDocument::FindWholeWords);
- if (!cursor.isNull () && cursor.hasSelection ())
- {
- if (bg.isValid () || fg.isValid ())
- {
- update_selection (cursor, bg, fg);
- }
- else
- {
- reset_selection (cursor);
- }
- }
- }
- }
- else
- {
- auto pos = highlighted_calls_.find (callsign);
- if (bg.isValid () || fg.isValid ())
- {
- auto colours = qMakePair (bg, fg);
- if (pos == highlighted_calls_.end ())
- {
- pos = highlighted_calls_.insert (callsign.toUpper (), colours);
- }
- else
- {
- pos.value () = colours; // update colours
- }
- while (!cursor.isNull ())
- {
- cursor = document ()->find (target, cursor, QTextDocument::FindWholeWords);
- if (!cursor.isNull () && cursor.hasSelection ())
- {
- update_selection (cursor, bg, fg);
- }
- }
- }
- else
- {
- if (pos != highlighted_calls_.end ())
- {
- highlighted_calls_.erase (pos);
- }
- QTextCursor cursor {document ()};
- while (!cursor.isNull ())
- {
- cursor = document ()->find (target, cursor, QTextDocument::FindWholeWords);
- if (!cursor.isNull () && cursor.hasSelection ())
- {
- reset_selection (cursor);
- }
- }
- }
- }
- setCurrentCharFormat (old_format);
-}
-
-void DisplayText::AudioAlerts()
-{
-#ifdef WIN32
- if(m_config->alert_Enabled()) {
- QAudioOutput info(QAudioDeviceInfo::defaultOutputDevice());
- QString binPath = QCoreApplication::applicationDirPath();
- QAudioFormat format;
- format.setCodec("audio/pcm");
- format.setSampleRate (48000);
- format.setChannelCount (1);
- format.setSampleSize (16);
- format.setSampleType(QAudioFormat::SignedInt);
- QAudioOutput* audio;
- audio = new QAudioOutput(format, this);
- connect(audio, SIGNAL(stateChanged(QAudio::State)), this, SLOT(handleStateChanged(QAudio::State)));
-#else
- if(m_config->alert_Enabled()) {
- QString binPath = QCoreApplication::applicationDirPath();
-#endif
- QFile *effect2 = new QFile(this);
- QFile *effect3 = new QFile(this);
- QFile *effect4 = new QFile(this);
- QFile *effect5 = new QFile(this);
- QFile *effect6 = new QFile(this);
- QFile *effect7 = new QFile(this);
- QFile *effect8 = new QFile(this);
- QFile *effect9 = new QFile(this);
- QFile *effect10 = new QFile(this);
- QFile *effect11 = new QFile(this);
- QFile *effect12 = new QFile(this);
- QFile *effect13 = new QFile(this);
- effect2->setFileName(QString("%1/%2").arg(binPath, "/sounds/MyCall.wav"));
- effect3->setFileName(QString("%1/%2").arg(binPath, "/sounds/DXCC.wav"));
- effect4->setFileName(QString("%1/%2").arg(binPath, "/sounds/DXCCOnBand.wav"));
- effect5->setFileName(QString("%1/%2").arg(binPath, "/sounds/Continent.wav"));
- effect6->setFileName(QString("%1/%2").arg(binPath, "/sounds/ContinentOnBand.wav"));
- effect7->setFileName(QString("%1/%2").arg(binPath, "/sounds/CQZone.wav"));
- effect8->setFileName(QString("%1/%2").arg(binPath, "/sounds/CQZoneOnBand.wav"));
- effect9->setFileName(QString("%1/%2").arg(binPath, "/sounds/ITUZone.wav"));
- effect10->setFileName(QString("%1/%2").arg(binPath, "/sounds/ITUZoneOnBand.wav"));
- effect11->setFileName(QString("%1/%2").arg(binPath, "/sounds/Grid.wav"));
- effect12->setFileName(QString("%1/%2").arg(binPath, "/sounds/GridOnBand.wav"));
- effect13->setFileName(QString("%1/%2").arg(binPath, "/sounds/CQ.wav"));
- static int startIndex = 0;
- int nextStartIndex = startIndex +1;
- switch (startIndex) {
- case 0:
- if (play_MyCall) {
-
-#ifdef WIN32
- effect2->open(QIODevice::ReadOnly);
- audio->start(effect2);
-#else
- QSound::play(binPath + "/sounds/MyCall.wav"); // for Linux and macOS
-#endif
-
- play_MyCall = false;
- alertsTimer.start (1000);
- startIndex = nextStartIndex;
- return;
- } else {
- nextStartIndex++;
- }
- Q_FALLTHROUGH();
- case 1:
- if (play_DXCC) {
-
-#ifdef WIN32
- effect3->open(QIODevice::ReadOnly);
- audio->start(effect3);
-#else
- QSound::play(binPath + "/sounds/DXCC.wav"); // for Linux and macOS
-#endif
-
- play_DXCC = false;
- play_DXCCOB = false;
- alertsTimer.start (1200);
- startIndex = nextStartIndex;
- return;
- } else {
- nextStartIndex++;
- }
- Q_FALLTHROUGH();
- case 2:
- if (play_DXCCOB && !play_DXCC) {
-#ifdef WIN32
- effect4->open(QIODevice::ReadOnly);
- audio->start(effect4);
-#else
- QSound::play(binPath + "/sounds/DXCCOnBand.wav"); // for Linux and macOS
-#endif
-
- play_DXCCOB = false;
- alertsTimer.start (1800);
- startIndex = nextStartIndex;
- return;
- } else {
- nextStartIndex++;
- }
- Q_FALLTHROUGH();
- case 3:
- if (play_Continent) {
-
-#ifdef WIN32
- effect5->open(QIODevice::ReadOnly);
- audio->start(effect5);
-#else
- QSound::play(binPath + "/sounds/Continent.wav"); // for Linux and macOS
-#endif
- play_Continent = false;
- play_ContinentOB = false;
- play_GridOB = false;
- play_CQZOB = false;
- play_ITUZOB = false;
- alertsTimer.start (1000);
- startIndex = nextStartIndex;
- return;
- } else {
- nextStartIndex++;
- }
- Q_FALLTHROUGH();
- case 4:
- if (play_ContinentOB && !play_Continent) {
-#ifdef WIN32
- effect6->open(QIODevice::ReadOnly);
- audio->start(effect6);
-#else
- QSound::play(binPath + "/sounds/ContinentOnBand.wav"); // for Linux and macOS
-#endif
- play_ContinentOB = false;
- play_GridOB = false;
- play_CQZOB = false;
- play_ITUZOB = false;
- alertsTimer.start (2000);
- startIndex = nextStartIndex;
- return;
- } else {
- nextStartIndex++;
- }
- Q_FALLTHROUGH();
- case 5:
- if (play_CQZ) {
-#ifdef WIN32
- effect7->open(QIODevice::ReadOnly);
- audio->start(effect7);
-#else
- QSound::play(binPath + "/sounds/CQZone.wav"); // for Linux and macOS
-#endif
- play_CQZ = false;
- play_CQZOB = false;
- alertsTimer.start (1500);
- startIndex = nextStartIndex;
- return;
- } else {
- nextStartIndex++;
- }
- Q_FALLTHROUGH();
- case 6:
- if (play_CQZOB && !play_CQZ) {
-#ifdef WIN32
- effect8->open(QIODevice::ReadOnly);
- audio->start(effect8);
-#else
- QSound::play(binPath + "/sounds/CQZoneOnBand.wav"); // for Linux and macOS
-#endif
- play_CQZOB = false;
- alertsTimer.start (1800);
- startIndex = nextStartIndex;
- return;
- } else {
- nextStartIndex++;
- }
- Q_FALLTHROUGH();
- case 7:
- if (play_ITUZ) {
-#ifdef WIN32
- effect9->open(QIODevice::ReadOnly);
- audio->start(effect9);
-#else
- QSound::play(binPath + "/sounds/ITUZone.wav"); // for Linux and macOS
-#endif
- play_ITUZ = false;
- play_ITUZOB = false;
- play_GridOB = false;
- alertsTimer.start (1500);
- startIndex = nextStartIndex;
- return;
- } else {
- nextStartIndex++;
- }
- Q_FALLTHROUGH();
- case 8:
- if (play_ITUZOB && !(play_ITUZ)) {
-#ifdef WIN32
- effect10->open(QIODevice::ReadOnly);
- audio->start(effect10);
-#else
- QSound::play(binPath + "/sounds/ITUZoneOnBand.wav"); // for Linux and macOS
-#endif
- play_ITUZOB = false;
- play_GridOB = false;
- alertsTimer.start (1900);
- startIndex = nextStartIndex;
- return;
- } else {
- nextStartIndex++;
- }
- Q_FALLTHROUGH();
- case 9:
- if (play_Grid) {
-#ifdef WIN32
- effect11->open(QIODevice::ReadOnly);
- audio->start(effect11);
-#else
- QSound::play(binPath + "/sounds/Grid.wav"); // for Linux and macOS
-#endif
- play_Grid = false;
- play_GridOB = false;
- alertsTimer.start (1000);
- startIndex = nextStartIndex;
- return;
- } else {
- nextStartIndex++;
- }
- Q_FALLTHROUGH();
- case 10:
- if (play_GridOB && !play_Grid) {
-#ifdef WIN32
- effect12->open(QIODevice::ReadOnly);
- audio->start(effect12);
-#else
- QSound::play(binPath + "/sounds/GridOnBand.wav"); // for Linux and macOS
-#endif
- play_GridOB = false;
- alertsTimer.start (1500);
- startIndex = nextStartIndex;
- return;
- } else {
- nextStartIndex++;
- }
- Q_FALLTHROUGH();
- case 11:
- if (play_CQ) {
-#ifdef WIN32
- effect13->open(QIODevice::ReadOnly);
- audio->start(effect13);
-#else
- QSound::play(binPath + "/sounds/CQ.wav"); // for Linux and macOS
-#endif
- play_CQ = false;
- alertsTimer.start (1000);
- nextStartIndex++;
- return;
- } else {
- nextStartIndex++;
- }
- Q_FALLTHROUGH();
- case 12:
- // stop any running alerts timer, clear temp data, and restart alerts timer
- alertsTimer.stop ();
-#ifdef WIN32
- effect2->close();
- effect2->deleteLater();
- effect3->close();
- effect3->deleteLater();
- effect4->close();
- effect4->deleteLater();
- effect5->close();
- effect5->deleteLater();
- effect6->close();
- effect6->deleteLater();
- effect7->close();
- effect7->deleteLater();
- effect8->close();
- effect8->deleteLater();
- effect9->close();
- effect9->deleteLater();
- effect10->close();
- effect10->deleteLater();
- effect11->close();
- effect11->deleteLater();
- effect12->close();
- effect12->deleteLater();
- effect13->close();
- effect13->deleteLater();
- audio->deleteLater(); // remove QAudioSink to avoid a memory leak
-#endif
- alertsTimer.start (1250);
- startIndex = 0;
- return;
- }
- }
-}
+#include "displaytext.h" + +#include <vector> +#include <algorithm> + +#include <QAudio> +#include <QAudioOutput> +#include <QSound> +#include <QDir> +#include <QCoreApplication> +#include <QTimer> +#include <QMouseEvent> +#include <QDateTime> +#include <QTextCharFormat> +#include <QTextCursor> +#include <QTextBlock> +#include <QMenu> +#include <QAction> +#include <QListIterator> +#include <QRegularExpression> +#include <QScrollBar> + +#include "Configuration.hpp" +#include "Decoder/decodedtext.h" +#include "Network/LotWUsers.hpp" +#include "models/DecodeHighlightingModel.hpp" +#include "logbook/logbook.h" +#include "Logger.hpp" + +#include "qt_helpers.hpp" +#include "moc_displaytext.cpp" + +bool play_CQ = false; +bool play_MyCall = false; +bool play_DXCC = false; +bool play_DXCCOB = false; +bool play_Grid = false; +bool play_GridOB = false; +bool play_Continent = false; +bool play_ContinentOB = false; +bool play_CQZ = false; +bool play_CQZOB = false; +bool play_ITUZ = false; +bool play_ITUZOB = false; +bool muted = false; + +using SpecOp = Configuration::SpecialOperatingActivity; + +DisplayText::DisplayText(QWidget *parent) + : QTextEdit(parent) + , m_config {nullptr} + , erase_action_ {new QAction {tr ("&Erase"), this}} + , high_volume_ {false} + , modified_vertical_scrollbar_max_ {-1} +{ + setReadOnly (true); + setUndoRedoEnabled (false); + viewport ()->setCursor (Qt::ArrowCursor); + setWordWrapMode (QTextOption::NoWrap); + + // max lines to limit heap usage + document ()->setMaximumBlockCount (5000); + + // context menu erase action + setContextMenuPolicy (Qt::CustomContextMenu); + connect (this, &DisplayText::customContextMenuRequested, [this] (QPoint const& position) { + auto * menu = createStandardContextMenu (position); + menu->addAction (erase_action_); + menu->exec (mapToGlobal (position)); + delete menu; + }); + connect (erase_action_, &QAction::triggered, this, &DisplayText::erase); +} + +void DisplayText::erase () +{ + clear (); + Q_EMIT erased (); +} + +void DisplayText::setContentFont(QFont const& font) +{ + char_font_ = font; + selectAll (); + auto cursor = textCursor (); + cursor.beginEditBlock (); + auto char_format = cursor.charFormat (); + char_format.setFont (char_font_); + cursor.mergeCharFormat (char_format); + cursor.clearSelection (); + cursor.movePosition (QTextCursor::End); + + // position so viewport scrolled to left + cursor.movePosition (QTextCursor::Up); + cursor.movePosition (QTextCursor::StartOfLine); + cursor.endEditBlock (); + + if (!high_volume_ || !m_config || !m_config->decodes_from_top ()) + { + setTextCursor (cursor); + ensureCursorVisible (); + } +} + +void DisplayText::mouseDoubleClickEvent(QMouseEvent *e) +{ + Q_EMIT selectCallsign(e->modifiers ()); +} + +void DisplayText::insertLineSpacer(QString const& line) +{ + insertText (line, "#d3d3d3"); +} + +namespace +{ + using Highlight = DecodeHighlightingModel::Highlight; + using highlight_types = std::vector<Highlight>; + Highlight set_colours (Configuration const * config, QColor * bg, QColor * fg, highlight_types const& types) + { + Highlight result = Highlight::CQ; + if (config) + { + QListIterator<DecodeHighlightingModel::HighlightInfo> it {config->decode_highlighting ().items ()}; + // iterate in reverse to honor priorities + it.toBack (); + while (it.hasPrevious ()) + { + auto const& item = it.previous (); + auto const& type = std::find (types.begin (), types.end (), item.type_); + if (type != types.end () && item.enabled_) + { + if (item.background_.style () != Qt::NoBrush) + { + *bg = item.background_.color (); + } + if (item.foreground_.style () != Qt::NoBrush) + { + *fg = item.foreground_.color (); + } + result = item.type_; + } + } + } + return result; // highest priority enabled highlighting + } +} + +void DisplayText::insertText(QString const& text, QColor bg, QColor fg + , QString const& call1, QString const& call2, QTextCursor::MoveOperation location) +{ + auto cursor = textCursor (); + cursor.movePosition (location); + auto block_format = cursor.blockFormat (); + auto format = cursor.blockCharFormat (); + format.setFont (char_font_); + block_format.clearBackground (); + if (bg.isValid ()) + { + block_format.setBackground (bg); + } + format.clearForeground (); + if (fg.isValid ()) + { + format.setForeground (fg); + } + if (cursor.position ()) + { + cursor.insertBlock (block_format, format); + } + else + { + cursor.setBlockFormat (block_format); + cursor.setBlockCharFormat (format); + } + + int text_index {0}; + auto temp_format = format; + if (call1.size ()) + { + auto call_index = text.indexOf (call1); + if (call_index != -1) // sanity check + { + auto pos = highlighted_calls_.find (call1); + if (pos != highlighted_calls_.end ()) + { + cursor.insertText(text.left (call_index)); + if (pos.value ().first.isValid ()) + { + temp_format.setBackground (pos.value ().first); + } + if (pos.value ().second.isValid ()) + { + temp_format.setForeground (pos.value ().second); + } + cursor.insertText(text.mid (call_index, call1.size ()), temp_format); + text_index = call_index + call1.size (); + } + } + } + if (call2.size ()) + { + auto call_index = text.indexOf (call2, text_index); + if (call_index != -1) // sanity check + { + auto pos = highlighted_calls_.find (call2); + if (pos != highlighted_calls_.end ()) + { + temp_format = format; + cursor.insertText(text.mid (text_index, call_index - text_index), format); + if (pos.value ().second.isValid ()) + { + temp_format.setBackground (pos.value ().first); + } + if (pos.value ().second.isValid ()) + { + temp_format.setForeground (pos.value ().second); + } + cursor.insertText(text.mid (call_index, call2.size ()), temp_format); + text_index = call_index + call2.size (); + } + } + } + cursor.insertText(text.mid (text_index), format); + + // position so viewport scrolled to left + cursor.movePosition (QTextCursor::StartOfLine); + if (!high_volume_ || !m_config || !m_config->decodes_from_top ()) + { + setTextCursor (cursor); + ensureCursorVisible (); + } + document ()->setMaximumBlockCount (document ()->maximumBlockCount ()); +} + +void DisplayText::extend_vertical_scrollbar (int min, int max) +{ + if (high_volume_ && m_config && m_config->decodes_from_top ()) + { + if (max && max != modified_vertical_scrollbar_max_) + { + setViewportMargins (0,4,0,0); // ensure first line is readable + auto vp_margins = viewportMargins (); + // add enough to vertical scroll bar range to allow last + // decode to just scroll of the top of the view port + max += viewport ()->height () - vp_margins.top () - vp_margins.bottom (); + modified_vertical_scrollbar_max_ = max; + } + verticalScrollBar ()->setRange (min, max); + } +} + +void DisplayText::new_period () +{ + if (m_config->decodes_from_top ()) { + document ()->setMaximumBlockCount (4800); + document ()->setMaximumBlockCount (5000); + } + alertsTimer.stop (); + disconnect (&alertsTimer, &QTimer::timeout, this, &DisplayText::AudioAlerts); + if (m_config->alert_Enabled() && (m_config->alert_MyCall() || m_config->alert_DXCC() || m_config->alert_DXCCOB() || + m_config->alert_Grid() || m_config->alert_GridOB() || m_config->alert_Continent() || m_config->alert_ContinentOB() || + m_config->alert_CQZ() || m_config->alert_CQZOB() || m_config->alert_ITUZ() || m_config->alert_ITUZOB() || + m_config->alert_CQ())) { + connect (&alertsTimer, &QTimer::timeout, this, &DisplayText::AudioAlerts); + alertsTimer.setSingleShot (true); + alertsTimer.start (1000); + } + + extend_vertical_scrollbar (verticalScrollBar ()->minimum (), verticalScrollBar ()->maximum ()); + if (high_volume_ && m_config && m_config->decodes_from_top () && !vertical_scroll_connection_) + { + vertical_scroll_connection_ = connect (verticalScrollBar (), &QScrollBar::rangeChanged + , [this] (int min, int max) { + extend_vertical_scrollbar (min, max ); + }); + } + verticalScrollBar ()->setSliderPosition (verticalScrollBar ()->maximum ()); +} + +QString DisplayText::appendWorkedB4 (QString message, QString call, QString const& grid, + QColor * bg, QColor * fg, LogBook const& logBook, + QString const& currentBand, QString const& currentMode, + QString extra) +{ + QString countryName; + bool callB4; + bool callB4onBand; + bool countryB4; + bool countryB4onBand; + bool gridB4; + bool gridB4onBand; + bool continentB4; + bool continentB4onBand; + bool CQZoneB4; + bool CQZoneB4onBand; + bool ITUZoneB4; + bool ITUZoneB4onBand; + + if(call.length()==2) { + int i0=message.indexOf("CQ "+call); + call=message.mid(i0+6,-1); + i0=call.indexOf(" "); + call=call.mid(0,i0); + } + if(call.length()<3) return message; + if(!call.contains(QRegExp("[0-9]|[A-Z]"))) return message; + + auto const& looked_up = logBook.countries ()->lookup (call); + logBook.match (call, currentMode, grid, looked_up, callB4, countryB4, gridB4, continentB4, CQZoneB4, ITUZoneB4); + logBook.match (call, currentMode, grid, looked_up, callB4onBand, countryB4onBand, gridB4onBand, + continentB4onBand, CQZoneB4onBand, ITUZoneB4onBand, currentBand); + if(grid=="") { + gridB4=true; + gridB4onBand=true; + } + + if(callB4onBand) m_points=0; + + message = message.trimmed (); + + highlight_types types; + // no shortcuts here as some types may be disabled + if (!countryB4) { + types.push_back (Highlight::DXCC); + if (m_config->alert_DXCC()) { + if (!muted) play_DXCC = true; + } + } + if(!countryB4onBand) { + types.push_back (Highlight::DXCCBand); + if (m_config->alert_DXCCOB()) { + if (!muted) play_DXCCOB = true; + } + } + if(!gridB4) { + types.push_back (Highlight::Grid); + if (m_config->alert_Grid()) { + if (!muted) play_Grid = true; + } + } + if(!gridB4onBand) { + types.push_back (Highlight::GridBand); + if (m_config->alert_GridOB()) { + if (!muted) play_GridOB = true; + } + } + if (!callB4) { + types.push_back (Highlight::Call); + } + if(!callB4onBand) { + types.push_back (Highlight::CallBand); + } + if (!continentB4) { + types.push_back (Highlight::Continent); + if (m_config->alert_Continent()) { + if (!muted) play_Continent = true; + } + } + if(!continentB4onBand) { + types.push_back (Highlight::ContinentBand); + if (m_config->alert_ContinentOB()) { + if (!muted) play_ContinentOB = true; + } + } + if (!CQZoneB4) { + types.push_back (Highlight::CQZone); + if (m_config->alert_CQZ()) { + if (!muted) play_CQZ = true; + } + } + if(!CQZoneB4onBand) { + types.push_back (Highlight::CQZoneBand); + if (m_config->alert_CQZOB()) { + if (!muted) play_CQZOB = true; + } + } + if (!ITUZoneB4) { + types.push_back (Highlight::ITUZone); + if (m_config->alert_ITUZ()) { + if (!muted) play_ITUZ = true; + } + } + if(!ITUZoneB4onBand) { + types.push_back (Highlight::ITUZoneBand); + if (m_config->alert_ITUZOB()) { + if (!muted) play_ITUZOB = true; + } + } + if (m_config && m_config->lotw_users ().user (call)) + { + types.push_back (Highlight::LotW); + } + types.push_back (Highlight::CQ); + auto top_highlight = set_colours (m_config, bg, fg, types); + + switch (top_highlight) + { + case Highlight::Continent: + case Highlight::ContinentBand: + extra += AD1CCty::continent (looked_up.continent); + break; + case Highlight::CQZone: + case Highlight::CQZoneBand: + extra += QString {"CQ Zone %1"}.arg (looked_up.CQ_zone); + break; + case Highlight::ITUZone: + case Highlight::ITUZoneBand: + extra += QString {"ITU Zone %1"}.arg (looked_up.ITU_zone); + break; + default: + if (m_bPrincipalPrefix) + { + extra += looked_up.primary_prefix; + } + else + { + auto countryName = looked_up.entity_name; + + // do some obvious abbreviations + countryName.replace ("Islands", "Is."); + countryName.replace ("Island", "Is."); + countryName.replace ("North ", "N. "); + countryName.replace ("Northern ", "N. "); + countryName.replace ("South ", "S. "); + countryName.replace ("East ", "E. "); + countryName.replace ("Eastern ", "E. "); + countryName.replace ("West ", "W. "); + countryName.replace ("Western ", "W. "); + countryName.replace ("Central ", "C. "); + countryName.replace (" and ", " & "); + countryName.replace ("Republic", "Rep."); + countryName.replace ("United States of America", "U.S.A."); + countryName.replace ("United States", "U.S.A."); + countryName.replace ("Fed. Rep. of ", ""); + countryName.replace ("French ", "Fr."); + countryName.replace ("Asiatic", "AS"); + countryName.replace ("European", "EU"); + countryName.replace ("African", "AF"); + + // assign WAE entities to the correct DXCC when "Include extra WAE entities" is not selected + if (!(m_config->include_WAE_entities())) { + countryName.replace ("Bear Is.", "Svalbard"); + countryName.replace ("Shetland Is.", "Scotland"); + countryName.replace ("AF Italy", "Italy"); + countryName.replace ("Sicily", "Italy"); + countryName.replace ("Vienna Intl Ctr", "Austria"); + countryName.replace ("AF Turkey", "Turkey"); + countryName.replace ("EU Turkey", "Turkey"); + } + + extra += countryName; + } + } + m_CQPriority=DecodeHighlightingModel::highlight_name(top_highlight); + + if(((m_points == 00) or (m_points == -1)) and m_bDisplayPoints) return message; + return leftJustifyAppendage (message, extra); +} + +QString DisplayText::leftJustifyAppendage (QString message, QString const& appendage0) const +{ + QString appendage=appendage0; + if(m_bDisplayPoints and (m_points>0)) { + appendage=" " + QString::number(m_points); + if(m_points<10) appendage=" " + appendage; + } + if (appendage.size ()) + { + // allow for seconds + int padding {message.indexOf (" ") > 4 ? 2 : 0}; + + // use a nbsp to save the start of appended text so we can find + // it again later, align appended data at a fixed column if + // there is space otherwise let it float to the right + int space_count; + space_count = (40 + m_config->align_steps() + padding - message.size ()); + if (space_count > 0) { + message += QString {space_count, QChar {' '}}; + } + message += QChar::Nbsp + appendage; + } + return message; +} + +void DisplayText::displayDecodedText(DecodedText const& decodedText, QString const& myCall, + QString const& mode, + bool displayDXCCEntity, LogBook const& logBook, + QString const& currentBand, bool ppfx, bool bCQonly, + bool haveFSpread, float fSpread, bool bDisplayPoints, + int points, QString distance, bool alertsMuted) +{ + m_points=points; + m_bDisplayPoints=bDisplayPoints; + m_bPrincipalPrefix=ppfx; + muted=alertsMuted; + QColor bg; + QColor fg; + bool CQcall = false; + auto is_73 = decodedText.messageWords().filter (QRegularExpression {"^(73|RR73)$"}).size(); + if (decodedText.string ().contains (" CQ ")) { + if (m_config->alert_CQ()) { + if (!muted) play_CQ = true; + } + } + if (decodedText.string ().contains (" CQ ") + || decodedText.string ().contains (" CQDX ") + || decodedText.string ().contains (" QRZ ") + || (is_73 && (m_config->highlight_73 ()))) + { + CQcall = true; + } + else + { + if (bCQonly) return; + } + auto message = decodedText.string(); + QString dxCall; + QString dxGrid; + decodedText.deCallAndGrid (/*out*/ dxCall, dxGrid); + QRegularExpression grid_regexp {"\\A(?![Rr]{2}73)[A-Ra-r]{2}[0-9]{2}([A-Xa-x]{2}){0,1}\\z"}; + if(!dxGrid.contains(grid_regexp)) dxGrid=""; + message = message.left (message.indexOf (QChar::Nbsp)).trimmed (); // strip appended info + QString extra; + QString state; // NJ0A + + if (displayDXCCEntity && dxGrid.length() > 0 && logBook.countries ()->lookup (dxCall).primary_prefix == "K") { + //std::cout << dxCall << " -> " << dxGrid << " " << logBook.countries ()->lookup (dxCall).primary_prefix <<"\n"; + if (m_config->GridMap()) { + if (CQcall || is_73 || m_config->GridMapAll()) { + state = logBook.countries ()->findState(dxGrid); + } + } + } + //NJ0A + + if (haveFSpread) + { + extra += QString {"%1"}.arg (fSpread, 5, 'f', fSpread < 0.95 ? 3 : 2) + QChar {' '}; + } + auto ap_pos = message.lastIndexOf (QRegularExpression {R"((?:\?\s)?(?:a[0-9]|q[0-9][0-9*]?)$)"}); + if (ap_pos >= 0) + { + extra += message.mid (ap_pos) + QChar {' '}; + message = message.left (ap_pos).trimmed (); + } + m_CQPriority=""; + if (CQcall || (is_73 && m_config->highlight_73()) || (mode == "FT4" && m_config->highlight_73() && m_config->NCCC_Sprint() + && (SpecOp::NA_VHF == m_config->special_op_id()) && decodedText.string().contains(" R "))) + { + if (displayDXCCEntity) + { + // if enabled add the DXCC entity and B4 status to the end of the + // preformated text line t1 + auto currentMode = mode; + message = appendWorkedB4 (message, dxCall, dxGrid, &bg, &fg + , logBook, currentBand, currentMode, extra); + } + else + { + message = leftJustifyAppendage (message, extra); + highlight_types types {Highlight::CQ}; + if (m_config && m_config->lotw_users ().user (decodedText.CQersCall())) + { + types.push_back (Highlight::LotW); + } + set_colours (m_config, &bg, &fg, types); + } + } + else + { + if (m_config->show_country_names()) + { + auto const& looked_up = logBook.countries ()->lookup (dxCall); + auto countryName = looked_up.entity_name; + + if (m_bPrincipalPrefix) { + extra += looked_up.primary_prefix; + } else { + // do some obvious abbreviations + countryName.replace ("Islands", "Is."); + countryName.replace ("Island", "Is."); + countryName.replace ("North ", "N. "); + countryName.replace ("Northern ", "N. "); + countryName.replace ("South ", "S. "); + countryName.replace ("East ", "E. "); + countryName.replace ("Eastern ", "E. "); + countryName.replace ("West ", "W. "); + countryName.replace ("Western ", "W. "); + countryName.replace ("Central ", "C. "); + countryName.replace (" and ", " & "); + countryName.replace ("Republic", "Rep."); + countryName.replace ("United States of America", "U.S.A."); + countryName.replace ("United States", "U.S.A."); + countryName.replace ("Fed. Rep. of ", ""); + countryName.replace ("French ", "Fr."); + countryName.replace ("Asiatic", "AS"); + countryName.replace ("European", "EU"); + countryName.replace ("African", "AF"); + + // assign WAE entities to the correct DXCC when "Include extra WAE entities" is not selected + if (!(m_config->include_WAE_entities())) { + countryName.replace ("Bear Is.", "Svalbard"); + countryName.replace ("Shetland Is.", "Scotland"); + countryName.replace ("AF Italy", "Italy"); + countryName.replace ("Sicily", "Italy"); + countryName.replace ("Vienna Intl Ctr", "Austria"); + countryName.replace ("AF Turkey", "Turkey"); + countryName.replace ("EU Turkey", "Turkey"); + } + + extra += countryName; + } + message = leftJustifyAppendage(message, extra); + } + else + { + message = leftJustifyAppendage (message, extra); + } + } + + if (myCall.size ()) + { + QString regexp {"[ <]" + myCall + "[ >]"}; + if (Radio::is_compound_callsign (myCall)) + { + regexp = "(?:" + regexp + "|[ <]" + Radio::base_callsign (myCall) + "[ >])"; + } + if ((decodedText.clean_string () + " ").contains (QRegularExpression {regexp})) + { + QStringList tw; + if (mode == "FT8" or mode == "FT4" or mode == "MSK144") { + tw=decodedText.string().mid(24).split(" ",SkipEmptyParts); + } else { + tw=decodedText.string().mid(22).split(" ",SkipEmptyParts); + } + if ((tw.size () > 0 && tw[0].contains(myCall)) or decodedText.clean_string().contains("; " + myCall)) { + highlight_types types {Highlight::MyCall}; + set_colours (m_config, &bg, &fg, types); + if (m_config->alert_MyCall()) play_MyCall = true; + } else { + highlight_types types {Highlight::Tx}; + set_colours (m_config, &bg, &fg, types); + } + } + } + + if (m_config->GridMap() && !m_bDisplayPoints) { + if (ppfx) { //NJ0A + extra = " "; + } else { + extra = " "; + } + message = leftJustifyAppendage(message, state); //NJ0A + } + + // display distance and azimuth + if (distance.length() > 0) { + if (m_config->align()) { + if (!displayDXCCEntity) { + message = leftJustifyAppendage (message, "[" + distance + "]"); + } else { + QString space = " "; + if (m_bPrincipalPrefix) { + if (message.length() < (49 + m_config->align_steps() + m_config->align_steps2())) { + message = leftJustifyAppendage ((message + (space.repeated(30))).left(48 + m_config->align_steps() + m_config->align_steps2()), "[" + distance + "]"); + } else { + message = leftJustifyAppendage (message, " [" + distance + "]"); + } + } else { + if (message.length() < 59 + m_config->align_steps() + m_config->align_steps2()) { + message = leftJustifyAppendage ((message + (space.repeated(40))).left(59 + m_config->align_steps() + m_config->align_steps2()), "[" + distance + "]"); + } else { + message = leftJustifyAppendage (message, "[" + distance + "]"); + } + } + } + } else { + message = leftJustifyAppendage (message, "[" + distance + "]"); + } + } + + // initialize audible alerts for MSK144 (still experimental) + if(mode=="MSK144") { + if ((m_config->alert_Enabled()) && ((m_config->alert_DXCC()) || (m_config->alert_DXCCOB()) || (m_config->alert_Grid()) || + (m_config->alert_GridOB()) || (m_config->alert_Continent()) || (m_config->alert_ContinentOB()) || (m_config->alert_CQZ()) || + (m_config->alert_CQZOB()) || (m_config->alert_ITUZ()) || (m_config->alert_ITUZOB()) || (m_config->alert_CQ()))) { + alertsTimer.stop (); + disconnect (&alertsTimer, &QTimer::timeout, this, &DisplayText::AudioAlerts); + connect (&alertsTimer, &QTimer::timeout, this, &DisplayText::AudioAlerts); + alertsTimer.setSingleShot (true); + alertsTimer.start (1000); + } + } + + insertText (message.trimmed (), bg, fg, decodedText.call (), dxCall); +} + +void DisplayText::displayTransmittedText(QString text, QString modeTx, qint32 txFreq, + bool bFastMode, double TRperiod,bool bSuperfox) +{ + QString t1=" @ "; + if(modeTx=="FT4") t1=" + "; + if(modeTx.contains("FT8")) t1=" ~ "; + if(modeTx=="JT4") t1=" $ "; + if(modeTx=="Q65") t1=" : "; + if(modeTx=="JT65") t1=" # "; + if(modeTx=="MSK144") t1=" & "; + if(modeTx=="FST4") t1=" ` "; + QString t2; + t2 = t2.asprintf("%4d",txFreq); + QString t; + if(bFastMode or modeTx=="FT8" or modeTx=="FT4" or (TRperiod<60) or + (modeTx=="Q65" and TRperiod==60)) { + t = QDateTime::currentDateTimeUtc().toString("hhmmss") + \ + " Tx " + t2 + t1 + text; + } else if(modeTx.mid(0,6)=="FT8fox") { + t = QDateTime::currentDateTimeUtc().toString("hhmmss") + \ + " Tx" + modeTx.mid(7) + " " + text; + } else { + t = QDateTime::currentDateTimeUtc().toString("hhmm") + \ + " Tx " + t2 + t1 + text; + } + QColor bg; + QColor fg; + highlight_types types {Highlight::Tx}; + set_colours (m_config, &bg, &fg, types); + if(bSuperfox and t.contains(";")) { + int i0=t.indexOf(";"); + int i1=t.indexOf("<"); + int i2=t.indexOf(">"); + QString foxcall=t.mid(i1+1,i2-i1-1); + t2=t.left(i0).replace(" RR73", " " + foxcall + " RR73"); + QString t3=t.left(24) + t.mid(i0+2,-1).remove("<").remove(">"); + insertText (t2, bg, fg); + insertText (t3, bg, fg); + } else { + insertText (t, bg, fg); + } +} + +void DisplayText::displayQSY(QString text) +{ + QString t = QDateTime::currentDateTimeUtc().toString("hhmmss") + " " + text; + insertText (t, "hotpink"); +} + +void DisplayText::displayHoundToBeCalled(QString t, bool bAtTop, QColor bg, QColor fg) +{ + if (bAtTop) t = t + "\n"; // need a newline when insertion at top + insertText(t, bg, fg, "", "", bAtTop ? QTextCursor::Start : QTextCursor::End); +} + +void DisplayText::setHighlightedHoundText(QString t) { + QColor bg=QColor{255,255,255}; + QColor fg=QColor{0,0,0}; + highlight_types types{Highlight::Call}; + set_colours(m_config, &bg, &fg, types); + // t is multiple lines of text, each line is a hound calling + // iterate through each line and highlight the callsign + auto lines = t.split(QChar('\n'), SkipEmptyParts); + clear(); + foreach (auto line, lines) + { + auto fields = line.split(QChar(' '), SkipEmptyParts); + insertText(line, bg, fg, fields.first(), QString{}); + } +} + +namespace +{ + void update_selection (QTextCursor& cursor, QColor const& bg, QColor const& fg) + { + QTextCharFormat format {cursor.charFormat ()}; + if (bg.isValid ()) + { + format.setBackground (bg); + } + else + { + format.clearBackground (); + } + if (fg.isValid ()) + { + format.setForeground (fg); + } + else + { + format.clearForeground (); + } + cursor.mergeCharFormat (format); + } + + void reset_selection (QTextCursor& cursor) + { + // restore previous text format, we rely on the text + // char format at he start of the selection being the + // old one which should be the case + auto c2 = cursor; + c2.setPosition (c2.selectionStart ()); + cursor.setCharFormat (c2.charFormat ()); + } +} + +namespace +{ + QString get_timestamp (QTextCursor& cursor) + { + QString timestamp; + if (cursor.movePosition (QTextCursor::PreviousCharacter) + && cursor.movePosition (QTextCursor::StartOfLine) + && cursor.movePosition (QTextCursor::EndOfWord, QTextCursor::KeepAnchor) + && cursor.hasSelection ()) + { + timestamp = cursor.selectedText (); + cursor.movePosition (QTextCursor::StartOfLine); + } + return timestamp; + } +} + +void DisplayText::highlight_callsign (QString const& callsign, QColor const& bg, + QColor const& fg, bool last_period_only) +{ + auto regexp = callsign; + last_period_only = true; // highlight last period only because it is faster and more robust + if (!callsign.size () || callsign == "" || callsign == " " || callsign == "0") + { + return; + } + if (callsign == "CLEARALL!") // programmatic means of clearing all highlighting + { + highlighted_calls_.clear(); + return; + } + // allow for hashed callsigns and escape any regexp metacharacters + QRegularExpression target {QString {"<?"} + + regexp.replace (QLatin1Char {'+'}, QLatin1String {"\\+"}) + .replace (QLatin1Char {'.'}, QLatin1String {"\\."}) + .replace (QLatin1Char {'?'}, QLatin1String {"\\?"}) + + QString {">?"} + , QRegularExpression::DontCaptureOption}; + QTextCharFormat old_format {currentCharFormat ()}; + QTextCursor cursor {document ()}; + if (last_period_only) + { + // highlight each instance of the given callsign (word) in the + // current period + cursor.movePosition (QTextCursor::End); + QTextCursor period_start {cursor}; + QTextCursor prior {cursor}; + auto period_timestamp = get_timestamp (period_start); + while (period_timestamp.size () && period_timestamp == get_timestamp (prior)) + { + period_start = prior; + } + cursor = period_start; + while (!cursor.isNull ()) + { + cursor = document ()->find (target, cursor, QTextDocument::FindWholeWords); + if (!cursor.isNull () && cursor.hasSelection ()) + { + if (bg.isValid () || fg.isValid ()) + { + update_selection (cursor, bg, fg); + } + else + { + reset_selection (cursor); + } + } + } + } + else + { + auto pos = highlighted_calls_.find (callsign); + if (bg.isValid () || fg.isValid ()) + { + auto colours = qMakePair (bg, fg); + if (pos == highlighted_calls_.end ()) + { + pos = highlighted_calls_.insert (callsign.toUpper (), colours); + } + else + { + pos.value () = colours; // update colours + } + while (!cursor.isNull ()) + { + cursor = document ()->find (target, cursor, QTextDocument::FindWholeWords); + if (!cursor.isNull () && cursor.hasSelection ()) + { + update_selection (cursor, bg, fg); + } + } + } + else + { + if (pos != highlighted_calls_.end ()) + { + highlighted_calls_.erase (pos); + } + QTextCursor cursor {document ()}; + while (!cursor.isNull ()) + { + cursor = document ()->find (target, cursor, QTextDocument::FindWholeWords); + if (!cursor.isNull () && cursor.hasSelection ()) + { + reset_selection (cursor); + } + } + } + } + setCurrentCharFormat (old_format); +} + +void DisplayText::AudioAlerts() +{ +#ifdef WIN32 + if(m_config->alert_Enabled()) { + QAudioOutput info(QAudioDeviceInfo::defaultOutputDevice()); + QString audioPath = QCoreApplication::applicationDirPath() + "/sounds" + m_config->voicesPath() + "/"; + QAudioFormat format; + format.setCodec("audio/pcm"); + format.setSampleRate (48000); + format.setChannelCount (1); + format.setSampleSize (16); + format.setSampleType(QAudioFormat::SignedInt); + QAudioOutput* audio; + audio = new QAudioOutput(format, this); + connect(audio, SIGNAL(stateChanged(QAudio::State)), this, SLOT(handleStateChanged(QAudio::State))); +#else + if(m_config->alert_Enabled()) { + QString audioPath = QCoreApplication::applicationDirPath() + "/sounds" + m_config->voicesPath() + "/"; +#endif + QFile *effect2 = new QFile(this); + QFile *effect3 = new QFile(this); + QFile *effect4 = new QFile(this); + QFile *effect5 = new QFile(this); + QFile *effect6 = new QFile(this); + QFile *effect7 = new QFile(this); + QFile *effect8 = new QFile(this); + QFile *effect9 = new QFile(this); + QFile *effect10 = new QFile(this); + QFile *effect11 = new QFile(this); + QFile *effect12 = new QFile(this); + QFile *effect13 = new QFile(this); + effect2->setFileName(QString("%1/%2").arg(audioPath, "MyCall.wav")); + effect3->setFileName(QString("%1/%2").arg(audioPath, "DXCC.wav")); + effect4->setFileName(QString("%1/%2").arg(audioPath, "DXCCOnBand.wav")); + effect5->setFileName(QString("%1/%2").arg(audioPath, "Continent.wav")); + effect6->setFileName(QString("%1/%2").arg(audioPath, "ContinentOnBand.wav")); + effect7->setFileName(QString("%1/%2").arg(audioPath, "CQZone.wav")); + effect8->setFileName(QString("%1/%2").arg(audioPath, "CQZoneOnBand.wav")); + effect9->setFileName(QString("%1/%2").arg(audioPath, "ITUZone.wav")); + effect10->setFileName(QString("%1/%2").arg(audioPath, "ITUZoneOnBand.wav")); + effect11->setFileName(QString("%1/%2").arg(audioPath, "Grid.wav")); + effect12->setFileName(QString("%1/%2").arg(audioPath, "GridOnBand.wav")); + effect13->setFileName(QString("%1/%2").arg(audioPath, "CQ.wav")); + static int startIndex = 0; + int nextStartIndex = startIndex +1; + switch (startIndex) { + case 0: + if (play_MyCall) { +#ifdef WIN32 + effect2->open(QIODevice::ReadOnly); + audio->start(effect2); +#else + QSound::play(audioPath + "MyCall.wav"); // for Linux and macOS +#endif + play_MyCall = false; + alertsTimer.start (1000); + startIndex = nextStartIndex; + return; + } else { + nextStartIndex++; + } + Q_FALLTHROUGH(); + case 1: + if (play_DXCC) { +#ifdef WIN32 + effect3->open(QIODevice::ReadOnly); + audio->start(effect3); +#else + QSound::play(audioPath + "DXCC.wav"); // for Linux and macOS +#endif + play_DXCC = false; + play_DXCCOB = false; + alertsTimer.start (1200); + startIndex = nextStartIndex; + return; + } else { + nextStartIndex++; + } + Q_FALLTHROUGH(); + case 2: + if (play_DXCCOB && !play_DXCC) { +#ifdef WIN32 + effect4->open(QIODevice::ReadOnly); + audio->start(effect4); +#else + QSound::play(audioPath + "DXCCOnBand.wav"); // for Linux and macOS +#endif + play_DXCCOB = false; + alertsTimer.start (1800); + startIndex = nextStartIndex; + return; + } else { + nextStartIndex++; + } + Q_FALLTHROUGH(); + case 3: + if (play_Continent) { +#ifdef WIN32 + effect5->open(QIODevice::ReadOnly); + audio->start(effect5); +#else + QSound::play(audioPath + "Continent.wav"); // for Linux and macOS +#endif + play_Continent = false; + play_ContinentOB = false; + play_GridOB = false; + play_CQZOB = false; + play_ITUZOB = false; + alertsTimer.start (1000); + startIndex = nextStartIndex; + return; + } else { + nextStartIndex++; + } + Q_FALLTHROUGH(); + case 4: + if (play_ContinentOB && !play_Continent) { +#ifdef WIN32 + effect6->open(QIODevice::ReadOnly); + audio->start(effect6); +#else + QSound::play(audioPath + "ContinentOnBand.wav"); // for Linux and macOS +#endif + play_ContinentOB = false; + play_GridOB = false; + play_CQZOB = false; + play_ITUZOB = false; + alertsTimer.start (2000); + startIndex = nextStartIndex; + return; + } else { + nextStartIndex++; + } + Q_FALLTHROUGH(); + case 5: + if (play_CQZ) { +#ifdef WIN32 + effect7->open(QIODevice::ReadOnly); + audio->start(effect7); +#else + QSound::play(audioPath + "CQZone.wav"); // for Linux and macOS +#endif + play_CQZ = false; + play_CQZOB = false; + alertsTimer.start (1500); + startIndex = nextStartIndex; + return; + } else { + nextStartIndex++; + } + Q_FALLTHROUGH(); + case 6: + if (play_CQZOB && !play_CQZ) { +#ifdef WIN32 + effect8->open(QIODevice::ReadOnly); + audio->start(effect8); +#else + QSound::play(audioPath + "CQZoneOnBand.wav"); // for Linux and macOS +#endif + play_CQZOB = false; + alertsTimer.start (1800); + startIndex = nextStartIndex; + return; + } else { + nextStartIndex++; + } + Q_FALLTHROUGH(); + case 7: + if (play_ITUZ) { +#ifdef WIN32 + effect9->open(QIODevice::ReadOnly); + audio->start(effect9); +#else + QSound::play(audioPath + "ITUZone.wav"); // for Linux and macOS +#endif + play_ITUZ = false; + play_ITUZOB = false; + play_GridOB = false; + alertsTimer.start (1500); + startIndex = nextStartIndex; + return; + } else { + nextStartIndex++; + } + Q_FALLTHROUGH(); + case 8: + if (play_ITUZOB && !(play_ITUZ)) { +#ifdef WIN32 + effect10->open(QIODevice::ReadOnly); + audio->start(effect10); +#else + QSound::play(audioPath + "ITUZoneOnBand.wav"); // for Linux and macOS +#endif + play_ITUZOB = false; + play_GridOB = false; + alertsTimer.start (1900); + startIndex = nextStartIndex; + return; + } else { + nextStartIndex++; + } + Q_FALLTHROUGH(); + case 9: + if (play_Grid) { +#ifdef WIN32 + effect11->open(QIODevice::ReadOnly); + audio->start(effect11); +#else + QSound::play(audioPath + "Grid.wav"); // for Linux and macOS +#endif + play_Grid = false; + play_GridOB = false; + alertsTimer.start (1000); + startIndex = nextStartIndex; + return; + } else { + nextStartIndex++; + } + Q_FALLTHROUGH(); + case 10: + if (play_GridOB && !play_Grid) { +#ifdef WIN32 + effect12->open(QIODevice::ReadOnly); + audio->start(effect12); +#else + QSound::play(audioPath + "GridOnBand.wav"); // for Linux and macOS +#endif + play_GridOB = false; + alertsTimer.start (1500); + startIndex = nextStartIndex; + return; + } else { + nextStartIndex++; + } + Q_FALLTHROUGH(); + case 11: + if (play_CQ) { +#ifdef WIN32 + effect13->open(QIODevice::ReadOnly); + audio->start(effect13); +#else + QSound::play(audioPath + "CQ.wav"); // for Linux and macOS +#endif + play_CQ = false; + alertsTimer.start (1000); + nextStartIndex++; + return; + } else { + nextStartIndex++; + } + Q_FALLTHROUGH(); + case 12: + // stop any running alerts timer, clear temp data, and restart alerts timer + alertsTimer.stop (); +#ifdef WIN32 + effect2->close(); + effect2->deleteLater(); + effect3->close(); + effect3->deleteLater(); + effect4->close(); + effect4->deleteLater(); + effect5->close(); + effect5->deleteLater(); + effect6->close(); + effect6->deleteLater(); + effect7->close(); + effect7->deleteLater(); + effect8->close(); + effect8->deleteLater(); + effect9->close(); + effect9->deleteLater(); + effect10->close(); + effect10->deleteLater(); + effect11->close(); + effect11->deleteLater(); + effect12->close(); + effect12->deleteLater(); + effect13->close(); + effect13->deleteLater(); + audio->deleteLater(); // remove QAudioSink to avoid a memory leak +#endif + alertsTimer.start (1250); + startIndex = 0; + return; + } + } +} diff --git a/widgets/displaytext.h b/widgets/displaytext.h index 02e1783a..26b3b2a8 100755..100644 --- a/widgets/displaytext.h +++ b/widgets/displaytext.h @@ -1,78 +1,78 @@ -// -*- Mode: C++ -*-
-#ifndef DISPLAYTEXT_H
-#define DISPLAYTEXT_H
-
-#include <QTextEdit>
-#include <QFont>
-#include <QHash>
-#include <QPair>
-#include <QString>
-#include <QTimer>
-
-class QAction;
-class Configuration;
-class LogBook;
-class DecodedText;
-
-class DisplayText
- : public QTextEdit
-{
- Q_OBJECT
-public:
- explicit DisplayText(QWidget *parent = nullptr);
- void set_configuration (Configuration const * configuration, bool high_volume = false)
- {
- disconnect (vertical_scroll_connection_);
- m_config = configuration;
- high_volume_ = high_volume;
- }
- void setContentFont (QFont const&);
- void insertLineSpacer(QString const&);
- void displayDecodedText(DecodedText const& decodedText, QString const& myCall, QString const& mode,
- bool displayDXCCEntity, LogBook const& logBook,
- QString const& currentBand=QString {}, bool ppfx=false, bool bCQonly=false,
- bool haveFSpread = false, float fSpread = 0.0, bool bDisplayPoints=false,
- int points=-99, QString distance = "", bool alertsMuted=false);
- void displayTransmittedText(QString text, QString modeTx, qint32 txFreq, bool bFastMode,
- double TRperiod, bool bSuperfox);
- void displayQSY(QString text);
- void displayHoundToBeCalled(QString t, bool bAtTop=false, QColor bg = QColor {}, QColor fg = QColor {});
- void setHighlightedHoundText(QString text);
- void new_period ();
- QString CQPriority(){return m_CQPriority;};
- qint32 m_points;
- bool m_bDisplayPoints;
-
- Q_SIGNAL void selectCallsign (Qt::KeyboardModifiers);
- Q_SIGNAL void erased ();
-
- Q_SLOT void insertText (QString const& text, QColor bg = QColor {}, QColor fg = QColor {}
- , QString const& call1 = QString {}, QString const& call2 = QString {}, QTextCursor::MoveOperation location=QTextCursor::End);
- Q_SLOT void erase ();
- Q_SLOT void highlight_callsign (QString const& callsign, QColor const& bg, QColor const& fg, bool last_period_only);
-
-private:
- void AudioAlerts();
- QTimer alertsTimer;
- QString leftJustifyAppendage (QString message, QString const& appendage) const;
- void mouseDoubleClickEvent (QMouseEvent *) override;
-
- void extend_vertical_scrollbar (int min, int max);
-
- Configuration const * m_config;
- bool m_bPrincipalPrefix;
- QString m_CQPriority;
- QString appendWorkedB4(QString message, QString callsign
- , QString const& grid, QColor * bg, QColor * fg
- , LogBook const& logBook, QString const& currentBand
- , QString const& currentMode, QString extra);
- QFont char_font_;
- QAction * erase_action_;
-
- QHash<QString, QPair<QColor, QColor>> highlighted_calls_;
- bool high_volume_;
- QMetaObject::Connection vertical_scroll_connection_;
- long long modified_vertical_scrollbar_max_;
-};
-
-#endif // DISPLAYTEXT_H
+// -*- Mode: C++ -*- +#ifndef DISPLAYTEXT_H +#define DISPLAYTEXT_H + +#include <QTextEdit> +#include <QFont> +#include <QHash> +#include <QPair> +#include <QString> +#include <QTimer> + +class QAction; +class Configuration; +class LogBook; +class DecodedText; + +class DisplayText + : public QTextEdit +{ + Q_OBJECT +public: + explicit DisplayText(QWidget *parent = nullptr); + void set_configuration (Configuration const * configuration, bool high_volume = false) + { + disconnect (vertical_scroll_connection_); + m_config = configuration; + high_volume_ = high_volume; + } + void setContentFont (QFont const&); + void insertLineSpacer(QString const&); + void displayDecodedText(DecodedText const& decodedText, QString const& myCall, QString const& mode, + bool displayDXCCEntity, LogBook const& logBook, + QString const& currentBand=QString {}, bool ppfx=false, bool bCQonly=false, + bool haveFSpread = false, float fSpread = 0.0, bool bDisplayPoints=false, + int points=-99, QString distance = "", bool alertsMuted=false); + void displayTransmittedText(QString text, QString modeTx, qint32 txFreq, bool bFastMode, + double TRperiod, bool bSuperfox); + void displayQSY(QString text); + void displayHoundToBeCalled(QString t, bool bAtTop=false, QColor bg = QColor {}, QColor fg = QColor {}); + void setHighlightedHoundText(QString text); + void new_period (); + QString CQPriority(){return m_CQPriority;}; + qint32 m_points; + bool m_bDisplayPoints; + + Q_SIGNAL void selectCallsign (Qt::KeyboardModifiers); + Q_SIGNAL void erased (); + + Q_SLOT void insertText (QString const& text, QColor bg = QColor {}, QColor fg = QColor {} + , QString const& call1 = QString {}, QString const& call2 = QString {}, QTextCursor::MoveOperation location=QTextCursor::End); + Q_SLOT void erase (); + Q_SLOT void highlight_callsign (QString const& callsign, QColor const& bg, QColor const& fg, bool last_period_only); + +private: + void AudioAlerts(); + QTimer alertsTimer; + QString leftJustifyAppendage (QString message, QString const& appendage) const; + void mouseDoubleClickEvent (QMouseEvent *) override; + + void extend_vertical_scrollbar (int min, int max); + + Configuration const * m_config; + bool m_bPrincipalPrefix; + QString m_CQPriority; + QString appendWorkedB4(QString message, QString callsign + , QString const& grid, QColor * bg, QColor * fg + , LogBook const& logBook, QString const& currentBand + , QString const& currentMode, QString extra); + QFont char_font_; + QAction * erase_action_; + + QHash<QString, QPair<QColor, QColor>> highlighted_calls_; + bool high_volume_; + QMetaObject::Connection vertical_scroll_connection_; + long long modified_vertical_scrollbar_max_; +}; + +#endif // DISPLAYTEXT_H diff --git a/widgets/echograph.cpp b/widgets/echograph.cpp index 4f51fa10..94ccb7aa 100755..100644 --- a/widgets/echograph.cpp +++ b/widgets/echograph.cpp @@ -1,126 +1,126 @@ -#include "echograph.h"
-#include "commons.h"
-#include <QSettings>
-#include <QApplication>
-#include <QDebug>
-#include "echoplot.h"
-#include "ui_echograph.h"
-#include "moc_echograph.cpp"
-
-#define NSMAX2 1366
-
-EchoGraph::EchoGraph(QSettings * settings, QWidget *parent) :
- QDialog {parent, Qt::Window | Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::WindowMinimizeButtonHint},
- m_settings (settings),
- ui(new Ui::EchoGraph)
-{
- ui->setupUi(this);
- setWindowTitle (QApplication::applicationName () + " - " + tr ("Echo Graph"));
- installEventFilter(parent); //Installing the filter
- ui->echoPlot->setCursor(Qt::CrossCursor);
- setMaximumWidth(2048);
- setMaximumHeight(880);
- ui->echoPlot->setMaximumHeight(800);
-
-//Restore user's settings
- m_settings->beginGroup("EchoGraph");
- restoreGeometry (m_settings->value ("geometry", saveGeometry ()).toByteArray ());
- ui->echoPlot->setPlotZero(m_settings->value("PlotZero", 0).toInt());
- ui->echoPlot->setPlotGain(m_settings->value("PlotGain", 0).toInt());
- ui->zeroSlider->setValue(ui->echoPlot->getPlotZero());
- ui->gainSlider->setValue(ui->echoPlot->getPlotGain());
- int n=m_settings->value("Smooth",0).toInt();
- ui->echoPlot->m_smooth=n;
- ui->smoothSpinBox->setValue(n);
- n=m_settings->value("EchoBPP",1).toInt();
- ui->echoPlot->m_binsPerPixel=n;
- ui->binsPerPixelSpinBox->setValue(n);
- ui->echoPlot->m_blue=m_settings->value("BlueCurve",false).toBool();
- m_nColor=m_settings->value("EchoColors",0).toInt();
- ui->cbBaseline->setChecked(m_settings->value("Baseline",false).toBool());
- m_settings->endGroup();
- ui->echoPlot->setColors(m_nColor);
-}
-
-EchoGraph::~EchoGraph()
-{
- saveSettings();
-}
-
-void EchoGraph::closeEvent (QCloseEvent * e)
-{
- saveSettings ();
- QDialog::closeEvent (e);
-}
-
-void EchoGraph::saveSettings()
-{
-//Save user's settings
- m_settings->beginGroup("EchoGraph");
- m_settings->setValue ("geometry", saveGeometry ());
- m_settings->setValue("PlotZero",ui->echoPlot->m_plotZero);
- m_settings->setValue("PlotGain",ui->echoPlot->m_plotGain);
- m_settings->setValue("Smooth",ui->echoPlot->m_smooth);
- m_settings->setValue("EchoBPP",ui->echoPlot->m_binsPerPixel);
- m_settings->setValue("BlueCurve",ui->echoPlot->m_blue);
- m_settings->setValue("EchoColors",m_nColor);
- m_settings->setValue("Baseline",ui->cbBaseline->isChecked());
- m_settings->endGroup();
-}
-
-void EchoGraph::plotSpec()
-{
- ui->echoPlot->draw();
- ui->nsum_label->setText("N: " + QString::number(echocom_.nsum));
-}
-
-void EchoGraph::on_smoothSpinBox_valueChanged(int n)
-{
- ui->echoPlot->setSmooth(n);
- ui->echoPlot->draw();
-}
-
-void EchoGraph::on_gainSlider_valueChanged(int value)
-{
- ui->echoPlot->setPlotGain(value);
- ui->echoPlot->draw();
-}
-
-void EchoGraph::on_zeroSlider_valueChanged(int value)
-{
- ui->echoPlot->setPlotZero(value);
- ui->echoPlot->draw();
-}
-
-void EchoGraph::on_binsPerPixelSpinBox_valueChanged(int n)
-{
- ui->echoPlot->m_binsPerPixel=n;
- ui->echoPlot->DrawOverlay();
- ui->echoPlot->draw();
-}
-
-void EchoGraph::on_pbColors_clicked()
-{
- m_nColor = (m_nColor+1) % 6;
- ui->echoPlot->setColors(m_nColor);
-}
-
-void EchoGraph::on_cbBaseline_toggled(bool b)
-{
- ui->echoPlot->setBaseline(b);
-}
-
-bool EchoGraph::baseline()
-{
- return ui->cbBaseline->isChecked();
-}
-
-void EchoGraph::clearAvg()
-{
- for(int i=0; i<4096; i++) {
- echocom_.blue[i]=0;
- echocom_.red[i]=0;
- }
- echocom_.nsum=0;
- plotSpec();
-}
+#include "echograph.h" +#include "commons.h" +#include <QSettings> +#include <QApplication> +#include <QDebug> +#include "echoplot.h" +#include "ui_echograph.h" +#include "moc_echograph.cpp" + +#define NSMAX2 1366 + +EchoGraph::EchoGraph(QSettings * settings, QWidget *parent) : + QDialog {parent, Qt::Window | Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::WindowMinimizeButtonHint}, + m_settings (settings), + ui(new Ui::EchoGraph) +{ + ui->setupUi(this); + setWindowTitle (QApplication::applicationName () + " - " + tr ("Echo Graph")); + installEventFilter(parent); //Installing the filter + ui->echoPlot->setCursor(Qt::CrossCursor); + setMaximumWidth(2048); + setMaximumHeight(880); + ui->echoPlot->setMaximumHeight(800); + +//Restore user's settings + m_settings->beginGroup("EchoGraph"); + restoreGeometry (m_settings->value ("geometry", saveGeometry ()).toByteArray ()); + ui->echoPlot->setPlotZero(m_settings->value("PlotZero", 0).toInt()); + ui->echoPlot->setPlotGain(m_settings->value("PlotGain", 0).toInt()); + ui->zeroSlider->setValue(ui->echoPlot->getPlotZero()); + ui->gainSlider->setValue(ui->echoPlot->getPlotGain()); + int n=m_settings->value("Smooth",0).toInt(); + ui->echoPlot->m_smooth=n; + ui->smoothSpinBox->setValue(n); + n=m_settings->value("EchoBPP",1).toInt(); + ui->echoPlot->m_binsPerPixel=n; + ui->binsPerPixelSpinBox->setValue(n); + ui->echoPlot->m_blue=m_settings->value("BlueCurve",false).toBool(); + m_nColor=m_settings->value("EchoColors",0).toInt(); + ui->cbBaseline->setChecked(m_settings->value("Baseline",false).toBool()); + m_settings->endGroup(); + ui->echoPlot->setColors(m_nColor); +} + +EchoGraph::~EchoGraph() +{ + saveSettings(); +} + +void EchoGraph::closeEvent (QCloseEvent * e) +{ + saveSettings (); + QDialog::closeEvent (e); +} + +void EchoGraph::saveSettings() +{ +//Save user's settings + m_settings->beginGroup("EchoGraph"); + m_settings->setValue ("geometry", saveGeometry ()); + m_settings->setValue("PlotZero",ui->echoPlot->m_plotZero); + m_settings->setValue("PlotGain",ui->echoPlot->m_plotGain); + m_settings->setValue("Smooth",ui->echoPlot->m_smooth); + m_settings->setValue("EchoBPP",ui->echoPlot->m_binsPerPixel); + m_settings->setValue("BlueCurve",ui->echoPlot->m_blue); + m_settings->setValue("EchoColors",m_nColor); + m_settings->setValue("Baseline",ui->cbBaseline->isChecked()); + m_settings->endGroup(); +} + +void EchoGraph::plotSpec() +{ + ui->echoPlot->draw(); + ui->nsum_label->setText("N: " + QString::number(echocom_.nsum)); +} + +void EchoGraph::on_smoothSpinBox_valueChanged(int n) +{ + ui->echoPlot->setSmooth(n); + ui->echoPlot->draw(); +} + +void EchoGraph::on_gainSlider_valueChanged(int value) +{ + ui->echoPlot->setPlotGain(value); + ui->echoPlot->draw(); +} + +void EchoGraph::on_zeroSlider_valueChanged(int value) +{ + ui->echoPlot->setPlotZero(value); + ui->echoPlot->draw(); +} + +void EchoGraph::on_binsPerPixelSpinBox_valueChanged(int n) +{ + ui->echoPlot->m_binsPerPixel=n; + ui->echoPlot->DrawOverlay(); + ui->echoPlot->draw(); +} + +void EchoGraph::on_pbColors_clicked() +{ + m_nColor = (m_nColor+1) % 6; + ui->echoPlot->setColors(m_nColor); +} + +void EchoGraph::on_cbBaseline_toggled(bool b) +{ + ui->echoPlot->setBaseline(b); +} + +bool EchoGraph::baseline() +{ + return ui->cbBaseline->isChecked(); +} + +void EchoGraph::clearAvg() +{ + for(int i=0; i<4096; i++) { + echocom_.blue[i]=0; + echocom_.red[i]=0; + } + echocom_.nsum=0; + plotSpec(); +} diff --git a/widgets/echograph.h b/widgets/echograph.h index ce6f4b82..32945680 100755..100644 --- a/widgets/echograph.h +++ b/widgets/echograph.h @@ -1,44 +1,44 @@ -#ifndef ECHOGRAPH_H
-#define ECHOGRAPH_H
-
-#include <QDialog>
-#include <QScopedPointer>
-
-namespace Ui {
- class EchoGraph;
-}
-
-class QSettings;
-
-class EchoGraph : public QDialog
-{
- Q_OBJECT
-
-protected:
- void closeEvent (QCloseEvent *) override;
-
-public:
- explicit EchoGraph(QSettings *, QWidget *parent = 0);
- ~EchoGraph();
-
- void plotSpec();
- void saveSettings();
- void clearAvg();
- bool baseline();
-
-private slots:
- void on_smoothSpinBox_valueChanged(int n);
- void on_gainSlider_valueChanged(int value);
- void on_zeroSlider_valueChanged(int value);
- void on_binsPerPixelSpinBox_valueChanged(int n);
- void on_pbColors_clicked();
- void on_cbBaseline_toggled(bool b);
-
-private:
- QSettings * m_settings;
- qint32 m_nColor;
-
- QScopedPointer<Ui::EchoGraph> ui;
-};
-
-#endif // ECHOGRAPH_H
+#ifndef ECHOGRAPH_H +#define ECHOGRAPH_H + +#include <QDialog> +#include <QScopedPointer> + +namespace Ui { + class EchoGraph; +} + +class QSettings; + +class EchoGraph : public QDialog +{ + Q_OBJECT + +protected: + void closeEvent (QCloseEvent *) override; + +public: + explicit EchoGraph(QSettings *, QWidget *parent = 0); + ~EchoGraph(); + + void plotSpec(); + void saveSettings(); + void clearAvg(); + bool baseline(); + +private slots: + void on_smoothSpinBox_valueChanged(int n); + void on_gainSlider_valueChanged(int value); + void on_zeroSlider_valueChanged(int value); + void on_binsPerPixelSpinBox_valueChanged(int n); + void on_pbColors_clicked(); + void on_cbBaseline_toggled(bool b); + +private: + QSettings * m_settings; + qint32 m_nColor; + + QScopedPointer<Ui::EchoGraph> ui; +}; + +#endif // ECHOGRAPH_H diff --git a/widgets/echograph.ui b/widgets/echograph.ui index d9f79bae..0990db56 100755..100644 --- a/widgets/echograph.ui +++ b/widgets/echograph.ui @@ -1,317 +1,317 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>EchoGraph</class>
- <widget class="QDialog" name="EchoGraph">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>625</width>
- <height>336</height>
- </rect>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>570</width>
- <height>0</height>
- </size>
- </property>
- <property name="windowTitle">
- <string>Echo Graph</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <property name="spacing">
- <number>2</number>
- </property>
- <property name="topMargin">
- <number>2</number>
- </property>
- <property name="bottomMargin">
- <number>2</number>
- </property>
- <item>
- <layout class="QVBoxLayout" name="verticalLayout">
- <property name="spacing">
- <number>2</number>
- </property>
- <item>
- <widget class="EPlotter" name="echoPlot">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>273</width>
- <height>200</height>
- </size>
- </property>
- <property name="frameShape">
- <enum>QFrame::StyledPanel</enum>
- </property>
- <property name="frameShadow">
- <enum>QFrame::Sunken</enum>
- </property>
- <property name="lineWidth">
- <number>1</number>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_3">
- <property name="spacing">
- <number>6</number>
- </property>
- <item>
- <spacer name="horizontalSpacer_2">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Expanding</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QSpinBox" name="binsPerPixelSpinBox">
- <property name="minimumSize">
- <size>
- <width>60</width>
- <height>0</height>
- </size>
- </property>
- <property name="toolTip">
- <string><html><head/><body><p>Compression factor for frequency scale</p></body></html></string>
- </property>
- <property name="prefix">
- <string>Bins/Pixel </string>
- </property>
- <property name="minimum">
- <number>1</number>
- </property>
- <property name="maximum">
- <number>10</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="label_4">
- <property name="text">
- <string>Gain</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QSlider" name="gainSlider">
- <property name="toolTip">
- <string><html><head/><body><p>Echo spectrum gain</p></body></html></string>
- </property>
- <property name="minimum">
- <number>-30</number>
- </property>
- <property name="maximum">
- <number>30</number>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer_7">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Preferred</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Zero</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QSlider" name="zeroSlider">
- <property name="toolTip">
- <string><html><head/><body><p>Echo spectrum zero</p></body></html></string>
- </property>
- <property name="minimum">
- <number>-150</number>
- </property>
- <property name="maximum">
- <number>150</number>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Preferred</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QCheckBox" name="cbBaseline">
- <property name="text">
- <string>Baseline</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer_4">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Preferred</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QSpinBox" name="smoothSpinBox">
- <property name="minimumSize">
- <size>
- <width>60</width>
- <height>0</height>
- </size>
- </property>
- <property name="toolTip">
- <string><html><head/><body><p>Smoothing of echo spectrum</p></body></html></string>
- </property>
- <property name="prefix">
- <string>Smooth </string>
- </property>
- <property name="maximum">
- <number>20</number>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer_3">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Preferred</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QLabel" name="nsum_label">
- <property name="minimumSize">
- <size>
- <width>30</width>
- <height>0</height>
- </size>
- </property>
- <property name="toolTip">
- <string><html><head/><body><p>Number of echo transmissions averaged</p></body></html></string>
- </property>
- <property name="text">
- <string>N: 0</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="pbColors">
- <property name="maximumSize">
- <size>
- <width>50</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string><html><head/><body><p>Click to cycle through a sequence of colors and line widths.</p></body></html></string>
- </property>
- <property name="text">
- <string>Colors</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer_5">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Expanding</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <customwidgets>
- <customwidget>
- <class>EPlotter</class>
- <extends>QFrame</extends>
- <header>widgets/plotter.h</header>
- <container>1</container>
- </customwidget>
- </customwidgets>
- <resources/>
- <connections/>
-</ui>
+<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>EchoGraph</class> + <widget class="QDialog" name="EchoGraph"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>625</width> + <height>336</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>570</width> + <height>0</height> + </size> + </property> + <property name="windowTitle"> + <string>Echo Graph</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <property name="spacing"> + <number>2</number> + </property> + <property name="topMargin"> + <number>2</number> + </property> + <property name="bottomMargin"> + <number>2</number> + </property> + <item> + <layout class="QVBoxLayout" name="verticalLayout"> + <property name="spacing"> + <number>2</number> + </property> + <item> + <widget class="EPlotter" name="echoPlot"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>273</width> + <height>200</height> + </size> + </property> + <property name="frameShape"> + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Sunken</enum> + </property> + <property name="lineWidth"> + <number>1</number> + </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <property name="spacing"> + <number>6</number> + </property> + <item> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QSpinBox" name="binsPerPixelSpinBox"> + <property name="minimumSize"> + <size> + <width>60</width> + <height>0</height> + </size> + </property> + <property name="toolTip"> + <string><html><head/><body><p>Compression factor for frequency scale</p></body></html></string> + </property> + <property name="prefix"> + <string>Bins/Pixel </string> + </property> + <property name="minimum"> + <number>1</number> + </property> + <property name="maximum"> + <number>10</number> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_4"> + <property name="text"> + <string>Gain</string> + </property> + </widget> + </item> + <item> + <widget class="QSlider" name="gainSlider"> + <property name="toolTip"> + <string><html><head/><body><p>Echo spectrum gain</p></body></html></string> + </property> + <property name="minimum"> + <number>-30</number> + </property> + <property name="maximum"> + <number>30</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_7"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Preferred</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Zero</string> + </property> + </widget> + </item> + <item> + <widget class="QSlider" name="zeroSlider"> + <property name="toolTip"> + <string><html><head/><body><p>Echo spectrum zero</p></body></html></string> + </property> + <property name="minimum"> + <number>-150</number> + </property> + <property name="maximum"> + <number>150</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Preferred</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QCheckBox" name="cbBaseline"> + <property name="text"> + <string>Baseline</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_4"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Preferred</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QSpinBox" name="smoothSpinBox"> + <property name="minimumSize"> + <size> + <width>60</width> + <height>0</height> + </size> + </property> + <property name="toolTip"> + <string><html><head/><body><p>Smoothing of echo spectrum</p></body></html></string> + </property> + <property name="prefix"> + <string>Smooth </string> + </property> + <property name="maximum"> + <number>20</number> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_3"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Preferred</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="nsum_label"> + <property name="minimumSize"> + <size> + <width>30</width> + <height>0</height> + </size> + </property> + <property name="toolTip"> + <string><html><head/><body><p>Number of echo transmissions averaged</p></body></html></string> + </property> + <property name="text"> + <string>N: 0</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="pbColors"> + <property name="maximumSize"> + <size> + <width>50</width> + <height>16777215</height> + </size> + </property> + <property name="toolTip"> + <string><html><head/><body><p>Click to cycle through a sequence of colors and line widths.</p></body></html></string> + </property> + <property name="text"> + <string>Colors</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_5"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + </layout> + </item> + </layout> + </widget> + <customwidgets> + <customwidget> + <class>EPlotter</class> + <extends>QFrame</extends> + <header>widgets/plotter.h</header> + <container>1</container> + </customwidget> + </customwidgets> + <resources/> + <connections/> +</ui> diff --git a/widgets/echoplot.cpp b/widgets/echoplot.cpp index 80202c35..65feb7a8 100755..100644 --- a/widgets/echoplot.cpp +++ b/widgets/echoplot.cpp @@ -1,338 +1,338 @@ -#include "echoplot.h"
-#include "commons.h"
-#include <math.h>
-#include <QPainter>
-#include <QPen>
-#include <QDebug>
-#include "moc_echoplot.cpp"
-
-#define MAX_SCREENSIZE 2048
-
-
-EPlotter::EPlotter(QWidget *parent) : //EPlotter Constructor
- QFrame(parent)
-{
- setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
- setFocusPolicy(Qt::StrongFocus);
- setAttribute(Qt::WA_PaintOnScreen,false);
- setAutoFillBackground(false);
- setAttribute(Qt::WA_OpaquePaintEvent, false);
- setAttribute(Qt::WA_NoSystemBackground, true);
-
- m_StartFreq = -200;
- m_fftBinWidth=12000.0/32768.0;
- m_binsPerPixel=1;
- m_fSpan=1000.0;
- m_hdivs = HORZ_DIVS;
- m_Running = false;
- m_paintEventBusy=false;
- m_2DPixmap = QPixmap(0,0);
- m_ScalePixmap = QPixmap(0,0);
- m_OverlayPixmap = QPixmap(0,0);
- m_Size = QSize(0,0);
- m_TxFreq = 1500;
- m_line = 0;
- m_dBStepSize=10;
-}
-
-EPlotter::~EPlotter() { } // Destructor
-
-QSize EPlotter::minimumSizeHint() const
-{
- return QSize(50, 50);
-}
-
-QSize EPlotter::sizeHint() const
-{
- return QSize(180, 180);
-}
-
-void EPlotter::resizeEvent(QResizeEvent* ) //resizeEvent()
-{
- if(!size().isValid()) return;
- if( m_Size != size() ) { //if changed, resize pixmaps to new screensize
- m_Size = size();
- m_w = m_Size.width();
- m_h = m_Size.height();
- m_h1=30;
- m_h2=m_h-m_h1;
- m_2DPixmap = QPixmap(m_Size.width(), m_h2);
- m_2DPixmap.fill(Qt::black);
- m_OverlayPixmap = QPixmap(m_Size.width(), m_h2);
- m_ScalePixmap = QPixmap(m_w,30);
- m_ScalePixmap.fill(Qt::white);
- m_fSpan=m_w*m_fftBinWidth*m_binsPerPixel;
- m_StartFreq=50 * int((-0.5*m_fSpan)/50.0 - 0.5);
- }
- DrawOverlay();
- draw();
-}
-
-void EPlotter::paintEvent(QPaintEvent *) // paintEvent()
-{
- if(m_paintEventBusy) return;
- m_paintEventBusy=true;
- QPainter painter(this);
- painter.drawPixmap(0,0,m_ScalePixmap);
- painter.drawPixmap(0,m_h1,m_2DPixmap);
- m_paintEventBusy=false;
-}
-
-void EPlotter::draw() //draw()
-{
- int i,j,y;
- float blue[4096],red[4096];
- float gain = pow(10.0,(m_plotGain/20.0));
- QPen penBlue(QColor(0,255,255),1);
- QPen penRed(Qt::red,1);
- QPen penRed2(Qt::red,2);
- QPen penBlack(Qt::black,1);
- QPen penBlack2(Qt::black,2);
-
- if(m_2DPixmap.size().width()==0) return;
- QPainter painter2D(&m_2DPixmap);
- QRect tmp(0,0,m_w,m_h2);
- if(m_nColor < 2) {
- painter2D.fillRect(tmp,Qt::black);
- } else {
- painter2D.fillRect(tmp,Qt::white);
- painter2D.setPen(penBlack);
- painter2D.drawLine(0,0,m_w,0);
- }
-
- QPoint LineBuf[MAX_SCREENSIZE];
-
- if(m_binsPerPixel==0) m_binsPerPixel=1;
- j=0;
- for(i=0; i<4096/m_binsPerPixel; i++) {
- blue[i]=0.0;
- red[i]=0.0;
- for(int k=0; k<m_binsPerPixel; k++) {
- blue[i]+=echocom_.blue[j];
- red[i]+=echocom_.red[j];
- j++;
- }
- }
- if(m_smooth>0) {
- for(i=0; i<m_smooth; i++) {
- int n4096=4096;
- smo121_(blue,&n4096);
- smo121_(red,&n4096);
- }
- }
-
-// check i0 value! ...
- int i0=2048/m_binsPerPixel + int(m_StartFreq/(m_fftBinWidth*m_binsPerPixel));
- if(m_blue) {
- painter2D.setPen(penBlue);
- j=0;
- for(i=0; i<m_w; i++) {
- y = 0.9*m_h2 - gain*(m_h/10.0)*blue[i0+i] - 0.01*m_h2*m_plotZero;
- LineBuf[j].setX(i);
- LineBuf[j].setY(y);
- j++;
- }
- painter2D.drawPolyline(LineBuf,j);
- }
- switch (m_nColor) {
- case 0: painter2D.setPen(penRed); break;
- case 1: painter2D.setPen(penRed2); break;
- case 2: painter2D.setPen(penRed); break;
- case 3: painter2D.setPen(penRed2); break;
- case 4: painter2D.setPen(penBlack); break;
- case 5: painter2D.setPen(penBlack2); break;
- }
-
- j=0;
- for(int i=0; i<m_w; i++) {
- y = 0.9*m_h2 - gain*(m_h/10.0)*red[i0+i] - 0.01*m_h2*m_plotZero;
- LineBuf[j].setX(i);
- LineBuf[j].setY(y);
- j++;
- }
- painter2D.drawPolyline(LineBuf,j);
-
- if(m_bBaseline) {
- // Draw the baseline
- y = 0.9*m_h2 - 0.01*m_h2*m_plotZero;
- painter2D.drawLine(0,y,m_w,y);
- }
-
- update(); //trigger a new paintEvent
-}
-
-void EPlotter::DrawOverlay() //DrawOverlay()
-{
- if(m_OverlayPixmap.isNull() or m_2DPixmap.isNull()) return;
-// int w = m_WaterfallPixmap.width();
- int x,y;
-
- QPainter painter(&m_OverlayPixmap);
- painter.setBackground (palette ().brush (backgroundRole ()));
- QLinearGradient gradient(0, 0, 0 ,m_h2); //fill background with gradient
- gradient.setColorAt(1, Qt::black);
- gradient.setColorAt(0, Qt::darkBlue);
- painter.setBrush(gradient);
- painter.drawRect(0, 0, m_w, m_h2);
- painter.setBrush(Qt::SolidPattern);
-
- m_fSpan = m_w*m_fftBinWidth*m_binsPerPixel;
- m_freqPerDiv=20;
- if(m_fSpan>250) m_freqPerDiv=50;
- if(m_fSpan>500) m_freqPerDiv=100;
- if(m_fSpan>1000) m_freqPerDiv=200;
- if(m_fSpan>2000) m_freqPerDiv=500;
-
-// m_StartFreq=50 * int((-0.5*m_fSpan)/50.0 - 0.5);
- m_StartFreq=m_freqPerDiv * int((-0.5*m_fSpan)/m_freqPerDiv - 0.5);
-
- float pixPerHdiv = m_freqPerDiv/(m_fftBinWidth*m_binsPerPixel);
- float pixPerVdiv = float(m_h2)/float(VERT_DIVS);
-
- m_hdivs = m_w*m_fftBinWidth*m_binsPerPixel/m_freqPerDiv + 0.9999;
-
- painter.setPen(QPen(Qt::white, 1,Qt::DotLine));
- for( int i=1; i<m_hdivs; i++) //draw vertical grids
- {
- x=int(i*pixPerHdiv);
- painter.drawLine(x,0,x,m_h2);
- }
-
- for( int i=1; i<VERT_DIVS; i++) //draw horizontal grids
- {
- y = (int)( (float)i*pixPerVdiv );
- painter.drawLine(0,y,m_w,y);
- }
-
- QRect rect0;
- QPainter painter0(&m_ScalePixmap);
- painter0.setBackground (palette ().brush (backgroundRole ()));
-
- //create Font to use for scales
- QFont Font("Arial");
- Font.setPointSize(12);
- QFontMetrics metrics(Font);
- Font.setWeight(QFont::Normal);
- painter0.setFont(Font);
- painter0.setPen(Qt::black);
-
- m_ScalePixmap.fill(Qt::white);
- painter0.drawRect(0, 0, m_w, 30);
-
-//draw tick marks on upper scale
- for( int i=1; i<m_hdivs; i++) { //major ticks
- x = (int)( (float)i*pixPerHdiv );
- painter0.drawLine(x,18,x,30);
- }
- int minor=5;
- if(m_freqPerDiv==200) minor=4;
- for( int i=1; i<minor*m_hdivs; i++) { //minor ticks
- x = i*pixPerHdiv/minor;
- painter0.drawLine(x,24,x,30);
- }
-
-//draw frequency values
- MakeFrequencyStrs();
- for( int i=0; i<=m_hdivs; i++) {
- if(0==i) {
- //left justify the leftmost text
- x = (int)( (float)i*pixPerHdiv);
- rect0.setRect(x,0, (int)pixPerHdiv, 20);
- painter0.drawText(rect0, Qt::AlignLeft|Qt::AlignVCenter,
- m_HDivText[i]);
- }
- else if(m_hdivs == i) {
- //right justify the rightmost text
- x = (int)( (float)i*pixPerHdiv - pixPerHdiv);
- rect0.setRect(x,0, (int)pixPerHdiv, 20);
- painter0.drawText(rect0, Qt::AlignRight|Qt::AlignVCenter,
- m_HDivText[i]);
- } else {
- //center justify the rest of the text
- x = (int)( (float)i*pixPerHdiv - pixPerHdiv/2);
- rect0.setRect(x,0, (int)pixPerHdiv, 20);
- painter0.drawText(rect0, Qt::AlignHCenter|Qt::AlignVCenter,
- m_HDivText[i]);
- }
- }
-
-/*
- QPen pen1(Qt::red, 3); //Mark Tx Freq with red tick
- painter0.setPen(pen1);
- x = XfromFreq(m_TxFreq);
- painter0.drawLine(x,17,x,30);
-*/
-}
-
-void EPlotter::MakeFrequencyStrs() //MakeFrequencyStrs
-{
- float freq;
- for(int i=0; i<=m_hdivs; i++) {
- freq=m_StartFreq + i*m_freqPerDiv;
- m_HDivText[i].setNum((int)freq);
- }
-}
-
-int EPlotter::XfromFreq(float f) //XfromFreq()
-{
- int x = (int) m_w * (f - m_StartFreq)/m_fSpan;
- if(x<0 ) return 0;
- if(x>m_w) return m_w;
- return x;
-}
-
-float EPlotter::FreqfromX(int x) //FreqfromX()
-{
- return float(m_StartFreq + x*m_fftBinWidth*m_binsPerPixel);
-}
-
-void EPlotter::SetRunningState(bool running) //SetRunningState()
-{
- m_Running = running;
-}
-
-void EPlotter::setPlotZero(int plotZero) //setPlotZero()
-{
- m_plotZero=plotZero;
-}
-
-int EPlotter::getPlotZero() //getPlotZero()
-{
- return m_plotZero;
-}
-
-void EPlotter::setPlotGain(int plotGain) //setPlotGain()
-{
- m_plotGain=plotGain;
-}
-
-int EPlotter::getPlotGain() //getPlotGain()
-{
- return m_plotGain;
-}
-
-void EPlotter::setSmooth(int n) //setSmooth()
-{
- m_smooth=n;
-}
-
-int EPlotter::getSmooth() //getSmooth()
-{
- return m_smooth;
-}
-
-void EPlotter::setColors(qint32 n) //setSmooth()
-{
- m_nColor=n;
- draw();
-}
-
-int EPlotter::plotWidth(){return m_2DPixmap.width();}
-
-void EPlotter::UpdateOverlay() {DrawOverlay();}
-
-void EPlotter::setBaseline(bool b)
-{
- m_bBaseline=b;
- draw();
-}
+#include "echoplot.h" +#include "commons.h" +#include <math.h> +#include <QPainter> +#include <QPen> +#include <QDebug> +#include "moc_echoplot.cpp" + +#define MAX_SCREENSIZE 2048 + + +EPlotter::EPlotter(QWidget *parent) : //EPlotter Constructor + QFrame(parent) +{ + setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + setFocusPolicy(Qt::StrongFocus); + setAttribute(Qt::WA_PaintOnScreen,false); + setAutoFillBackground(false); + setAttribute(Qt::WA_OpaquePaintEvent, false); + setAttribute(Qt::WA_NoSystemBackground, true); + + m_StartFreq = -200; + m_fftBinWidth=12000.0/32768.0; + m_binsPerPixel=1; + m_fSpan=1000.0; + m_hdivs = HORZ_DIVS; + m_Running = false; + m_paintEventBusy=false; + m_2DPixmap = QPixmap(0,0); + m_ScalePixmap = QPixmap(0,0); + m_OverlayPixmap = QPixmap(0,0); + m_Size = QSize(0,0); + m_TxFreq = 1500; + m_line = 0; + m_dBStepSize=10; +} + +EPlotter::~EPlotter() { } // Destructor + +QSize EPlotter::minimumSizeHint() const +{ + return QSize(50, 50); +} + +QSize EPlotter::sizeHint() const +{ + return QSize(180, 180); +} + +void EPlotter::resizeEvent(QResizeEvent* ) //resizeEvent() +{ + if(!size().isValid()) return; + if( m_Size != size() ) { //if changed, resize pixmaps to new screensize + m_Size = size(); + m_w = m_Size.width(); + m_h = m_Size.height(); + m_h1=30; + m_h2=m_h-m_h1; + m_2DPixmap = QPixmap(m_Size.width(), m_h2); + m_2DPixmap.fill(Qt::black); + m_OverlayPixmap = QPixmap(m_Size.width(), m_h2); + m_ScalePixmap = QPixmap(m_w,30); + m_ScalePixmap.fill(Qt::white); + m_fSpan=m_w*m_fftBinWidth*m_binsPerPixel; + m_StartFreq=50 * int((-0.5*m_fSpan)/50.0 - 0.5); + } + DrawOverlay(); + draw(); +} + +void EPlotter::paintEvent(QPaintEvent *) // paintEvent() +{ + if(m_paintEventBusy) return; + m_paintEventBusy=true; + QPainter painter(this); + painter.drawPixmap(0,0,m_ScalePixmap); + painter.drawPixmap(0,m_h1,m_2DPixmap); + m_paintEventBusy=false; +} + +void EPlotter::draw() //draw() +{ + int i,j,y; + float blue[4096],red[4096]; + float gain = pow(10.0,(m_plotGain/20.0)); + QPen penBlue(QColor(0,255,255),1); + QPen penRed(Qt::red,1); + QPen penRed2(Qt::red,2); + QPen penBlack(Qt::black,1); + QPen penBlack2(Qt::black,2); + + if(m_2DPixmap.size().width()==0) return; + QPainter painter2D(&m_2DPixmap); + QRect tmp(0,0,m_w,m_h2); + if(m_nColor < 2) { + painter2D.fillRect(tmp,Qt::black); + } else { + painter2D.fillRect(tmp,Qt::white); + painter2D.setPen(penBlack); + painter2D.drawLine(0,0,m_w,0); + } + + QPoint LineBuf[MAX_SCREENSIZE]; + + if(m_binsPerPixel==0) m_binsPerPixel=1; + j=0; + for(i=0; i<4096/m_binsPerPixel; i++) { + blue[i]=0.0; + red[i]=0.0; + for(int k=0; k<m_binsPerPixel; k++) { + blue[i]+=echocom_.blue[j]; + red[i]+=echocom_.red[j]; + j++; + } + } + if(m_smooth>0) { + for(i=0; i<m_smooth; i++) { + int n4096=4096; + smo121_(blue,&n4096); + smo121_(red,&n4096); + } + } + +// check i0 value! ... + int i0=2048/m_binsPerPixel + int(m_StartFreq/(m_fftBinWidth*m_binsPerPixel)); + if(m_blue) { + painter2D.setPen(penBlue); + j=0; + for(i=0; i<m_w; i++) { + y = 0.9*m_h2 - gain*(m_h/10.0)*blue[i0+i] - 0.01*m_h2*m_plotZero; + LineBuf[j].setX(i); + LineBuf[j].setY(y); + j++; + } + painter2D.drawPolyline(LineBuf,j); + } + switch (m_nColor) { + case 0: painter2D.setPen(penRed); break; + case 1: painter2D.setPen(penRed2); break; + case 2: painter2D.setPen(penRed); break; + case 3: painter2D.setPen(penRed2); break; + case 4: painter2D.setPen(penBlack); break; + case 5: painter2D.setPen(penBlack2); break; + } + + j=0; + for(int i=0; i<m_w; i++) { + y = 0.9*m_h2 - gain*(m_h/10.0)*red[i0+i] - 0.01*m_h2*m_plotZero; + LineBuf[j].setX(i); + LineBuf[j].setY(y); + j++; + } + painter2D.drawPolyline(LineBuf,j); + + if(m_bBaseline) { + // Draw the baseline + y = 0.9*m_h2 - 0.01*m_h2*m_plotZero; + painter2D.drawLine(0,y,m_w,y); + } + + update(); //trigger a new paintEvent +} + +void EPlotter::DrawOverlay() //DrawOverlay() +{ + if(m_OverlayPixmap.isNull() or m_2DPixmap.isNull()) return; +// int w = m_WaterfallPixmap.width(); + int x,y; + + QPainter painter(&m_OverlayPixmap); + painter.setBackground (palette ().brush (backgroundRole ())); + QLinearGradient gradient(0, 0, 0 ,m_h2); //fill background with gradient + gradient.setColorAt(1, Qt::black); + gradient.setColorAt(0, Qt::darkBlue); + painter.setBrush(gradient); + painter.drawRect(0, 0, m_w, m_h2); + painter.setBrush(Qt::SolidPattern); + + m_fSpan = m_w*m_fftBinWidth*m_binsPerPixel; + m_freqPerDiv=20; + if(m_fSpan>250) m_freqPerDiv=50; + if(m_fSpan>500) m_freqPerDiv=100; + if(m_fSpan>1000) m_freqPerDiv=200; + if(m_fSpan>2000) m_freqPerDiv=500; + +// m_StartFreq=50 * int((-0.5*m_fSpan)/50.0 - 0.5); + m_StartFreq=m_freqPerDiv * int((-0.5*m_fSpan)/m_freqPerDiv - 0.5); + + float pixPerHdiv = m_freqPerDiv/(m_fftBinWidth*m_binsPerPixel); + float pixPerVdiv = float(m_h2)/float(VERT_DIVS); + + m_hdivs = m_w*m_fftBinWidth*m_binsPerPixel/m_freqPerDiv + 0.9999; + + painter.setPen(QPen(Qt::white, 1,Qt::DotLine)); + for( int i=1; i<m_hdivs; i++) //draw vertical grids + { + x=int(i*pixPerHdiv); + painter.drawLine(x,0,x,m_h2); + } + + for( int i=1; i<VERT_DIVS; i++) //draw horizontal grids + { + y = (int)( (float)i*pixPerVdiv ); + painter.drawLine(0,y,m_w,y); + } + + QRect rect0; + QPainter painter0(&m_ScalePixmap); + painter0.setBackground (palette ().brush (backgroundRole ())); + + //create Font to use for scales + QFont Font("Arial"); + Font.setPointSize(12); + QFontMetrics metrics(Font); + Font.setWeight(QFont::Normal); + painter0.setFont(Font); + painter0.setPen(Qt::black); + + m_ScalePixmap.fill(Qt::white); + painter0.drawRect(0, 0, m_w, 30); + +//draw tick marks on upper scale + for( int i=1; i<m_hdivs; i++) { //major ticks + x = (int)( (float)i*pixPerHdiv ); + painter0.drawLine(x,18,x,30); + } + int minor=5; + if(m_freqPerDiv==200) minor=4; + for( int i=1; i<minor*m_hdivs; i++) { //minor ticks + x = i*pixPerHdiv/minor; + painter0.drawLine(x,24,x,30); + } + +//draw frequency values + MakeFrequencyStrs(); + for( int i=0; i<=m_hdivs; i++) { + if(0==i) { + //left justify the leftmost text + x = (int)( (float)i*pixPerHdiv); + rect0.setRect(x,0, (int)pixPerHdiv, 20); + painter0.drawText(rect0, Qt::AlignLeft|Qt::AlignVCenter, + m_HDivText[i]); + } + else if(m_hdivs == i) { + //right justify the rightmost text + x = (int)( (float)i*pixPerHdiv - pixPerHdiv); + rect0.setRect(x,0, (int)pixPerHdiv, 20); + painter0.drawText(rect0, Qt::AlignRight|Qt::AlignVCenter, + m_HDivText[i]); + } else { + //center justify the rest of the text + x = (int)( (float)i*pixPerHdiv - pixPerHdiv/2); + rect0.setRect(x,0, (int)pixPerHdiv, 20); + painter0.drawText(rect0, Qt::AlignHCenter|Qt::AlignVCenter, + m_HDivText[i]); + } + } + +/* + QPen pen1(Qt::red, 3); //Mark Tx Freq with red tick + painter0.setPen(pen1); + x = XfromFreq(m_TxFreq); + painter0.drawLine(x,17,x,30); +*/ +} + +void EPlotter::MakeFrequencyStrs() //MakeFrequencyStrs +{ + float freq; + for(int i=0; i<=m_hdivs; i++) { + freq=m_StartFreq + i*m_freqPerDiv; + m_HDivText[i].setNum((int)freq); + } +} + +int EPlotter::XfromFreq(float f) //XfromFreq() +{ + int x = (int) m_w * (f - m_StartFreq)/m_fSpan; + if(x<0 ) return 0; + if(x>m_w) return m_w; + return x; +} + +float EPlotter::FreqfromX(int x) //FreqfromX() +{ + return float(m_StartFreq + x*m_fftBinWidth*m_binsPerPixel); +} + +void EPlotter::SetRunningState(bool running) //SetRunningState() +{ + m_Running = running; +} + +void EPlotter::setPlotZero(int plotZero) //setPlotZero() +{ + m_plotZero=plotZero; +} + +int EPlotter::getPlotZero() //getPlotZero() +{ + return m_plotZero; +} + +void EPlotter::setPlotGain(int plotGain) //setPlotGain() +{ + m_plotGain=plotGain; +} + +int EPlotter::getPlotGain() //getPlotGain() +{ + return m_plotGain; +} + +void EPlotter::setSmooth(int n) //setSmooth() +{ + m_smooth=n; +} + +int EPlotter::getSmooth() //getSmooth() +{ + return m_smooth; +} + +void EPlotter::setColors(qint32 n) //setSmooth() +{ + m_nColor=n; + draw(); +} + +int EPlotter::plotWidth(){return m_2DPixmap.width();} + +void EPlotter::UpdateOverlay() {DrawOverlay();} + +void EPlotter::setBaseline(bool b) +{ + m_bBaseline=b; + draw(); +} diff --git a/widgets/echoplot.h b/widgets/echoplot.h index e23adfee..44286fb6 100755..100644 --- a/widgets/echoplot.h +++ b/widgets/echoplot.h @@ -1,98 +1,98 @@ -///////////////////////////////////////////////////////////////////////////
-// Some code in this file and accompanying files is based on work by
-// Moe Wheatley, AE4Y, released under the "Simplified BSD License".
-// For more details see the accompanying file LICENSE_WHEATLEY.TXT
-///////////////////////////////////////////////////////////////////////////
-
-#ifndef EPLOTTER_H_
-#define EPLOTTER_H_
-
-#include <QFrame>
-#include <QSize>
-#include <QImage>
-#include <QString>
-
-#define VERT_DIVS 7 //specify grid screen divisions
-#define HORZ_DIVS 20
-
-class QPaintEvent;
-class QResizeEvent;
-
-class EPlotter : public QFrame
-{
- Q_OBJECT
-public:
- explicit EPlotter(QWidget *parent = 0);
- ~EPlotter();
-
- QSize minimumSizeHint() const;
- QSize sizeHint() const;
- float m_fSpan;
- qint32 m_TxFreq;
- qint32 m_w;
- qint32 m_plotZero;
- qint32 m_plotGain;
- qint32 m_smooth;
- qint32 m_binsPerPixel;
- qint32 m_nColor;
- bool m_blue;
- bool m_bBaseline;
-
- void draw(); //Update the Echo plot
- void SetRunningState(bool running);
- void setPlotZero(int plotZero);
- int getPlotZero();
- void setPlotGain(int plotGain);
- int getPlotGain();
- int plotWidth();
- void UpdateOverlay();
- void DrawOverlay();
- void setSmooth(int n);
- int getSmooth();
- void setColors(qint32 n);
- void setBaseline(bool b);
-
-// void SetPercent2DScreen(int percent){m_Percent2DScreen=percent;}
-
-protected:
- //re-implemented widget event handlers
- void paintEvent(QPaintEvent *event);
- void resizeEvent(QResizeEvent* event);
-
-private:
-
- void MakeFrequencyStrs();
- int XfromFreq(float f);
- float FreqfromX(int x);
- qint64 RoundFreq(qint64 freq, int resolution);
-
- QPixmap m_2DPixmap;
- QPixmap m_ScalePixmap;
- QPixmap m_OverlayPixmap;
- QSize m_Size;
- QString m_Str;
- QString m_HDivText[483];
-
- double m_fftBinWidth;
-
- qint64 m_StartFreq;
-
- qint32 m_dBStepSize;
- qint32 m_hdivs;
- qint32 m_line;
- qint32 m_freqPerDiv;
- qint32 m_h;
- qint32 m_h1;
- qint32 m_h2;
-
- bool m_Running;
- bool m_paintEventBusy;
-
-};
-
-extern "C" {
-//--------------------------------------------------- C and Fortran routines
-
-void smo121_(float x[], int* npts);
-}
-#endif // EPLOTTER_H
+/////////////////////////////////////////////////////////////////////////// +// Some code in this file and accompanying files is based on work by +// Moe Wheatley, AE4Y, released under the "Simplified BSD License". +// For more details see the accompanying file LICENSE_WHEATLEY.TXT +/////////////////////////////////////////////////////////////////////////// + +#ifndef EPLOTTER_H_ +#define EPLOTTER_H_ + +#include <QFrame> +#include <QSize> +#include <QImage> +#include <QString> + +#define VERT_DIVS 7 //specify grid screen divisions +#define HORZ_DIVS 20 + +class QPaintEvent; +class QResizeEvent; + +class EPlotter : public QFrame +{ + Q_OBJECT +public: + explicit EPlotter(QWidget *parent = 0); + ~EPlotter(); + + QSize minimumSizeHint() const; + QSize sizeHint() const; + float m_fSpan; + qint32 m_TxFreq; + qint32 m_w; + qint32 m_plotZero; + qint32 m_plotGain; + qint32 m_smooth; + qint32 m_binsPerPixel; + qint32 m_nColor; + bool m_blue; + bool m_bBaseline; + + void draw(); //Update the Echo plot + void SetRunningState(bool running); + void setPlotZero(int plotZero); + int getPlotZero(); + void setPlotGain(int plotGain); + int getPlotGain(); + int plotWidth(); + void UpdateOverlay(); + void DrawOverlay(); + void setSmooth(int n); + int getSmooth(); + void setColors(qint32 n); + void setBaseline(bool b); + +// void SetPercent2DScreen(int percent){m_Percent2DScreen=percent;} + +protected: + //re-implemented widget event handlers + void paintEvent(QPaintEvent *event); + void resizeEvent(QResizeEvent* event); + +private: + + void MakeFrequencyStrs(); + int XfromFreq(float f); + float FreqfromX(int x); + qint64 RoundFreq(qint64 freq, int resolution); + + QPixmap m_2DPixmap; + QPixmap m_ScalePixmap; + QPixmap m_OverlayPixmap; + QSize m_Size; + QString m_Str; + QString m_HDivText[483]; + + double m_fftBinWidth; + + qint64 m_StartFreq; + + qint32 m_dBStepSize; + qint32 m_hdivs; + qint32 m_line; + qint32 m_freqPerDiv; + qint32 m_h; + qint32 m_h1; + qint32 m_h2; + + bool m_Running; + bool m_paintEventBusy; + +}; + +extern "C" { +//--------------------------------------------------- C and Fortran routines + +void smo121_(float x[], int* npts); +} +#endif // EPLOTTER_H diff --git a/widgets/fastgraph.cpp b/widgets/fastgraph.cpp index f56e85ee..9efe5fc6 100755..100644 --- a/widgets/fastgraph.cpp +++ b/widgets/fastgraph.cpp @@ -1,126 +1,126 @@ -#include "fastgraph.h"
-
-#include "commons.h"
-#include <QSettings>
-#include <QApplication>
-#include <QKeyEvent>
-#include "fastplot.h"
-#include "SettingsGroup.hpp"
-
-#include "ui_fastgraph.h"
-#include "moc_fastgraph.cpp"
-
-#define NSMAX2 1366
-
-FastGraph::FastGraph(QSettings * settings, QWidget *parent) :
- QDialog {parent, Qt::Window | Qt::WindowTitleHint |
- Qt::WindowCloseButtonHint |
- Qt::WindowMinimizeButtonHint},
- m_settings {settings},
- m_ave {40},
- ui {new Ui::FastGraph}
-{
- ui->setupUi(this);
- setWindowTitle (QApplication::applicationName () + " - " + tr ("Fast Graph"));
- installEventFilter(parent); //Installing the filter
- ui->fastPlot->setCursor(Qt::CrossCursor);
-
- //Restore user's settings
- SettingsGroup g {m_settings, "FastGraph"};
- restoreGeometry (m_settings->value ("geometry", saveGeometry ()).toByteArray ());
- ui->fastPlot->setPlotZero(m_settings->value("PlotZero", 0).toInt());
- ui->fastPlot->setPlotGain(m_settings->value("PlotGain", 0).toInt());
- ui->zeroSlider->setValue(ui->fastPlot->m_plotZero);
- ui->gainSlider->setValue(ui->fastPlot->m_plotGain);
- ui->fastPlot->setGreenZero(m_settings->value("GreenZero", 0).toInt());
- ui->greenZeroSlider->setValue(ui->fastPlot->m_greenZero);
-// ui->controls_widget->setVisible (!m_settings->value("HideControls", false).toBool ());
- ui->controls_widget->setVisible(true);
- connect (ui->fastPlot, &FPlotter::fastPick, this, &FastGraph::fastPick);
-}
-
-void FastGraph::closeEvent (QCloseEvent * e)
-{
- saveSettings ();
- QDialog::closeEvent (e);
-}
-
-FastGraph::~FastGraph ()
-{
-}
-
-void FastGraph::saveSettings()
-{
-//Save user's settings
- SettingsGroup g {m_settings, "FastGraph"};
- m_settings->setValue ("geometry", saveGeometry ());
- m_settings->setValue("PlotZero",ui->fastPlot->m_plotZero);
- m_settings->setValue("PlotGain",ui->fastPlot->m_plotGain);
- m_settings->setValue("GreenZero",ui->fastPlot->m_greenZero);
- m_settings->setValue("GreenGain",ui->fastPlot->m_greenGain);
-// m_settings->setValue ("HideControls", ui->controls_widget->isHidden ());
-}
-
-void FastGraph::plotSpec(bool diskData, int UTCdisk)
-{
- ui->fastPlot->m_diskData=diskData;
- ui->fastPlot->m_UTCdisk=UTCdisk;
- ui->fastPlot->draw();
-}
-
-void FastGraph::on_gainSlider_valueChanged(int value)
-{
- ui->fastPlot->setPlotGain(value);
- ui->fastPlot->draw();
-}
-
-void FastGraph::on_zeroSlider_valueChanged(int value)
-{
- ui->fastPlot->setPlotZero(value);
- ui->fastPlot->draw();
-}
-
-void FastGraph::on_greenZeroSlider_valueChanged(int value)
-{
- ui->fastPlot->setGreenZero(value);
- ui->fastPlot->draw();
-}
-
-void FastGraph::setTRPeriod(double p)
-{
- m_TRperiod=p;
- ui->fastPlot->setTRperiod(m_TRperiod);
-}
-
-void FastGraph::on_pbAutoLevel_clicked()
-{
- float sum=0.0;
- for(int i=0; i<=fast_jh; i++) {
- sum += fast_green[i];
- }
- m_ave=sum/fast_jh;
- ui->gainSlider->setValue(127-int(2.2*m_ave));
- ui->zeroSlider->setValue(int(m_ave)+20);
- ui->greenZeroSlider->setValue(160-int(3.3*m_ave));
-}
-
-void FastGraph::setMode(QString mode) //setMode
-{
- ui->fastPlot->setMode(mode);
-}
-
-void FastGraph::keyPressEvent(QKeyEvent *e)
-{
- switch(e->key())
- {
-/*
- case Qt::Key_M:
- if(e->modifiers() & Qt::ControlModifier) {
- ui->controls_widget->setVisible (!ui->controls_widget->isVisible ());
- }
- break;
-*/
- default:
- QDialog::keyPressEvent (e);
- }
-}
+#include "fastgraph.h" + +#include "commons.h" +#include <QSettings> +#include <QApplication> +#include <QKeyEvent> +#include "fastplot.h" +#include "SettingsGroup.hpp" + +#include "ui_fastgraph.h" +#include "moc_fastgraph.cpp" + +#define NSMAX2 1366 + +FastGraph::FastGraph(QSettings * settings, QWidget *parent) : + QDialog {parent, Qt::Window | Qt::WindowTitleHint | + Qt::WindowCloseButtonHint | + Qt::WindowMinimizeButtonHint}, + m_settings {settings}, + m_ave {40}, + ui {new Ui::FastGraph} +{ + ui->setupUi(this); + setWindowTitle (QApplication::applicationName () + " - " + tr ("Fast Graph")); + installEventFilter(parent); //Installing the filter + ui->fastPlot->setCursor(Qt::CrossCursor); + + //Restore user's settings + SettingsGroup g {m_settings, "FastGraph"}; + restoreGeometry (m_settings->value ("geometry", saveGeometry ()).toByteArray ()); + ui->fastPlot->setPlotZero(m_settings->value("PlotZero", 0).toInt()); + ui->fastPlot->setPlotGain(m_settings->value("PlotGain", 0).toInt()); + ui->zeroSlider->setValue(ui->fastPlot->m_plotZero); + ui->gainSlider->setValue(ui->fastPlot->m_plotGain); + ui->fastPlot->setGreenZero(m_settings->value("GreenZero", 0).toInt()); + ui->greenZeroSlider->setValue(ui->fastPlot->m_greenZero); +// ui->controls_widget->setVisible (!m_settings->value("HideControls", false).toBool ()); + ui->controls_widget->setVisible(true); + connect (ui->fastPlot, &FPlotter::fastPick, this, &FastGraph::fastPick); +} + +void FastGraph::closeEvent (QCloseEvent * e) +{ + saveSettings (); + QDialog::closeEvent (e); +} + +FastGraph::~FastGraph () +{ +} + +void FastGraph::saveSettings() +{ +//Save user's settings + SettingsGroup g {m_settings, "FastGraph"}; + m_settings->setValue ("geometry", saveGeometry ()); + m_settings->setValue("PlotZero",ui->fastPlot->m_plotZero); + m_settings->setValue("PlotGain",ui->fastPlot->m_plotGain); + m_settings->setValue("GreenZero",ui->fastPlot->m_greenZero); + m_settings->setValue("GreenGain",ui->fastPlot->m_greenGain); +// m_settings->setValue ("HideControls", ui->controls_widget->isHidden ()); +} + +void FastGraph::plotSpec(bool diskData, int UTCdisk) +{ + ui->fastPlot->m_diskData=diskData; + ui->fastPlot->m_UTCdisk=UTCdisk; + ui->fastPlot->draw(); +} + +void FastGraph::on_gainSlider_valueChanged(int value) +{ + ui->fastPlot->setPlotGain(value); + ui->fastPlot->draw(); +} + +void FastGraph::on_zeroSlider_valueChanged(int value) +{ + ui->fastPlot->setPlotZero(value); + ui->fastPlot->draw(); +} + +void FastGraph::on_greenZeroSlider_valueChanged(int value) +{ + ui->fastPlot->setGreenZero(value); + ui->fastPlot->draw(); +} + +void FastGraph::setTRPeriod(double p) +{ + m_TRperiod=p; + ui->fastPlot->setTRperiod(m_TRperiod); +} + +void FastGraph::on_pbAutoLevel_clicked() +{ + float sum=0.0; + for(int i=0; i<=fast_jh; i++) { + sum += fast_green[i]; + } + m_ave=sum/fast_jh; + ui->gainSlider->setValue(127-int(2.2*m_ave)); + ui->zeroSlider->setValue(int(m_ave)+20); + ui->greenZeroSlider->setValue(160-int(3.3*m_ave)); +} + +void FastGraph::setMode(QString mode) //setMode +{ + ui->fastPlot->setMode(mode); +} + +void FastGraph::keyPressEvent(QKeyEvent *e) +{ + switch(e->key()) + { +/* + case Qt::Key_M: + if(e->modifiers() & Qt::ControlModifier) { + ui->controls_widget->setVisible (!ui->controls_widget->isVisible ()); + } + break; +*/ + default: + QDialog::keyPressEvent (e); + } +} diff --git a/widgets/fastgraph.h b/widgets/fastgraph.h index 1d34a077..b5f7c0b8 100755..100644 --- a/widgets/fastgraph.h +++ b/widgets/fastgraph.h @@ -1,52 +1,52 @@ -#ifndef FASTGRAPH_H_
-#define FASTGRAPH_H_
-
-#include <QDialog>
-#include <QScopedPointer>
-
-namespace Ui {
- class FastGraph;
-}
-
-class QSettings;
-class QCloseEvent;
-class QKeyEvent;
-
-class FastGraph : public QDialog
-{
- Q_OBJECT
-
-public:
- explicit FastGraph(QSettings *, QWidget *parent = 0);
- ~FastGraph ();
-
- void plotSpec(bool diskData, int UTCdisk);
- void saveSettings();
- void setTRPeriod(double p);
- void setMode(QString mode);
-
-signals:
- void fastPick(int x0, int x1, int y);
-
-private slots:
- void on_gainSlider_valueChanged(int value);
- void on_zeroSlider_valueChanged(int value);
- void on_greenZeroSlider_valueChanged(int value);
- void on_pbAutoLevel_clicked();
-
-protected:
- void closeEvent (QCloseEvent *) override;
- void keyPressEvent( QKeyEvent *e ) override;
-
-private:
- QSettings * m_settings;
- float m_ave;
- double m_TRperiod;
-
- QScopedPointer<Ui::FastGraph> ui;
-};
-
-extern float fast_green[703];
-extern int fast_jh;
-
-#endif // FASTGRAPH_H
+#ifndef FASTGRAPH_H_ +#define FASTGRAPH_H_ + +#include <QDialog> +#include <QScopedPointer> + +namespace Ui { + class FastGraph; +} + +class QSettings; +class QCloseEvent; +class QKeyEvent; + +class FastGraph : public QDialog +{ + Q_OBJECT + +public: + explicit FastGraph(QSettings *, QWidget *parent = 0); + ~FastGraph (); + + void plotSpec(bool diskData, int UTCdisk); + void saveSettings(); + void setTRPeriod(double p); + void setMode(QString mode); + +signals: + void fastPick(int x0, int x1, int y); + +private slots: + void on_gainSlider_valueChanged(int value); + void on_zeroSlider_valueChanged(int value); + void on_greenZeroSlider_valueChanged(int value); + void on_pbAutoLevel_clicked(); + +protected: + void closeEvent (QCloseEvent *) override; + void keyPressEvent( QKeyEvent *e ) override; + +private: + QSettings * m_settings; + float m_ave; + double m_TRperiod; + + QScopedPointer<Ui::FastGraph> ui; +}; + +extern float fast_green[703]; +extern int fast_jh; + +#endif // FASTGRAPH_H diff --git a/widgets/fastgraph.ui b/widgets/fastgraph.ui index ebd42176..c62acad6 100755..100644 --- a/widgets/fastgraph.ui +++ b/widgets/fastgraph.ui @@ -1,246 +1,246 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>FastGraph</class>
- <widget class="QDialog" name="FastGraph">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>707</width>
- <height>253</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Fast Graph</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <property name="spacing">
- <number>2</number>
- </property>
- <property name="sizeConstraint">
- <enum>QLayout::SetFixedSize</enum>
- </property>
- <property name="leftMargin">
- <number>2</number>
- </property>
- <property name="topMargin">
- <number>2</number>
- </property>
- <property name="rightMargin">
- <number>2</number>
- </property>
- <property name="bottomMargin">
- <number>2</number>
- </property>
- <item>
- <widget class="FPlotter" name="fastPlot">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>703</width>
- <height>220</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>703</width>
- <height>220</height>
- </size>
- </property>
- <property name="frameShape">
- <enum>QFrame::StyledPanel</enum>
- </property>
- <property name="frameShadow">
- <enum>QFrame::Sunken</enum>
- </property>
- <property name="lineWidth">
- <number>1</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QWidget" name="controls_widget" native="true">
- <layout class="QHBoxLayout" name="horizontalLayout">
- <property name="leftMargin">
- <number>2</number>
- </property>
- <property name="topMargin">
- <number>2</number>
- </property>
- <property name="rightMargin">
- <number>2</number>
- </property>
- <property name="bottomMargin">
- <number>2</number>
- </property>
- <item>
- <spacer name="horizontalSpacer_2">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Expanding</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>99</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QSlider" name="gainSlider">
- <property name="toolTip">
- <string>Waterfall gain</string>
- </property>
- <property name="minimum">
- <number>-60</number>
- </property>
- <property name="maximum">
- <number>140</number>
- </property>
- <property name="pageStep">
- <number>40</number>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer_7">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Preferred</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QSlider" name="zeroSlider">
- <property name="toolTip">
- <string>Waterfall zero</string>
- </property>
- <property name="minimum">
- <number>-60</number>
- </property>
- <property name="maximum">
- <number>120</number>
- </property>
- <property name="value">
- <number>60</number>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Preferred</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QSlider" name="greenZeroSlider">
- <property name="toolTip">
- <string>Spectrum zero</string>
- </property>
- <property name="minimum">
- <number>-100</number>
- </property>
- <property name="maximum">
- <number>160</number>
- </property>
- <property name="value">
- <number>30</number>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer_3">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Preferred</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QPushButton" name="pbAutoLevel">
- <property name="toolTip">
- <string><html><head/><body><p>Set reasonable levels for gain and zero sliders.</p></body></html></string>
- </property>
- <property name="text">
- <string>Auto Level</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer_5">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Expanding</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>99</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </widget>
- <customwidgets>
- <customwidget>
- <class>FPlotter</class>
- <extends>QFrame</extends>
- <header>widgets/fastplot.h</header>
- <container>1</container>
- </customwidget>
- </customwidgets>
- <resources/>
- <connections/>
-</ui>
+<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>FastGraph</class> + <widget class="QDialog" name="FastGraph"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>707</width> + <height>253</height> + </rect> + </property> + <property name="windowTitle"> + <string>Fast Graph</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <property name="spacing"> + <number>2</number> + </property> + <property name="sizeConstraint"> + <enum>QLayout::SetFixedSize</enum> + </property> + <property name="leftMargin"> + <number>2</number> + </property> + <property name="topMargin"> + <number>2</number> + </property> + <property name="rightMargin"> + <number>2</number> + </property> + <property name="bottomMargin"> + <number>2</number> + </property> + <item> + <widget class="FPlotter" name="fastPlot"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>703</width> + <height>220</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>703</width> + <height>220</height> + </size> + </property> + <property name="frameShape"> + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Sunken</enum> + </property> + <property name="lineWidth"> + <number>1</number> + </property> + </widget> + </item> + <item> + <widget class="QWidget" name="controls_widget" native="true"> + <layout class="QHBoxLayout" name="horizontalLayout"> + <property name="leftMargin"> + <number>2</number> + </property> + <property name="topMargin"> + <number>2</number> + </property> + <property name="rightMargin"> + <number>2</number> + </property> + <property name="bottomMargin"> + <number>2</number> + </property> + <item> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>99</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QSlider" name="gainSlider"> + <property name="toolTip"> + <string>Waterfall gain</string> + </property> + <property name="minimum"> + <number>-60</number> + </property> + <property name="maximum"> + <number>140</number> + </property> + <property name="pageStep"> + <number>40</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_7"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Preferred</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QSlider" name="zeroSlider"> + <property name="toolTip"> + <string>Waterfall zero</string> + </property> + <property name="minimum"> + <number>-60</number> + </property> + <property name="maximum"> + <number>120</number> + </property> + <property name="value"> + <number>60</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Preferred</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QSlider" name="greenZeroSlider"> + <property name="toolTip"> + <string>Spectrum zero</string> + </property> + <property name="minimum"> + <number>-100</number> + </property> + <property name="maximum"> + <number>160</number> + </property> + <property name="value"> + <number>30</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_3"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Preferred</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="pbAutoLevel"> + <property name="toolTip"> + <string><html><head/><body><p>Set reasonable levels for gain and zero sliders.</p></body></html></string> + </property> + <property name="text"> + <string>Auto Level</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_5"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>99</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + <customwidgets> + <customwidget> + <class>FPlotter</class> + <extends>QFrame</extends> + <header>widgets/fastplot.h</header> + <container>1</container> + </customwidget> + </customwidgets> + <resources/> + <connections/> +</ui> diff --git a/widgets/fastplot.cpp b/widgets/fastplot.cpp index c90a645e..b60f811d 100755..100644 --- a/widgets/fastplot.cpp +++ b/widgets/fastplot.cpp @@ -1,290 +1,290 @@ -#include "fastplot.h"
-#include "commons.h"
-#include <math.h>
-#include <QPainter>
-#include <QPen>
-#include <QMouseEvent>
-#include <QDateTime>
-#include <QDebug>
-#include "moc_fastplot.cpp"
-
-#define MAX_SCREENSIZE 2048
-
-FPlotter::FPlotter(QWidget *parent) : //FPlotter Constructor
- QFrame {parent},
- m_w {703},
- m_plotGain {0},
- m_greenZero {0},
- m_x0 {0},
- m_x1 {0},
- m_ScalePixmap {QPixmap {703, 20}},
- m_pixPerSecond {12000.0/512.0},
- m_hdivs {30},
- m_h {220},
- m_h1 {20},
- m_h2 {m_h-m_h1},
- m_HorizPixmap {QPixmap {m_w, m_h2}},
- m_jh0 {9999},
- m_bPaint2 {true}
-{
- m_diskData=false;
- setFocusPolicy(Qt::StrongFocus);
- setAttribute(Qt::WA_PaintOnScreen,false);
- setAutoFillBackground(false);
- setAttribute(Qt::WA_OpaquePaintEvent, false);
- setAttribute(Qt::WA_NoSystemBackground, true);
-
- m_HorizPixmap.fill(Qt::black);
- m_HorizPixmap.fill(Qt::black);
- m_ScalePixmap.fill(Qt::white);
- drawScale();
- draw();
- setMouseTracking(true);
-}
-
-FPlotter::~FPlotter() { } // Destructor
-
-void FPlotter::paintEvent(QPaintEvent *) // paintEvent()
-{
- QPainter painter(this);
- painter.drawPixmap(0,0,m_ScalePixmap);
- painter.drawPixmap(0,m_h1,m_HorizPixmap);
-}
-
-void FPlotter::drawScale() //drawScale()
-{
- if(m_ScalePixmap.isNull()) return;
- int x;
-
- QRect rect0;
- QPainter painter0(&m_ScalePixmap);
- painter0.setBackground (palette ().brush (backgroundRole ()));
-
- //create Font to use for scales
- QFont Font("Arial");
- Font.setPointSize(8);
- QFontMetrics metrics(Font);
- Font.setWeight(QFont::Normal);
- painter0.setFont(Font);
- painter0.setPen(Qt::white);
- m_ScalePixmap.fill(Qt::black);
- painter0.drawRect(0, 0,m_w,19);
- painter0.drawLine(0,19,m_w,19);
-
-//Draw ticks at 1-second intervals
- for( int i=0; i<=m_hdivs; i++) {
- x = (int)( (float)i*m_pixPerSecond );
- painter0.drawLine(x,15,x,19);
- }
-
-//Write numbers on the time scale
- MakeTimeStrs();
- for( int i=0; i<=m_hdivs; i++) {
- if(0==i) {
- //left justify the leftmost text
- x = (int)( (float)i*m_pixPerSecond);
- rect0.setRect(x,0, (int)m_pixPerSecond, 20);
- painter0.drawText(rect0, Qt::AlignLeft|Qt::AlignVCenter,m_HDivText[i]);
- }
- else if(m_hdivs == i) {
- //right justify the rightmost text
- x = (int)( (float)i*m_pixPerSecond - m_pixPerSecond);
- rect0.setRect(x,0, (int)m_pixPerSecond, 20);
- painter0.drawText(rect0, Qt::AlignRight|Qt::AlignVCenter,m_HDivText[i]);
- } else {
- //center justify the rest of the text
- x = (int)( (float)i*m_pixPerSecond - m_pixPerSecond/2);
- rect0.setRect(x,0, (int)m_pixPerSecond, 20);
- painter0.drawText(rect0, Qt::AlignHCenter|Qt::AlignVCenter,m_HDivText[i]);
- }
- }
-}
-
-void FPlotter::MakeTimeStrs() //MakeTimeStrs
-{
- for(int i=0; i<=m_hdivs; i++) {
- m_HDivText[i].setNum(i);
- }
-}
-
-int FPlotter::XfromTime(float t) //XfromFreq()
-{
- return int(t*m_pixPerSecond);
-}
-
-float FPlotter::TimefromX(int x) //FreqfromX()
-{
- return float(x/m_pixPerSecond);
-}
-
-void FPlotter::setPlotZero(int plotZero) //setPlotZero()
-{
- m_plotZero=plotZero;
- m_bPaint2=true;
-}
-
-void FPlotter::setPlotGain(int plotGain) //setPlotGain()
-{
- m_plotGain=plotGain;
- m_bPaint2=true;
-}
-
-void FPlotter::setGreenZero(int n)
-{
- m_greenZero=n;
- m_bPaint2=true;
-}
-
-void FPlotter::setTRperiod(double p)
-{
- m_TRperiod=p;
- m_pixPerSecond=12000.0/512.0;
- if(m_TRperiod<30.0) m_pixPerSecond=12000.0/256.0;
- drawScale();
- update();
-}
-
-
-void FPlotter::draw() //draw()
-{
- QPainter painter1(&m_HorizPixmap);
- QPoint LineBuf[703];
- QPen penGreen(Qt::green,1);
-
- if(m_diskData) {
- int ih=m_UTCdisk/10000;
- int im=m_UTCdisk/100 % 100;
- int is=m_UTCdisk % 100;
- m_t = m_t.asprintf("%2.2d:%2.2d:%2.2d",ih,im,is);
- }
-
- int k0=m_jh0;
- if(fast_jh < m_jh0 or m_bPaint2) {
- k0=0;
- QRect tmp(0,0,m_w,119);
- painter1.fillRect(tmp,Qt::black);
- painter1.setPen(Qt::white);
- if(m_diskData) {
- int ih=m_UTCdisk/10000;
- int im=m_UTCdisk/100 % 100;
- int is=m_UTCdisk % 100;
- m_t = m_t.asprintf("%2.2d:%2.2d:%2.2d",ih,im,is);
- } else {
- m_t=QDateTime::currentDateTimeUtc().toString("hh:mm:ss");
- }
- if(fast_jh>0) painter1.drawText(10,95,m_t);
- }
-
- float gain = pow(10.0,(m_plotGain/20.0));
- for(int k=64*k0; k<64*fast_jh; k++) { //Upper spectrogram
- int i = k%64;
- int j = k/64;
- int y=0.005*gain*fast_s[k] + m_plotZero;
- if(y<0) y=0;
- if(y>254) y=254;
- painter1.setPen(g_ColorTbl[y]);
- painter1.drawPoint(j,64-i);
- }
-
- painter1.setPen(penGreen); // Upper green curve
- int j=0;
- m_greenGain=10;
- float greenGain = pow(10.0,(m_greenGain/20.0));
- for(int x=k0; x<=fast_jh; x++) {
- int y = 0.9*m_h - greenGain*fast_green[x] - m_greenZero + 40;
- if(y>119) y=119;
- LineBuf[j].setX(x);
-// LineBuf[j].setX(2*x);
- LineBuf[j].setY(y);
- j++;
- }
- painter1.drawPolyline(LineBuf,j);
-
- if((fast_jh < m_jh0) or m_bPaint2) {
- QRect tmp(0,120,m_w,219);
- painter1.fillRect(tmp,Qt::black);
- painter1.setPen(Qt::white);
- if(fast_jh>0 and m_jh0 < 9999) painter1.drawText(10,195,m_t0);
- m_t0=m_t;
-
- for(int k=0; k<64*fast_jh2; k++) { //Lower spectrogram
- int i = k%64;
- int j = k/64;
- int y=0.005*gain*fast_s2[k] + m_plotZero;
- if(y<0) y=0;
- if(y>254) y=254;
- painter1.setPen(g_ColorTbl[y]);
- painter1.drawPoint(j,164-i);
- }
-
- painter1.setPen(penGreen); //Lower green curve
- j=0;
- for(int x=0; x<=fast_jh2; x++) {
- int y = 0.9*m_h - greenGain*fast_green2[x] - m_greenZero + 140;
- if(y>219) y=219;
- LineBuf[j].setX(x);
- LineBuf[j].setY(y);
- j++;
- }
- painter1.drawPolyline(LineBuf,j);
- m_bPaint2=false;
- }
-
- painter1.setPen(Qt::white);
- painter1.drawLine(0,100, m_w,100);
- if(fast_jh>0) m_jh0=fast_jh;
- update(); //trigger a new paintEvent
-}
-
-void FPlotter::mouseMoveEvent(QMouseEvent *event)
-{
- QPainter painter(&m_HorizPixmap);
- int x=event->x();
-// int y=event->y();
- float t=x/m_pixPerSecond;
- QString t1;
- t1 = t1.asprintf("%5.2f",t);
- QRectF rect0(78,85,40,13); //### Should use font metrics ###
- painter.fillRect(rect0,Qt::black);
- painter.setPen(Qt::yellow);
- painter.drawText(80,95,t1);
- update();
-}
-
-void FPlotter::mousePressEvent(QMouseEvent *event) //mousePressEvent
-{
- if(m_mode=="MSK144") return;
- int x=event->x();
- int y=event->y();
- int n=event->button();
-// bool ctrl = (event->modifiers() & Qt::ControlModifier);
- QPainter painter(&m_HorizPixmap);
- int x0=x-n*m_pixPerSecond;
- int x1=x+n*m_pixPerSecond;
- int xmax=m_TRperiod*m_pixPerSecond;
- if(x0 < 0) x0=0;
- if(x1 > xmax) x1=xmax;
- if(x1 > 702) x1=702;
- Q_EMIT fastPick (x0,x1,y);
- int y0=64;
- if(y >= 120) y0+=100;
- if(m_x0+m_x1 != 0) {
- painter.setPen(Qt::black);
- painter.drawLine(m_x0,m_y0,m_x1,m_y0); //Erase previous yellow line
- painter.drawLine(m_x0,m_y0-3,m_x0,m_y0+3);
- painter.drawLine(m_x1,m_y0-3,m_x1,m_y0+3);
- }
- painter.setPen(Qt::yellow);
- painter.drawLine(x0,y0,x1,y0); //Draw yellow line
- painter.drawLine(x0,y0-3,x0,y0+3);
- painter.drawLine(x1,y0-3,x1,y0+3);
- update(); //trigger a new paintEvent
- m_x0=x0;
- m_x1=x1;
- m_y0=y0;
-}
-
-void FPlotter::setMode(QString mode) //setMode
-{
- m_mode=mode;
-}
+#include "fastplot.h" +#include "commons.h" +#include <math.h> +#include <QPainter> +#include <QPen> +#include <QMouseEvent> +#include <QDateTime> +#include <QDebug> +#include "moc_fastplot.cpp" + +#define MAX_SCREENSIZE 2048 + +FPlotter::FPlotter(QWidget *parent) : //FPlotter Constructor + QFrame {parent}, + m_w {703}, + m_plotGain {0}, + m_greenZero {0}, + m_x0 {0}, + m_x1 {0}, + m_ScalePixmap {QPixmap {703, 20}}, + m_pixPerSecond {12000.0/512.0}, + m_hdivs {30}, + m_h {220}, + m_h1 {20}, + m_h2 {m_h-m_h1}, + m_HorizPixmap {QPixmap {m_w, m_h2}}, + m_jh0 {9999}, + m_bPaint2 {true} +{ + m_diskData=false; + setFocusPolicy(Qt::StrongFocus); + setAttribute(Qt::WA_PaintOnScreen,false); + setAutoFillBackground(false); + setAttribute(Qt::WA_OpaquePaintEvent, false); + setAttribute(Qt::WA_NoSystemBackground, true); + + m_HorizPixmap.fill(Qt::black); + m_HorizPixmap.fill(Qt::black); + m_ScalePixmap.fill(Qt::white); + drawScale(); + draw(); + setMouseTracking(true); +} + +FPlotter::~FPlotter() { } // Destructor + +void FPlotter::paintEvent(QPaintEvent *) // paintEvent() +{ + QPainter painter(this); + painter.drawPixmap(0,0,m_ScalePixmap); + painter.drawPixmap(0,m_h1,m_HorizPixmap); +} + +void FPlotter::drawScale() //drawScale() +{ + if(m_ScalePixmap.isNull()) return; + int x; + + QRect rect0; + QPainter painter0(&m_ScalePixmap); + painter0.setBackground (palette ().brush (backgroundRole ())); + + //create Font to use for scales + QFont Font("Arial"); + Font.setPointSize(8); + QFontMetrics metrics(Font); + Font.setWeight(QFont::Normal); + painter0.setFont(Font); + painter0.setPen(Qt::white); + m_ScalePixmap.fill(Qt::black); + painter0.drawRect(0, 0,m_w,19); + painter0.drawLine(0,19,m_w,19); + +//Draw ticks at 1-second intervals + for( int i=0; i<=m_hdivs; i++) { + x = (int)( (float)i*m_pixPerSecond ); + painter0.drawLine(x,15,x,19); + } + +//Write numbers on the time scale + MakeTimeStrs(); + for( int i=0; i<=m_hdivs; i++) { + if(0==i) { + //left justify the leftmost text + x = (int)( (float)i*m_pixPerSecond); + rect0.setRect(x,0, (int)m_pixPerSecond, 20); + painter0.drawText(rect0, Qt::AlignLeft|Qt::AlignVCenter,m_HDivText[i]); + } + else if(m_hdivs == i) { + //right justify the rightmost text + x = (int)( (float)i*m_pixPerSecond - m_pixPerSecond); + rect0.setRect(x,0, (int)m_pixPerSecond, 20); + painter0.drawText(rect0, Qt::AlignRight|Qt::AlignVCenter,m_HDivText[i]); + } else { + //center justify the rest of the text + x = (int)( (float)i*m_pixPerSecond - m_pixPerSecond/2); + rect0.setRect(x,0, (int)m_pixPerSecond, 20); + painter0.drawText(rect0, Qt::AlignHCenter|Qt::AlignVCenter,m_HDivText[i]); + } + } +} + +void FPlotter::MakeTimeStrs() //MakeTimeStrs +{ + for(int i=0; i<=m_hdivs; i++) { + m_HDivText[i].setNum(i); + } +} + +int FPlotter::XfromTime(float t) //XfromFreq() +{ + return int(t*m_pixPerSecond); +} + +float FPlotter::TimefromX(int x) //FreqfromX() +{ + return float(x/m_pixPerSecond); +} + +void FPlotter::setPlotZero(int plotZero) //setPlotZero() +{ + m_plotZero=plotZero; + m_bPaint2=true; +} + +void FPlotter::setPlotGain(int plotGain) //setPlotGain() +{ + m_plotGain=plotGain; + m_bPaint2=true; +} + +void FPlotter::setGreenZero(int n) +{ + m_greenZero=n; + m_bPaint2=true; +} + +void FPlotter::setTRperiod(double p) +{ + m_TRperiod=p; + m_pixPerSecond=12000.0/512.0; + if(m_TRperiod<30.0) m_pixPerSecond=12000.0/256.0; + drawScale(); + update(); +} + + +void FPlotter::draw() //draw() +{ + QPainter painter1(&m_HorizPixmap); + QPoint LineBuf[703]; + QPen penGreen(Qt::green,1); + + if(m_diskData) { + int ih=m_UTCdisk/10000; + int im=m_UTCdisk/100 % 100; + int is=m_UTCdisk % 100; + m_t = m_t.asprintf("%2.2d:%2.2d:%2.2d",ih,im,is); + } + + int k0=m_jh0; + if(fast_jh < m_jh0 or m_bPaint2) { + k0=0; + QRect tmp(0,0,m_w,119); + painter1.fillRect(tmp,Qt::black); + painter1.setPen(Qt::white); + if(m_diskData) { + int ih=m_UTCdisk/10000; + int im=m_UTCdisk/100 % 100; + int is=m_UTCdisk % 100; + m_t = m_t.asprintf("%2.2d:%2.2d:%2.2d",ih,im,is); + } else { + m_t=QDateTime::currentDateTimeUtc().toString("hh:mm:ss"); + } + if(fast_jh>0) painter1.drawText(10,95,m_t); + } + + float gain = pow(10.0,(m_plotGain/20.0)); + for(int k=64*k0; k<64*fast_jh; k++) { //Upper spectrogram + int i = k%64; + int j = k/64; + int y=0.005*gain*fast_s[k] + m_plotZero; + if(y<0) y=0; + if(y>254) y=254; + painter1.setPen(g_ColorTbl[y]); + painter1.drawPoint(j,64-i); + } + + painter1.setPen(penGreen); // Upper green curve + int j=0; + m_greenGain=10; + float greenGain = pow(10.0,(m_greenGain/20.0)); + for(int x=k0; x<=fast_jh; x++) { + int y = 0.9*m_h - greenGain*fast_green[x] - m_greenZero + 40; + if(y>119) y=119; + LineBuf[j].setX(x); +// LineBuf[j].setX(2*x); + LineBuf[j].setY(y); + j++; + } + painter1.drawPolyline(LineBuf,j); + + if((fast_jh < m_jh0) or m_bPaint2) { + QRect tmp(0,120,m_w,219); + painter1.fillRect(tmp,Qt::black); + painter1.setPen(Qt::white); + if(fast_jh>0 and m_jh0 < 9999) painter1.drawText(10,195,m_t0); + m_t0=m_t; + + for(int k=0; k<64*fast_jh2; k++) { //Lower spectrogram + int i = k%64; + int j = k/64; + int y=0.005*gain*fast_s2[k] + m_plotZero; + if(y<0) y=0; + if(y>254) y=254; + painter1.setPen(g_ColorTbl[y]); + painter1.drawPoint(j,164-i); + } + + painter1.setPen(penGreen); //Lower green curve + j=0; + for(int x=0; x<=fast_jh2; x++) { + int y = 0.9*m_h - greenGain*fast_green2[x] - m_greenZero + 140; + if(y>219) y=219; + LineBuf[j].setX(x); + LineBuf[j].setY(y); + j++; + } + painter1.drawPolyline(LineBuf,j); + m_bPaint2=false; + } + + painter1.setPen(Qt::white); + painter1.drawLine(0,100, m_w,100); + if(fast_jh>0) m_jh0=fast_jh; + update(); //trigger a new paintEvent +} + +void FPlotter::mouseMoveEvent(QMouseEvent *event) +{ + QPainter painter(&m_HorizPixmap); + int x=event->x(); +// int y=event->y(); + float t=x/m_pixPerSecond; + QString t1; + t1 = t1.asprintf("%5.2f",t); + QRectF rect0(78,85,40,13); //### Should use font metrics ### + painter.fillRect(rect0,Qt::black); + painter.setPen(Qt::yellow); + painter.drawText(80,95,t1); + update(); +} + +void FPlotter::mousePressEvent(QMouseEvent *event) //mousePressEvent +{ + if(m_mode=="MSK144") return; + int x=event->x(); + int y=event->y(); + int n=event->button(); +// bool ctrl = (event->modifiers() & Qt::ControlModifier); + QPainter painter(&m_HorizPixmap); + int x0=x-n*m_pixPerSecond; + int x1=x+n*m_pixPerSecond; + int xmax=m_TRperiod*m_pixPerSecond; + if(x0 < 0) x0=0; + if(x1 > xmax) x1=xmax; + if(x1 > 702) x1=702; + Q_EMIT fastPick (x0,x1,y); + int y0=64; + if(y >= 120) y0+=100; + if(m_x0+m_x1 != 0) { + painter.setPen(Qt::black); + painter.drawLine(m_x0,m_y0,m_x1,m_y0); //Erase previous yellow line + painter.drawLine(m_x0,m_y0-3,m_x0,m_y0+3); + painter.drawLine(m_x1,m_y0-3,m_x1,m_y0+3); + } + painter.setPen(Qt::yellow); + painter.drawLine(x0,y0,x1,y0); //Draw yellow line + painter.drawLine(x0,y0-3,x0,y0+3); + painter.drawLine(x1,y0-3,x1,y0+3); + update(); //trigger a new paintEvent + m_x0=x0; + m_x1=x1; + m_y0=y0; +} + +void FPlotter::setMode(QString mode) //setMode +{ + m_mode=mode; +} diff --git a/widgets/fastplot.h b/widgets/fastplot.h index db59a72b..f24fcc24 100755..100644 --- a/widgets/fastplot.h +++ b/widgets/fastplot.h @@ -1,91 +1,91 @@ -///////////////////////////////////////////////////////////////////////////
-// Some code in this file and accompanying files is based on work by
-// Moe Wheatley, AE4Y, released under the "Simplified BSD License".
-// For more details see the accompanying file LICENSE_WHEATLEY.TXT
-///////////////////////////////////////////////////////////////////////////
-
-#ifndef FPLOTTER_H_
-#define FPLOTTER_H_
-
-#include <QFrame>
-#include <QString>
-#include <QPixmap>
-#include <QVector>
-#include <QColor>
-
-class QMouseEvent;
-
-class FPlotter : public QFrame
-{
- Q_OBJECT
-public:
- explicit FPlotter(QWidget *parent = 0);
- ~FPlotter();
-
- qint32 m_w;
- qint32 m_plotZero;
- qint32 m_plotGain;
- qint32 m_greenGain;
- qint32 m_greenZero;
- qint32 m_x0;
- qint32 m_x1;
- qint32 m_y0;
- qint32 m_UTCdisk;
- bool m_diskData;
-
- void draw(); //Update the Fast plot
- void setPlotZero(int plotZero);
- void setPlotGain(int plotGain);
- void setGreenZero(int n);
- void setTRperiod(double p);
- void drawScale();
- void setMode(QString mode);
-
-signals:
- void fastPick (int x0, int x1, int y);
-
-protected:
- //re-implemented widget event handlers
- void paintEvent(QPaintEvent *event);
-// void resizeEvent(QResizeEvent* event);
-
-private slots:
- void mousePressEvent(QMouseEvent *event);
- void mouseMoveEvent(QMouseEvent *event);
-
-private:
-
- void MakeTimeStrs();
- int XfromTime(float t);
- float TimefromX(int x);
- qint64 RoundFreq(qint64 freq, int resolution);
-
- QPixmap m_ScalePixmap;
- QString m_HDivText[483];
- QString m_t;
- QString m_t0;
- QString m_t1;
- QString m_mode;
-
- double m_pixPerSecond;
- double m_TRperiod;
-
- qint32 m_hdivs;
- qint32 m_h;
- qint32 m_h1;
- qint32 m_h2;
- QPixmap m_HorizPixmap;
- qint32 m_jh0;
-
- bool m_bPaint2;
-};
-
-extern float fast_green[703];
-extern float fast_green2[703];
-extern float fast_s[44992]; //44992=64*703
-extern float fast_s2[44992];
-extern int fast_jh;
-extern int fast_jh2;
-extern QVector<QColor> g_ColorTbl;
-
-#endif // FPLOTTER_H
+/////////////////////////////////////////////////////////////////////////// +// Some code in this file and accompanying files is based on work by +// Moe Wheatley, AE4Y, released under the "Simplified BSD License". +// For more details see the accompanying file LICENSE_WHEATLEY.TXT +/////////////////////////////////////////////////////////////////////////// + +#ifndef FPLOTTER_H_ +#define FPLOTTER_H_ + +#include <QFrame> +#include <QString> +#include <QPixmap> +#include <QVector> +#include <QColor> + +class QMouseEvent; + +class FPlotter : public QFrame +{ + Q_OBJECT +public: + explicit FPlotter(QWidget *parent = 0); + ~FPlotter(); + + qint32 m_w; + qint32 m_plotZero; + qint32 m_plotGain; + qint32 m_greenGain; + qint32 m_greenZero; + qint32 m_x0; + qint32 m_x1; + qint32 m_y0; + qint32 m_UTCdisk; + bool m_diskData; + + void draw(); //Update the Fast plot + void setPlotZero(int plotZero); + void setPlotGain(int plotGain); + void setGreenZero(int n); + void setTRperiod(double p); + void drawScale(); + void setMode(QString mode); + +signals: + void fastPick (int x0, int x1, int y); + +protected: + //re-implemented widget event handlers + void paintEvent(QPaintEvent *event); +// void resizeEvent(QResizeEvent* event); + +private slots: + void mousePressEvent(QMouseEvent *event); + void mouseMoveEvent(QMouseEvent *event); + +private: + + void MakeTimeStrs(); + int XfromTime(float t); + float TimefromX(int x); + qint64 RoundFreq(qint64 freq, int resolution); + + QPixmap m_ScalePixmap; + QString m_HDivText[483]; + QString m_t; + QString m_t0; + QString m_t1; + QString m_mode; + + double m_pixPerSecond; + double m_TRperiod; + + qint32 m_hdivs; + qint32 m_h; + qint32 m_h1; + qint32 m_h2; + QPixmap m_HorizPixmap; + qint32 m_jh0; + + bool m_bPaint2; +}; + +extern float fast_green[703]; +extern float fast_green2[703]; +extern float fast_s[44992]; //44992=64*703 +extern float fast_s2[44992]; +extern int fast_jh; +extern int fast_jh2; +extern QVector<QColor> g_ColorTbl; + +#endif // FPLOTTER_H diff --git a/widgets/itoneAndicw.h b/widgets/itoneAndicw.h index 38f4d196..150c7d99 100755..100644 --- a/widgets/itoneAndicw.h +++ b/widgets/itoneAndicw.h @@ -1,23 +1,23 @@ -// -*- Mode: C++ -*-
-#ifndef ITONEANDICW_H
-#define ITONEANDICW_H
-
-#define MAX_NUM_SYMBOLS 250
-#define NUM_CW_SYMBOLS 250
-
-extern int volatile itone[MAX_NUM_SYMBOLS]; //Audio tones for all Tx symbols
-extern int volatile icw[NUM_CW_SYMBOLS]; //Dits for CW ID
-
-//--------------------------------------------------------------- MainWindow
-namespace Ui {
- class MainWindow2;
-}
-
-
-class MainWindow2
- : public QObject
-{
- Q_OBJECT;
-
-};
-#endif // MAINWINDOW_H2
+// -*- Mode: C++ -*- +#ifndef ITONEANDICW_H +#define ITONEANDICW_H + +#define MAX_NUM_SYMBOLS 250 +#define NUM_CW_SYMBOLS 250 + +extern int volatile itone[MAX_NUM_SYMBOLS]; //Audio tones for all Tx symbols +extern int volatile icw[NUM_CW_SYMBOLS]; //Dits for CW ID + +//--------------------------------------------------------------- MainWindow +namespace Ui { + class MainWindow2; +} + + +class MainWindow2 + : public QObject +{ + Q_OBJECT; + +}; +#endif // MAINWINDOW_H2 diff --git a/widgets/logqso.cpp b/widgets/logqso.cpp index 05a7cd89..35f04b13 100755..100644 --- a/widgets/logqso.cpp +++ b/widgets/logqso.cpp @@ -1,591 +1,595 @@ -#include "logqso.h"
-
-#include <QLocale>
-#include <QString>
-#include <QSettings>
-#include <QStandardPaths>
-#include <QStringList>
-#include <QDir>
-#include <QTimer>
-#include <QPushButton>
-
-#include "HelpTextWindow.hpp"
-#include "logbook/logbook.h"
-#include "MessageBox.hpp"
-#include "Configuration.hpp"
-#include "models/Bands.hpp"
-#include "models/CabrilloLog.hpp"
-#include "validators/MaidenheadLocatorValidator.hpp"
-
-#include "ui_logqso.h"
-#include "moc_logqso.cpp"
-
-namespace
-{
- auto const sat_file_name = "sat.dat";
- struct PropMode
- {
- char const * id_;
- char const * name_;
- };
- constexpr PropMode prop_modes[] =
- {
- {"", ""}
- , {"AS", QT_TRANSLATE_NOOP ("LogQSO", "Aircraft scatter")}
- , {"AUE", QT_TRANSLATE_NOOP ("LogQSO", "Aurora-E")}
- , {"AUR", QT_TRANSLATE_NOOP ("LogQSO", "Aurora")}
- , {"BS", QT_TRANSLATE_NOOP ("LogQSO", "Back scatter")}
- , {"ECH", QT_TRANSLATE_NOOP ("LogQSO", "Echolink")}
- , {"EME", QT_TRANSLATE_NOOP ("LogQSO", "Earth-moon-earth")}
- , {"ES", QT_TRANSLATE_NOOP ("LogQSO", "Sporadic E")}
- , {"F2", QT_TRANSLATE_NOOP ("LogQSO", "F2 Reflection")}
- , {"FAI", QT_TRANSLATE_NOOP ("LogQSO", "Field aligned irregularities")}
- , {"INTERNET", QT_TRANSLATE_NOOP ("LogQSO", "Internet-assisted")}
- , {"ION", QT_TRANSLATE_NOOP ("LogQSO", "Ionoscatter")}
- , {"IRL", QT_TRANSLATE_NOOP ("LogQSO", "IRLP")}
- , {"MS", QT_TRANSLATE_NOOP ("LogQSO", "Meteor scatter")}
- , {"RPT", QT_TRANSLATE_NOOP ("LogQSO", "Non-satellite repeater or transponder")}
- , {"RS", QT_TRANSLATE_NOOP ("LogQSO", "Rain scatter")}
- , {"SAT", QT_TRANSLATE_NOOP ("LogQSO", "Satellite")}
- , {"TEP", QT_TRANSLATE_NOOP ("LogQSO", "Trans-equatorial")}
- , {"TR", QT_TRANSLATE_NOOP ("LogQSO", "Tropospheric ducting")}
- };
- struct SatMode
- {
- char const * id_;
- char const * name_;
- };
- constexpr SatMode sat_modes[] =
- {
- {"", ""}
- , {"A", QT_TRANSLATE_NOOP ("LogQSO", "A")}
- , {"B", QT_TRANSLATE_NOOP ("LogQSO", "B")}
- , {"BS", QT_TRANSLATE_NOOP ("LogQSO", "BS")}
- , {"JA", QT_TRANSLATE_NOOP ("LogQSO", "JA")}
- , {"JD", QT_TRANSLATE_NOOP ("LogQSO", "JD")}
- , {"K", QT_TRANSLATE_NOOP ("LogQSO", "K")}
- , {"KA", QT_TRANSLATE_NOOP ("LogQSO", "KA")}
- , {"KT", QT_TRANSLATE_NOOP ("LogQSO", "KT")}
- , {"L", QT_TRANSLATE_NOOP ("LogQSO", "L")}
- , {"LS", QT_TRANSLATE_NOOP ("LogQSO", "LS")}
- , {"LU", QT_TRANSLATE_NOOP ("LogQSO", "LU")}
- , {"LX", QT_TRANSLATE_NOOP ("LogQSO", "LX")}
- , {"S", QT_TRANSLATE_NOOP ("LogQSO", "S")}
- , {"SX", QT_TRANSLATE_NOOP ("LogQSO", "SX")}
- , {"T", QT_TRANSLATE_NOOP ("LogQSO", "T")}
- , {"US", QT_TRANSLATE_NOOP ("LogQSO", "US")}
- , {"UV", QT_TRANSLATE_NOOP ("LogQSO", "UV")}
- , {"VS", QT_TRANSLATE_NOOP ("LogQSO", "VS")}
- , {"VU", QT_TRANSLATE_NOOP ("LogQSO", "VU")}
- };
-}
-
-LogQSO::LogQSO(QString const& programTitle, QSettings * settings
- , Configuration const * config, LogBook * log, QWidget *parent)
- : QDialog {parent, Qt::WindowStaysOnTopHint | Qt::WindowTitleHint | Qt::WindowSystemMenuHint}
- , ui(new Ui::LogQSO)
- , m_settings (settings)
- , m_config {config}
- , m_log {log}
-{
- ui->setupUi(this);
- setWindowTitle(programTitle + " - Log QSO");
- ui->comboBoxSatellite->addItem ("", "");
- QString sat_file_location;
- QDir dataPath {QStandardPaths::writableLocation (QStandardPaths::DataLocation)};
- sat_file_location = dataPath.exists(sat_file_name) ? dataPath.absoluteFilePath(sat_file_name) : m_config->data_dir ().absoluteFilePath (sat_file_name);
- QFile file {sat_file_location};
- QStringList wordList;
- QTextStream stream(&file);
- if(file.open (QIODevice::ReadOnly | QIODevice::Text)) {
- while (!stream.atEnd()) {
- QString line = stream.readLine();
- wordList = line.split('|');
- ui->comboBoxSatellite->addItem (wordList[1], wordList[0]);
- }
- stream.flush();
- file.close();
- }
- for (auto const& prop_mode : prop_modes)
- {
- ui->comboBoxPropMode->addItem (prop_mode.name_, prop_mode.id_);
- }
- for (auto const& sat_mode : sat_modes)
- {
- ui->comboBoxSatMode->addItem (sat_mode.name_, sat_mode.id_);
- }
- loadSettings ();
- connect (ui->comboBoxPropMode, &QComboBox::currentTextChanged, this, &LogQSO::propModeChanged);
- connect (ui->comments, &QComboBox::currentTextChanged, this, &LogQSO::commentsChanged);
- connect (ui->addButton, &QPushButton::clicked, this, &LogQSO::on_addButton_clicked);
- auto date_time_format = QLocale {}.dateFormat (QLocale::ShortFormat) + " hh:mm:ss";
- ui->start_date_time->setDisplayFormat (date_time_format);
- ui->end_date_time->setDisplayFormat (date_time_format);
- ui->grid->setValidator (new MaidenheadLocatorValidator {this});
-}
-
-LogQSO::~LogQSO ()
-{
-}
-
-void LogQSO::loadSettings ()
-{
- m_settings->beginGroup ("LogQSO");
- restoreGeometry (m_settings->value ("geometry", saveGeometry ()).toByteArray ());
- ui->cbTxPower->setChecked (m_settings->value ("SaveTxPower", false).toBool ());
- ui->cbComments->setChecked (m_settings->value ("SaveComments", false).toBool ());
- ui->cbPropMode->setChecked (m_settings->value ("SavePropMode", false).toBool ());
- ui->cbSatellite->setChecked (m_settings->value ("SaveSatellite", false).toBool ());
- ui->cbSatMode->setChecked (m_settings->value ("SaveSatMode", false).toBool ());
- m_comments = m_settings->value ("LogComments", "").toString();
- m_txPower = m_settings->value ("TxPower", "").toString ();
-
- int prop_index {0};
- if (ui->cbPropMode->isChecked ())
- {
- prop_index = ui->comboBoxPropMode->findData (m_settings->value ("PropMode", "").toString());
- }
- ui->comboBoxPropMode->setCurrentIndex (prop_index);
- int sat_mode_index {0};
- if (ui->cbSatMode->isChecked ())
- {
- sat_mode_index = ui->comboBoxSatMode->findData (m_settings->value ("SatMode", "").toString());
- }
- ui->comboBoxSatMode->setCurrentIndex (sat_mode_index);
- int satellite {0};
- if (ui->cbSatellite->isChecked ())
- {
- satellite = ui->comboBoxSatellite->findData (m_settings->value ("Satellite", "").toString());
- }
- ui->comboBoxSatellite->setCurrentIndex (satellite);
- if (m_settings->value ("PropMode", "") != "SAT")
- {
- ui->cbSatellite->setDisabled(true);
- ui->comboBoxSatellite->setDisabled(true);
- ui->cbSatMode->setDisabled(true);
- ui->comboBoxSatMode->setDisabled(true);
- }
- m_freqRx = m_settings->value ("FreqRx", "").toString ();
- ui->cbFreqRx->setChecked (m_settings->value ("SaveFreqRx", false).toBool ());
-
- QString comments_location; // load the content of comments.txt file to the comments combo box
- QDir dataPath {QStandardPaths::writableLocation (QStandardPaths::DataLocation)};
- comments_location = dataPath.exists("comments.txt") ? dataPath.absoluteFilePath("comments.txt") : m_config->data_dir ().absoluteFilePath ("comments.txt");
- QFile file2 = {comments_location};
- QTextStream stream2(&file2);
- if(file2.open (QIODevice::ReadOnly | QIODevice::Text)) {
- while (!stream2.atEnd()) {
- QString line = stream2.readLine();
- ui->comments->addItem (line);
- }
- stream2.flush();
- file2.close();
- } else {
- ui->comments->addItem ("");
- }
- if (ui->cbComments->isChecked ()) ui->comments->setItemText(ui->comments->currentIndex(), m_comments);
-
- m_settings->endGroup ();
-}
-
-void LogQSO::storeSettings () const
-{
- m_settings->beginGroup ("LogQSO");
- m_settings->setValue ("geometry", saveGeometry ());
- m_settings->setValue ("SaveTxPower", ui->cbTxPower->isChecked ());
- m_settings->setValue ("SaveComments", ui->cbComments->isChecked ());
- m_settings->setValue ("SavePropMode", ui->cbPropMode->isChecked ());
- m_settings->setValue ("SaveSatellite", ui->cbSatellite->isChecked ());
- m_settings->setValue ("SaveSatMode", ui->cbSatMode->isChecked ());
- m_settings->setValue ("SaveFreqRx", ui->cbFreqRx->isChecked ());
- m_settings->setValue ("TxPower", m_txPower);
- m_settings->setValue ("LogComments", m_comments);
- m_settings->setValue ("PropMode", ui->comboBoxPropMode->currentData ());
- m_settings->setValue ("Satellite", ui->comboBoxSatellite->currentData ());
- m_settings->setValue ("SatMode", ui->comboBoxSatMode->currentData ());
- m_settings->setValue ("FreqRx", m_freqRx);
- m_settings->endGroup ();
-}
-
-void LogQSO::initLogQSO(QString const& hisCall, QString const& hisGrid, QString mode,
- QString const& rptSent, QString const& rptRcvd,
- QDateTime const& dateTimeOn, QDateTime const& dateTimeOff,
- Radio::Frequency dialFreq, bool noSuffix, QString xSent, QString xRcvd)
-{
- if(!isHidden()) return;
-
- QPushButton* okBtn = ui->buttonBox->button(QDialogButtonBox::Ok);
- okBtn->setAutoDefault(true);
- okBtn->setDefault(true);
- okBtn->setFocus();
- QPushButton* caBtn = ui->buttonBox->button(QDialogButtonBox::Cancel);
- caBtn->setAutoDefault(false);
- caBtn->setDefault(false);
-
- ui->call->setText (hisCall);
- if (m_config->log4digitGrids()) {
- ui->grid->setText (hisGrid.left(4));
- } else {
- ui->grid->setText (hisGrid);
- }
- if (hisGrid == "" && m_config->ZZ00()) ui->grid->setText("ZZ00");
- ui->name->clear ();
- if (ui->cbTxPower->isChecked ())
- {
- ui->txPower->setText (m_txPower);
- }
- else
- {
- ui->txPower->clear ();
- }
- if (ui->cbFreqRx->isChecked ())
- {
- ui->freqRx->setText (m_freqRx);
- }
- else
- {
- ui->freqRx->clear ();
- }
- if (ui->cbComments->isChecked ())
- {
- ui->comments->setItemText(ui->comments->currentIndex(), m_comments);
- }
- else
- {
- ui->comments->setCurrentIndex(0);
- ui->comments->setItemText(ui->comments->currentIndex(), "");
- }
- if (m_config->report_in_comments()) {
- auto t=mode;
- if(rptSent!="") t+=" Sent: " + rptSent;
- if(rptRcvd!="") t+=" Rcvd: " + rptRcvd;
- ui->comments->setCurrentIndex(0);
- ui->comments->setItemText(ui->comments->currentIndex(), t);
- }
- if(noSuffix and mode.mid(0,3)=="JT9") mode="JT9";
- if(m_config->log_as_RTTY() and mode.mid(0,3)=="JT9") mode="RTTY";
- ui->mode->setText(mode);
- ui->sent->setText(rptSent);
- ui->rcvd->setText(rptRcvd);
- ui->start_date_time->setDateTime (dateTimeOn);
- ui->end_date_time->setDateTime (dateTimeOff);
- m_dialFreq=dialFreq;
- m_myCall=m_config->my_callsign();
- m_myGrid=m_config->my_grid();
- ui->band->setText (m_config->bands ()->find (dialFreq));
- ui->loggedOperator->setText(m_config->opCall());
- ui->exchSent->setText (xSent);
- ui->exchRcvd->setText (xRcvd);
- if (!ui->cbPropMode->isChecked ())
- {
- ui->comboBoxPropMode->setCurrentIndex (-1);
- }
- if (!ui->cbSatellite->isChecked ())
- {
- ui->comboBoxSatellite->setCurrentIndex (-1);
- ui->comboBoxSatMode->setCurrentIndex (-1);
- }
-
- using SpOp = Configuration::SpecialOperatingActivity;
- auto special_op = m_config->special_op_id ();
-
- // put contest name in comments
- if (SpOp::NONE != special_op && SpOp::HOUND != special_op && SpOp::FOX != special_op
- && m_config->Individual_Contest_Name() && !m_config->report_in_comments()
- && m_config->Contest_Name() !="" && !ui->cbComments->isChecked() && m_config->specOp_in_comments()) {
- QString Contest_Name = (m_config->Contest_Name() + " Contest");
- ui->comments->setCurrentIndex(0);
- ui->comments->setItemText(ui->comments->currentIndex(), Contest_Name);
- }
- if (SpOp::NA_VHF == special_op && !m_config->Individual_Contest_Name() && !m_config->report_in_comments()
- && !ui->cbComments->isChecked() && m_config->specOp_in_comments()) {
- QString Contest_Name = ("NA VHF Contest");
- ui->comments->setCurrentIndex(0);
- ui->comments->setItemText(ui->comments->currentIndex(), Contest_Name);
- }
- if (SpOp::EU_VHF == special_op && !m_config->Individual_Contest_Name() && !m_config->report_in_comments()
- && !ui->cbComments->isChecked() && m_config->specOp_in_comments()) {
- QString Contest_Name = ("EU VHF Contest");
- ui->comments->setCurrentIndex(0);
- ui->comments->setItemText(ui->comments->currentIndex(), Contest_Name);
- }
- if (SpOp::WW_DIGI == special_op && !m_config->Individual_Contest_Name() && !m_config->report_in_comments()
- && !ui->cbComments->isChecked() && m_config->specOp_in_comments()) {
- QString Contest_Name = ("WW Digi Contest");
- ui->comments->setCurrentIndex(0);
- ui->comments->setItemText(ui->comments->currentIndex(), Contest_Name);
- }
- if (SpOp::FIELD_DAY == special_op && !m_config->Individual_Contest_Name() && !m_config->report_in_comments()
- && !ui->cbComments->isChecked() && m_config->specOp_in_comments()) {
- QString Contest_Name = ("ARRL Field Day");
- ui->comments->setCurrentIndex(0);
- ui->comments->setItemText(ui->comments->currentIndex(), Contest_Name);
- }
- if (SpOp::RTTY == special_op && !m_config->Individual_Contest_Name() && !m_config->report_in_comments()
- && !ui->cbComments->isChecked() && m_config->specOp_in_comments()) {
- QString Contest_Name = ("FT Roundup messages");
- ui->comments->setCurrentIndex(0);
- ui->comments->setItemText(ui->comments->currentIndex(), Contest_Name);
- }
- if (SpOp::ARRL_DIGI == special_op && !m_config->Individual_Contest_Name() && !m_config->report_in_comments()
- && !ui->cbComments->isChecked() && m_config->specOp_in_comments()) {
- QString Contest_Name = ("ARRL Digi Contest");
- ui->comments->setCurrentIndex(0);
- ui->comments->setItemText(ui->comments->currentIndex(), Contest_Name);
- }
- if (SpOp::HOUND == special_op && !m_config->report_in_comments()
- && !ui->cbComments->isChecked() && m_config->specOp_in_comments()) {
- QString Contest_Name = ("F/H mode");
- if (m_config->superFox()) Contest_Name = ("SF/H mode");
- ui->comments->setCurrentIndex(0);
- ui->comments->setItemText(ui->comments->currentIndex(), Contest_Name);
- }
- if (SpOp::NONE == special_op && !m_config->report_in_comments()
- && !ui->cbComments->isChecked() && m_config->specOp_in_comments()) {
- m_comments = "";
- }
-
- if (SpOp::FOX == special_op
- || (m_config->autoLog () && ((SpOp::NONE < special_op && special_op < SpOp::FOX)
- || SpOp::ARRL_DIGI == special_op || !m_config->contestingOnly ())))
- {
- // allow auto logging in Fox mode and contests
- accept();
- }
- else
- {
- show();
- }
-}
-
-void LogQSO::accept()
-{
- auto hisCall = ui->call->text ();
- auto hisGrid = ui->grid->text ();
- auto mode = ui->mode->text ();
- auto rptSent = ui->sent->text ();
- auto rptRcvd = ui->rcvd->text ();
- auto dateTimeOn = ui->start_date_time->dateTime ();
- auto dateTimeOff = ui->end_date_time->dateTime ();
- auto band = ui->band->text ();
- auto name = ui->name->text ();
- m_txPower = ui->txPower->text ();
- auto strDialFreq = QString::number (m_dialFreq / 1.e6,'f',6);
- auto operator_call = ui->loggedOperator->text ();
- auto xsent = ui->exchSent->text ();
- auto xrcvd = ui->exchRcvd->text ();
-
- using SpOp = Configuration::SpecialOperatingActivity;
- auto special_op = m_config->special_op_id ();
-
- if (special_op == SpOp::NA_VHF or special_op == SpOp::WW_DIGI) {
- if(xrcvd!="" and hisGrid!=xrcvd) hisGrid=xrcvd;
- }
-
- if ((special_op == SpOp::RTTY and xsent!="" and xrcvd!="")) {
- if(rptSent=="" or !xsent.contains(rptSent+" ")) rptSent=xsent.split(" "
-#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
- , QString::SkipEmptyParts
-#else
- , Qt::SkipEmptyParts
-#endif
- ).at(0);
- if(rptRcvd=="" or !xrcvd.contains(rptRcvd+" ")) rptRcvd=xrcvd.split(" "
-#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
- , QString::SkipEmptyParts
-#else
- , Qt::SkipEmptyParts
-#endif
- ).at(0);
- }
-
- // validate
- if ((SpOp::NONE < special_op && special_op < SpOp::FOX) || (special_op > SpOp::HOUND))
- {
- if (xsent.isEmpty () || xrcvd.isEmpty ())
- {
- show ();
- MessageBox::warning_message (this, tr ("Invalid QSO Data"),
- tr ("Check exchange sent and received"));
- return; // without accepting
- }
-
- if (!m_log->contest_log ()->add_QSO (m_dialFreq, mode, dateTimeOff, hisCall, xsent, xrcvd))
- {
- show ();
- MessageBox::warning_message (this, tr ("Invalid QSO Data"),
- tr ("Check all fields"));
- return; // without accepting
- }
- }
-
- auto const& prop_mode = ui->comboBoxPropMode->currentData ().toString ();
- auto satellite = ui->comboBoxSatellite->currentData ().toString ();
- auto sat_mode = ui->comboBoxSatMode->currentData ().toString ();
- // Add sat name and sat mode tags only if "Satellite" is selected as prop mode
- if (prop_mode != "SAT") {
- satellite = "";
- sat_mode = "";
- }
- m_freqRx = ui->freqRx->text ();
- //Log this QSO to file "wsjtx.log"
- static QFile f {QDir {QStandardPaths::writableLocation (QStandardPaths::DataLocation)}.absoluteFilePath ("wsjtx.log")};
- if(!f.open(QIODevice::Text | QIODevice::Append)) {
- MessageBox::warning_message (this, tr ("Log file error"),
- tr ("Cannot open \"%1\" for append").arg (f.fileName ()),
- tr ("Error: %1").arg (f.errorString ()));
- } else {
- QString logEntry=dateTimeOn.date().toString("yyyy-MM-dd,") +
- dateTimeOn.time().toString("hh:mm:ss,") +
- dateTimeOff.date().toString("yyyy-MM-dd,") +
- dateTimeOff.time().toString("hh:mm:ss,") + hisCall + "," +
- hisGrid + "," + strDialFreq + "," + mode +
- "," + rptSent + "," + rptRcvd + "," + m_txPower +
- "," + m_comments + "," + name + "," + prop_mode +
- "," + satellite + "," + sat_mode + "," + m_freqRx;
- QTextStream out(&f);
- out << logEntry <<
-#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
- endl
-#else
- Qt::endl
-#endif
- ;
- f.close();
- }
-
- //Clean up and finish logging
- Q_EMIT acceptQSO (dateTimeOff
- , hisCall
- , hisGrid
- , m_dialFreq
- , mode
- , rptSent
- , rptRcvd
- , m_txPower
- , m_comments
- , name
- , dateTimeOn
- , operator_call
- , m_myCall
- , m_myGrid
- , xsent
- , xrcvd
- , prop_mode
- , satellite
- , sat_mode
- , m_freqRx
- , m_log->QSOToADIF (hisCall
- , hisGrid
- , mode
- , rptSent
- , rptRcvd
- , dateTimeOn
- , dateTimeOff
- , band
- , m_comments
- , name
- , strDialFreq
- , m_myCall
- , m_myGrid
- , m_txPower
- , operator_call
- , xsent
- , xrcvd
- , prop_mode
- , satellite
- , sat_mode
- , m_freqRx));
- QDialog::accept();
-}
-
-void LogQSO::propModeChanged()
-{
- if (ui->comboBoxPropMode->currentData() != "SAT") {
- ui->comboBoxSatellite->setCurrentIndex(0);
- ui->comboBoxSatellite->setDisabled(true);
- ui->cbSatellite->setDisabled(true);
- ui->comboBoxSatMode->setCurrentIndex(0);
- ui->comboBoxSatMode->setDisabled(true);
- ui->cbSatMode->setDisabled(true);
- } else {
- ui->comboBoxSatellite->setDisabled(false);
- ui->cbSatellite->setDisabled(false);
- ui->comboBoxSatMode->setDisabled(false);
- ui->cbSatMode->setDisabled(false);
- }
-}
-
-void LogQSO::commentsChanged(const QString& text)
-{
- int index = ui->comments->findText(text);
- if(index != -1)
- {
- ui->comments->setCurrentIndex(index);
- }
- m_comments = (ui->comments->currentIndex(), text);
- m_comments_temp = (ui->comments->currentIndex(), text);
-}
-
-void LogQSO::on_addButton_clicked()
-{
- m_settings->setValue ("LogComments", m_comments_temp);
- if (m_comments_temp != "") {
- QString comments_location = m_config->writeable_data_dir().absoluteFilePath("comments.txt");
- if(QFileInfo::exists(m_config->writeable_data_dir().absoluteFilePath("comments.txt"))) {
- QFile file2 = {comments_location};
- if (file2.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append)) {
- QTextStream out(&file2);
- out << m_comments_temp // append new line to comments.txt
- #if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0)
- << Qt::endl
- #else
- << endl
- #endif
- ;
- file2.close();
- MessageBox::information_message (this,
- "Your comment has been added to the comments list.\n\n"
- "To edit your comments list, open the file\n"
- "\"comments.txt\" from your log directory");
- }
- } else {
- QFile file2 = {comments_location};
- if (file2.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append)) {
- QTextStream out(&file2);
- out << ("\n" + m_comments_temp) // create file "comments.txt" and add a blank line
- #if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0)
- << Qt::endl
- #else
- << endl
- #endif
- ;
- file2.close();
- MessageBox::information_message (this,
- "Your comment has been added to the comments list.\n\n"
- "To edit your comments list, open the file\n"
- "\"comments.txt\" from your log directory");
- }
- }
- ui->comments->clear(); // clear the comments combo box and reload updated content
- QFile file2 = {comments_location};
- QTextStream stream2(&file2);
- if(file2.open (QIODevice::ReadOnly | QIODevice::Text)) {
- while (!stream2.atEnd()) {
- QString line = stream2.readLine();
- ui->comments->addItem (line);
- }
- stream2.flush();
- file2.close();
- }
- }
-}
-
-// closeEvent is only called from the system menu close widget for a
-// modeless dialog so we use the hideEvent override to store the
-// window settings
-void LogQSO::hideEvent (QHideEvent * e)
-{
- storeSettings ();
- QDialog::hideEvent (e);
-}
+#include "logqso.h" + +#include <QLocale> +#include <QString> +#include <QSettings> +#include <QStandardPaths> +#include <QStringList> +#include <QDir> +#include <QTimer> +#include <QPushButton> + +#include "HelpTextWindow.hpp" +#include "logbook/logbook.h" +#include "MessageBox.hpp" +#include "Configuration.hpp" +#include "models/Bands.hpp" +#include "models/CabrilloLog.hpp" +#include "validators/MaidenheadLocatorValidator.hpp" + +#include "ui_logqso.h" +#include "moc_logqso.cpp" + +namespace +{ + auto const sat_file_name = "sat.dat"; + struct PropMode + { + char const * id_; + char const * name_; + }; + constexpr PropMode prop_modes[] = + { + {"", ""} + , {"AS", QT_TRANSLATE_NOOP ("LogQSO", "Aircraft scatter")} + , {"AUE", QT_TRANSLATE_NOOP ("LogQSO", "Aurora-E")} + , {"AUR", QT_TRANSLATE_NOOP ("LogQSO", "Aurora")} + , {"BS", QT_TRANSLATE_NOOP ("LogQSO", "Back scatter")} + , {"ECH", QT_TRANSLATE_NOOP ("LogQSO", "Echolink")} + , {"EME", QT_TRANSLATE_NOOP ("LogQSO", "Earth-moon-earth")} + , {"ES", QT_TRANSLATE_NOOP ("LogQSO", "Sporadic E")} + , {"F2", QT_TRANSLATE_NOOP ("LogQSO", "F2 Reflection")} + , {"FAI", QT_TRANSLATE_NOOP ("LogQSO", "Field aligned irregularities")} + , {"INTERNET", QT_TRANSLATE_NOOP ("LogQSO", "Internet-assisted")} + , {"ION", QT_TRANSLATE_NOOP ("LogQSO", "Ionoscatter")} + , {"IRL", QT_TRANSLATE_NOOP ("LogQSO", "IRLP")} + , {"MS", QT_TRANSLATE_NOOP ("LogQSO", "Meteor scatter")} + , {"RPT", QT_TRANSLATE_NOOP ("LogQSO", "Non-satellite repeater or transponder")} + , {"RS", QT_TRANSLATE_NOOP ("LogQSO", "Rain scatter")} + , {"SAT", QT_TRANSLATE_NOOP ("LogQSO", "Satellite")} + , {"TEP", QT_TRANSLATE_NOOP ("LogQSO", "Trans-equatorial")} + , {"TR", QT_TRANSLATE_NOOP ("LogQSO", "Tropospheric ducting")} + }; + struct SatMode + { + char const * id_; + char const * name_; + }; + constexpr SatMode sat_modes[] = + { + {"", ""} + , {"A", QT_TRANSLATE_NOOP ("LogQSO", "A")} + , {"B", QT_TRANSLATE_NOOP ("LogQSO", "B")} + , {"BS", QT_TRANSLATE_NOOP ("LogQSO", "BS")} + , {"JA", QT_TRANSLATE_NOOP ("LogQSO", "JA")} + , {"JD", QT_TRANSLATE_NOOP ("LogQSO", "JD")} + , {"K", QT_TRANSLATE_NOOP ("LogQSO", "K")} + , {"KA", QT_TRANSLATE_NOOP ("LogQSO", "KA")} + , {"KT", QT_TRANSLATE_NOOP ("LogQSO", "KT")} + , {"L", QT_TRANSLATE_NOOP ("LogQSO", "L")} + , {"LS", QT_TRANSLATE_NOOP ("LogQSO", "LS")} + , {"LU", QT_TRANSLATE_NOOP ("LogQSO", "LU")} + , {"LX", QT_TRANSLATE_NOOP ("LogQSO", "LX")} + , {"S", QT_TRANSLATE_NOOP ("LogQSO", "S")} + , {"SX", QT_TRANSLATE_NOOP ("LogQSO", "SX")} + , {"T", QT_TRANSLATE_NOOP ("LogQSO", "T")} + , {"US", QT_TRANSLATE_NOOP ("LogQSO", "US")} + , {"UV", QT_TRANSLATE_NOOP ("LogQSO", "UV")} + , {"VS", QT_TRANSLATE_NOOP ("LogQSO", "VS")} + , {"VU", QT_TRANSLATE_NOOP ("LogQSO", "VU")} + }; +} + +LogQSO::LogQSO(QString const& programTitle, QSettings * settings + , Configuration const * config, LogBook * log, QWidget *parent) + : QDialog {parent, Qt::WindowStaysOnTopHint | Qt::WindowTitleHint | Qt::WindowSystemMenuHint} + , ui(new Ui::LogQSO) + , m_settings (settings) + , m_config {config} + , m_log {log} +{ + ui->setupUi(this); + setWindowTitle(programTitle + " - Log QSO"); + ui->comboBoxSatellite->addItem ("", ""); + QString sat_file_location; + QDir dataPath {QStandardPaths::writableLocation (QStandardPaths::DataLocation)}; + sat_file_location = dataPath.exists(sat_file_name) ? dataPath.absoluteFilePath(sat_file_name) : m_config->data_dir ().absoluteFilePath (sat_file_name); + QFile file {sat_file_location}; + QStringList wordList; + QTextStream stream(&file); + if(file.open (QIODevice::ReadOnly | QIODevice::Text)) { + while (!stream.atEnd()) { + QString line = stream.readLine(); + wordList = line.split('|'); + ui->comboBoxSatellite->addItem (wordList[1], wordList[0]); + } + stream.flush(); + file.close(); + } + for (auto const& prop_mode : prop_modes) + { + ui->comboBoxPropMode->addItem (prop_mode.name_, prop_mode.id_); + } + for (auto const& sat_mode : sat_modes) + { + ui->comboBoxSatMode->addItem (sat_mode.name_, sat_mode.id_); + } + loadSettings (); + connect (ui->comboBoxPropMode, &QComboBox::currentTextChanged, this, &LogQSO::propModeChanged); + connect (ui->comments, &QComboBox::currentTextChanged, this, &LogQSO::commentsChanged); + connect (ui->addButton, &QPushButton::clicked, this, &LogQSO::on_addButton_clicked); + auto date_time_format = QLocale {}.dateFormat (QLocale::ShortFormat) + " hh:mm:ss"; + ui->start_date_time->setDisplayFormat (date_time_format); + ui->end_date_time->setDisplayFormat (date_time_format); + ui->grid->setValidator (new MaidenheadLocatorValidator {this}); +} + +LogQSO::~LogQSO () +{ +} + +void LogQSO::loadSettings () +{ + m_settings->beginGroup ("LogQSO"); + restoreGeometry (m_settings->value ("geometry", saveGeometry ()).toByteArray ()); + ui->cbTxPower->setChecked (m_settings->value ("SaveTxPower", false).toBool ()); + ui->cbComments->setChecked (m_settings->value ("SaveComments", false).toBool ()); + ui->cbPropMode->setChecked (m_settings->value ("SavePropMode", false).toBool ()); + ui->cbSatellite->setChecked (m_settings->value ("SaveSatellite", false).toBool ()); + ui->cbSatMode->setChecked (m_settings->value ("SaveSatMode", false).toBool ()); + m_comments = m_settings->value ("LogComments", "").toString(); + m_txPower = m_settings->value ("TxPower", "").toString (); + + int prop_index {0}; + if (ui->cbPropMode->isChecked ()) + { + prop_index = ui->comboBoxPropMode->findData (m_settings->value ("PropMode", "").toString()); + } + ui->comboBoxPropMode->setCurrentIndex (prop_index); + int sat_mode_index {0}; + if (ui->cbSatMode->isChecked ()) + { + sat_mode_index = ui->comboBoxSatMode->findData (m_settings->value ("SatMode", "").toString()); + } + ui->comboBoxSatMode->setCurrentIndex (sat_mode_index); + int satellite {0}; + if (ui->cbSatellite->isChecked ()) + { + satellite = ui->comboBoxSatellite->findData (m_settings->value ("Satellite", "").toString()); + } + ui->comboBoxSatellite->setCurrentIndex (satellite); + if (m_settings->value ("PropMode", "") != "SAT") + { + ui->cbSatellite->setDisabled(true); + ui->comboBoxSatellite->setDisabled(true); + ui->cbSatMode->setDisabled(true); + ui->comboBoxSatMode->setDisabled(true); + } + m_freqRx = m_settings->value ("FreqRx", "").toString (); + ui->cbFreqRx->setChecked (m_settings->value ("SaveFreqRx", false).toBool ()); + + QString comments_location; // load the content of comments.txt file to the comments combo box + QDir dataPath {QStandardPaths::writableLocation (QStandardPaths::DataLocation)}; + comments_location = dataPath.exists("comments.txt") ? dataPath.absoluteFilePath("comments.txt") : m_config->data_dir ().absoluteFilePath ("comments.txt"); + QFile file2 {comments_location}; + QTextStream stream2(&file2); + if(file2.open (QIODevice::ReadOnly | QIODevice::Text)) { + while (!stream2.atEnd()) { + QString line = stream2.readLine(); + ui->comments->addItem (line); + } + stream2.flush(); + file2.close(); + } else { + ui->comments->addItem (""); + } + if (ui->cbComments->isChecked ()) ui->comments->setItemText(ui->comments->currentIndex(), m_comments); + + m_settings->endGroup (); +} + +void LogQSO::storeSettings () const +{ + m_settings->beginGroup ("LogQSO"); + m_settings->setValue ("geometry", saveGeometry ()); + m_settings->setValue ("SaveTxPower", ui->cbTxPower->isChecked ()); + m_settings->setValue ("SaveComments", ui->cbComments->isChecked ()); + m_settings->setValue ("SavePropMode", ui->cbPropMode->isChecked ()); + m_settings->setValue ("SaveSatellite", ui->cbSatellite->isChecked ()); + m_settings->setValue ("SaveSatMode", ui->cbSatMode->isChecked ()); + m_settings->setValue ("SaveFreqRx", ui->cbFreqRx->isChecked ()); + m_settings->setValue ("TxPower", m_txPower); + if (ui->cbComments->isChecked ()) { + m_settings->setValue ("LogComments", m_comments); + } else { + m_settings->setValue ("LogComments", ""); + } + m_settings->setValue ("PropMode", ui->comboBoxPropMode->currentData ()); + m_settings->setValue ("Satellite", ui->comboBoxSatellite->currentData ()); + m_settings->setValue ("SatMode", ui->comboBoxSatMode->currentData ()); + m_settings->setValue ("FreqRx", m_freqRx); + m_settings->endGroup (); +} + +void LogQSO::initLogQSO(QString const& hisCall, QString const& hisGrid, QString mode, + QString const& rptSent, QString const& rptRcvd, + QDateTime const& dateTimeOn, QDateTime const& dateTimeOff, + Radio::Frequency dialFreq, bool noSuffix, QString xSent, QString xRcvd) +{ + if(!isHidden()) return; + + QPushButton* okBtn = ui->buttonBox->button(QDialogButtonBox::Ok); + okBtn->setAutoDefault(true); + okBtn->setDefault(true); + okBtn->setFocus(); + QPushButton* caBtn = ui->buttonBox->button(QDialogButtonBox::Cancel); + caBtn->setAutoDefault(false); + caBtn->setDefault(false); + + ui->call->setText (hisCall); + if (m_config->log4digitGrids()) { + ui->grid->setText (hisGrid.left(4)); + } else { + ui->grid->setText (hisGrid); + } + if (hisGrid == "" && m_config->ZZ00()) ui->grid->setText("ZZ00"); + ui->name->clear (); + if (ui->cbTxPower->isChecked ()) + { + ui->txPower->setText (m_txPower); + } + else + { + ui->txPower->clear (); + } + if (ui->cbFreqRx->isChecked ()) + { + ui->freqRx->setText (m_freqRx); + } + else + { + ui->freqRx->clear (); + } + if (ui->cbComments->isChecked ()) + { + ui->comments->setItemText(ui->comments->currentIndex(), m_comments); + } + else + { + ui->comments->setCurrentIndex(0); + ui->comments->setItemText(ui->comments->currentIndex(), ""); + } + if (m_config->report_in_comments()) { + auto t=mode; + if(rptSent!="") t+=" Sent: " + rptSent; + if(rptRcvd!="") t+=" Rcvd: " + rptRcvd; + ui->comments->setCurrentIndex(0); + ui->comments->setItemText(ui->comments->currentIndex(), t); + } + if(noSuffix and mode.mid(0,3)=="JT9") mode="JT9"; + if(m_config->log_as_RTTY() and mode.mid(0,3)=="JT9") mode="RTTY"; + ui->mode->setText(mode); + ui->sent->setText(rptSent); + ui->rcvd->setText(rptRcvd); + ui->start_date_time->setDateTime (dateTimeOn); + ui->end_date_time->setDateTime (dateTimeOff); + m_dialFreq=dialFreq; + m_myCall=m_config->my_callsign(); + m_myGrid=m_config->my_grid(); + ui->band->setText (m_config->bands ()->find (dialFreq)); + ui->loggedOperator->setText(m_config->opCall()); + ui->exchSent->setText (xSent); + ui->exchRcvd->setText (xRcvd); + if (!ui->cbPropMode->isChecked ()) + { + ui->comboBoxPropMode->setCurrentIndex (-1); + } + if (!ui->cbSatellite->isChecked ()) + { + ui->comboBoxSatellite->setCurrentIndex (-1); + ui->comboBoxSatMode->setCurrentIndex (-1); + } + + using SpOp = Configuration::SpecialOperatingActivity; + auto special_op = m_config->special_op_id (); + + // put contest name in comments + if (SpOp::NONE != special_op && SpOp::HOUND != special_op && SpOp::FOX != special_op + && m_config->Individual_Contest_Name() && !m_config->report_in_comments() + && m_config->Contest_Name() !="" && !ui->cbComments->isChecked() && m_config->specOp_in_comments()) { + QString Contest_Name = (m_config->Contest_Name() + " Contest"); + ui->comments->setCurrentIndex(0); + ui->comments->setItemText(ui->comments->currentIndex(), Contest_Name); + } + if (SpOp::NA_VHF == special_op && !m_config->Individual_Contest_Name() && !m_config->report_in_comments() + && !ui->cbComments->isChecked() && m_config->specOp_in_comments()) { + QString Contest_Name = ("NA VHF Contest"); + ui->comments->setCurrentIndex(0); + ui->comments->setItemText(ui->comments->currentIndex(), Contest_Name); + } + if (SpOp::EU_VHF == special_op && !m_config->Individual_Contest_Name() && !m_config->report_in_comments() + && !ui->cbComments->isChecked() && m_config->specOp_in_comments()) { + QString Contest_Name = ("EU VHF Contest"); + ui->comments->setCurrentIndex(0); + ui->comments->setItemText(ui->comments->currentIndex(), Contest_Name); + } + if (SpOp::WW_DIGI == special_op && !m_config->Individual_Contest_Name() && !m_config->report_in_comments() + && !ui->cbComments->isChecked() && m_config->specOp_in_comments()) { + QString Contest_Name = ("WW Digi Contest"); + ui->comments->setCurrentIndex(0); + ui->comments->setItemText(ui->comments->currentIndex(), Contest_Name); + } + if (SpOp::FIELD_DAY == special_op && !m_config->Individual_Contest_Name() && !m_config->report_in_comments() + && !ui->cbComments->isChecked() && m_config->specOp_in_comments()) { + QString Contest_Name = ("ARRL Field Day"); + ui->comments->setCurrentIndex(0); + ui->comments->setItemText(ui->comments->currentIndex(), Contest_Name); + } + if (SpOp::RTTY == special_op && !m_config->Individual_Contest_Name() && !m_config->report_in_comments() + && !ui->cbComments->isChecked() && m_config->specOp_in_comments()) { + QString Contest_Name = ("FT Roundup messages"); + ui->comments->setCurrentIndex(0); + ui->comments->setItemText(ui->comments->currentIndex(), Contest_Name); + } + if (SpOp::ARRL_DIGI == special_op && !m_config->Individual_Contest_Name() && !m_config->report_in_comments() + && !ui->cbComments->isChecked() && m_config->specOp_in_comments()) { + QString Contest_Name = ("ARRL Digi Contest"); + ui->comments->setCurrentIndex(0); + ui->comments->setItemText(ui->comments->currentIndex(), Contest_Name); + } + if (SpOp::HOUND == special_op && !m_config->report_in_comments() + && !ui->cbComments->isChecked() && m_config->specOp_in_comments()) { + QString Contest_Name = ("F/H mode"); + if (m_config->superFox()) Contest_Name = ("SF/H mode"); + ui->comments->setCurrentIndex(0); + ui->comments->setItemText(ui->comments->currentIndex(), Contest_Name); + } + if (SpOp::NONE == special_op && !m_config->report_in_comments() + && !ui->cbComments->isChecked() && m_config->specOp_in_comments()) { + m_comments = ""; + } + + if (SpOp::FOX == special_op + || (m_config->autoLog () && ((SpOp::NONE < special_op && special_op < SpOp::FOX) + || SpOp::ARRL_DIGI == special_op || !m_config->contestingOnly ()))) + { + // allow auto logging in Fox mode and contests + accept(); + } + else + { + show(); + } +} + +void LogQSO::accept() +{ + auto hisCall = ui->call->text (); + auto hisGrid = ui->grid->text (); + auto mode = ui->mode->text (); + auto rptSent = ui->sent->text (); + auto rptRcvd = ui->rcvd->text (); + auto dateTimeOn = ui->start_date_time->dateTime (); + auto dateTimeOff = ui->end_date_time->dateTime (); + auto band = ui->band->text (); + auto name = ui->name->text (); + m_txPower = ui->txPower->text (); + auto strDialFreq = QString::number (m_dialFreq / 1.e6,'f',6); + auto operator_call = ui->loggedOperator->text (); + auto xsent = ui->exchSent->text (); + auto xrcvd = ui->exchRcvd->text (); + + using SpOp = Configuration::SpecialOperatingActivity; + auto special_op = m_config->special_op_id (); + + if (special_op == SpOp::NA_VHF or special_op == SpOp::WW_DIGI) { + if(xrcvd!="" and hisGrid!=xrcvd) hisGrid=xrcvd; + } + + if ((special_op == SpOp::RTTY and xsent!="" and xrcvd!="")) { + if(rptSent=="" or !xsent.contains(rptSent+" ")) rptSent=xsent.split(" " +#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) + , QString::SkipEmptyParts +#else + , Qt::SkipEmptyParts +#endif + ).at(0); + if(rptRcvd=="" or !xrcvd.contains(rptRcvd+" ")) rptRcvd=xrcvd.split(" " +#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) + , QString::SkipEmptyParts +#else + , Qt::SkipEmptyParts +#endif + ).at(0); + } + + // validate + if ((SpOp::NONE < special_op && special_op < SpOp::FOX) || (special_op > SpOp::HOUND)) + { + if (xsent.isEmpty () || xrcvd.isEmpty ()) + { + show (); + MessageBox::warning_message (this, tr ("Invalid QSO Data"), + tr ("Check exchange sent and received")); + return; // without accepting + } + + if (!m_log->contest_log ()->add_QSO (m_dialFreq, mode, dateTimeOff, hisCall, xsent, xrcvd)) + { + show (); + MessageBox::warning_message (this, tr ("Invalid QSO Data"), + tr ("Check all fields")); + return; // without accepting + } + } + + auto const& prop_mode = ui->comboBoxPropMode->currentData ().toString (); + auto satellite = ui->comboBoxSatellite->currentData ().toString (); + auto sat_mode = ui->comboBoxSatMode->currentData ().toString (); + // Add sat name and sat mode tags only if "Satellite" is selected as prop mode + if (prop_mode != "SAT") { + satellite = ""; + sat_mode = ""; + } + m_freqRx = ui->freqRx->text (); + //Log this QSO to file "wsjtx.log" + static QFile f {QDir {QStandardPaths::writableLocation (QStandardPaths::DataLocation)}.absoluteFilePath ("wsjtx.log")}; + if(!f.open(QIODevice::Text | QIODevice::Append)) { + MessageBox::warning_message (this, tr ("Log file error"), + tr ("Cannot open \"%1\" for append").arg (f.fileName ()), + tr ("Error: %1").arg (f.errorString ())); + } else { + QString logEntry=dateTimeOn.date().toString("yyyy-MM-dd,") + + dateTimeOn.time().toString("hh:mm:ss,") + + dateTimeOff.date().toString("yyyy-MM-dd,") + + dateTimeOff.time().toString("hh:mm:ss,") + hisCall + "," + + hisGrid + "," + strDialFreq + "," + mode + + "," + rptSent + "," + rptRcvd + "," + m_txPower + + "," + m_comments + "," + name + "," + prop_mode + + "," + satellite + "," + sat_mode + "," + m_freqRx; + QTextStream out(&f); + out << logEntry << +#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) + endl +#else + Qt::endl +#endif + ; + f.close(); + } + + //Clean up and finish logging + Q_EMIT acceptQSO (dateTimeOff + , hisCall + , hisGrid + , m_dialFreq + , mode + , rptSent + , rptRcvd + , m_txPower + , m_comments + , name + , dateTimeOn + , operator_call + , m_myCall + , m_myGrid + , xsent + , xrcvd + , prop_mode + , satellite + , sat_mode + , m_freqRx + , m_log->QSOToADIF (hisCall + , hisGrid + , mode + , rptSent + , rptRcvd + , dateTimeOn + , dateTimeOff + , band + , m_comments + , name + , strDialFreq + , m_myCall + , m_myGrid + , m_txPower + , operator_call + , xsent + , xrcvd + , prop_mode + , satellite + , sat_mode + , m_freqRx)); + QDialog::accept(); +} + +void LogQSO::propModeChanged() +{ + if (ui->comboBoxPropMode->currentData() != "SAT") { + ui->comboBoxSatellite->setCurrentIndex(0); + ui->comboBoxSatellite->setDisabled(true); + ui->cbSatellite->setDisabled(true); + ui->comboBoxSatMode->setCurrentIndex(0); + ui->comboBoxSatMode->setDisabled(true); + ui->cbSatMode->setDisabled(true); + } else { + ui->comboBoxSatellite->setDisabled(false); + ui->cbSatellite->setDisabled(false); + ui->comboBoxSatMode->setDisabled(false); + ui->cbSatMode->setDisabled(false); + } +} + +void LogQSO::commentsChanged(const QString& text) +{ + int index = ui->comments->findText(text); + if(index != -1) + { + ui->comments->setCurrentIndex(index); + } + m_comments = (ui->comments->currentIndex(), text); + m_comments_temp = (ui->comments->currentIndex(), text); +} + +void LogQSO::on_addButton_clicked() +{ + m_settings->setValue ("LogComments", m_comments_temp); + if (m_comments_temp != "") { + QString comments_location = m_config->writeable_data_dir().absoluteFilePath("comments.txt"); + if(QFileInfo::exists(m_config->writeable_data_dir().absoluteFilePath("comments.txt"))) { + QFile file2 {comments_location}; + if (file2.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append)) { + QTextStream out(&file2); + out << m_comments_temp // append new line to comments.txt + #if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0) + << Qt::endl + #else + << endl + #endif + ; + file2.close(); + MessageBox::information_message (this, + "Your comment has been added to the comments list.\n\n" + "To edit your comments list, open the file\n" + "\"comments.txt\" from your log directory"); + } + } else { + QFile file2 {comments_location}; + if (file2.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append)) { + QTextStream out(&file2); + out << ("\n" + m_comments_temp) // create file "comments.txt" and add a blank line + #if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0) + << Qt::endl + #else + << endl + #endif + ; + file2.close(); + MessageBox::information_message (this, + "Your comment has been added to the comments list.\n\n" + "To edit your comments list, open the file\n" + "\"comments.txt\" from your log directory"); + } + } + ui->comments->clear(); // clear the comments combo box and reload updated content + QFile file2 {comments_location}; + QTextStream stream2(&file2); + if(file2.open (QIODevice::ReadOnly | QIODevice::Text)) { + while (!stream2.atEnd()) { + QString line = stream2.readLine(); + ui->comments->addItem (line); + } + stream2.flush(); + file2.close(); + } + } +} + +// closeEvent is only called from the system menu close widget for a +// modeless dialog so we use the hideEvent override to store the +// window settings +void LogQSO::hideEvent (QHideEvent * e) +{ + storeSettings (); + QDialog::hideEvent (e); +} diff --git a/widgets/logqso.h b/widgets/logqso.h index 5c086d02..491eb033 100755..100644 --- a/widgets/logqso.h +++ b/widgets/logqso.h @@ -1,73 +1,73 @@ -// -*- Mode: C++ -*-
-#ifndef LogQSO_H_
-#define LogQSO_H_
-
-#include <QDialog>
-
-#include <QString>
-#include <QScopedPointer>
-#include <QDateTime>
-
-#include "HelpTextWindow.hpp"
-#include "Radio.hpp"
-
-namespace Ui {
- class LogQSO;
-}
-
-class QSettings;
-class Configuration;
-class QByteArray;
-class LogBook;
-
-class LogQSO : public QDialog
-{
- Q_OBJECT
-
-public:
- explicit LogQSO(QString const& programTitle, QSettings *, Configuration const *, LogBook *, QWidget *parent = 0);
- ~LogQSO();
- void initLogQSO(QString const& hisCall, QString const& hisGrid, QString mode,
- QString const& rptSent, QString const& rptRcvd, QDateTime const& dateTimeOn,
- QDateTime const& dateTimeOff, Radio::Frequency dialFreq,
- bool noSuffix, QString xSent, QString xRcvd);
-
-public slots:
- void accept();
-
-signals:
- void acceptQSO (QDateTime const& QSO_date_off, QString const& call, QString const& grid
- , Radio::Frequency dial_freq, QString const& mode
- , QString const& rpt_sent, QString const& rpt_received
- , QString const& tx_power, QString const& comments
- , QString const& name, QDateTime const& QSO_date_on, QString const& operator_call
- , QString const& my_call, QString const& my_grid
- , QString const& exchange_sent, QString const& exchange_rcvd
- , QString const& propmode, QString const& satellite
- , QString const& sat_mode
- , QString const& freqRx, QByteArray const& ADIF);
-
-protected:
- void hideEvent (QHideEvent *);
-
-private:
- void loadSettings ();
- void storeSettings () const;
- void propModeChanged ();
- void commentsChanged(const QString& text);
- void on_addButton_clicked ();
-
- QScopedPointer<Ui::LogQSO> ui;
- QSettings * m_settings;
- Configuration const * m_config;
- LogBook * m_log;
- QString m_txPower;
- QString m_comments;
- QString m_comments_temp = "";
- Radio::Frequency m_dialFreq;
- QString m_myCall;
- QString m_myGrid;
- QString m_freqRx;
-};
-
-#endif // LogQSO_H
+// -*- Mode: C++ -*- +#ifndef LogQSO_H_ +#define LogQSO_H_ + +#include <QDialog> + +#include <QString> +#include <QScopedPointer> +#include <QDateTime> + +#include "HelpTextWindow.hpp" +#include "Radio.hpp" + +namespace Ui { + class LogQSO; +} + +class QSettings; +class Configuration; +class QByteArray; +class LogBook; + +class LogQSO : public QDialog +{ + Q_OBJECT + +public: + explicit LogQSO(QString const& programTitle, QSettings *, Configuration const *, LogBook *, QWidget *parent = 0); + ~LogQSO(); + void initLogQSO(QString const& hisCall, QString const& hisGrid, QString mode, + QString const& rptSent, QString const& rptRcvd, QDateTime const& dateTimeOn, + QDateTime const& dateTimeOff, Radio::Frequency dialFreq, + bool noSuffix, QString xSent, QString xRcvd); + +public slots: + void accept(); + +signals: + void acceptQSO (QDateTime const& QSO_date_off, QString const& call, QString const& grid + , Radio::Frequency dial_freq, QString const& mode + , QString const& rpt_sent, QString const& rpt_received + , QString const& tx_power, QString const& comments + , QString const& name, QDateTime const& QSO_date_on, QString const& operator_call + , QString const& my_call, QString const& my_grid + , QString const& exchange_sent, QString const& exchange_rcvd + , QString const& propmode, QString const& satellite + , QString const& sat_mode + , QString const& freqRx, QByteArray const& ADIF); + +protected: + void hideEvent (QHideEvent *); + +private: + void loadSettings (); + void storeSettings () const; + void propModeChanged (); + void commentsChanged(const QString& text); + void on_addButton_clicked (); + + QScopedPointer<Ui::LogQSO> ui; + QSettings * m_settings; + Configuration const * m_config; + LogBook * m_log; + QString m_txPower; + QString m_comments; + QString m_comments_temp = ""; + Radio::Frequency m_dialFreq; + QString m_myCall; + QString m_myGrid; + QString m_freqRx; +}; + +#endif // LogQSO_H diff --git a/widgets/logqso.ui b/widgets/logqso.ui index 007c5f0a..90fb0889 100755..100644 --- a/widgets/logqso.ui +++ b/widgets/logqso.ui @@ -1,668 +1,668 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>LogQSO</class>
- <widget class="QDialog" name="LogQSO">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>480</width>
- <height>420</height>
- </rect>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_5">
- <item>
- <widget class="QLabel" name="label">
- <property name="font">
- <font>
- <pointsize>10</pointsize>
- </font>
- </property>
- <property name="text">
- <string>Click OK to confirm the following QSO:</string>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <item>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QLabel" name="lab1">
- <property name="font">
- <font>
- <pointsize>10</pointsize>
- </font>
- </property>
- <property name="text">
- <string>Call</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <property name="buddy">
- <cstring>call</cstring>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLineEdit" name="call"/>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <item>
- <widget class="QLabel" name="lab2">
- <property name="font">
- <font>
- <pointsize>10</pointsize>
- </font>
- </property>
- <property name="text">
- <string>Start</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <property name="buddy">
- <cstring>start_date_time</cstring>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QDateTimeEdit" name="start_date_time">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="displayFormat">
- <string>dd/MM/yyyy HH:mm:ss</string>
- </property>
- <property name="timeSpec">
- <enum>Qt::UTC</enum>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QVBoxLayout" name="verticalLayout_3">
- <item>
- <widget class="QLabel" name="lab2_3">
- <property name="font">
- <font>
- <pointsize>10</pointsize>
- </font>
- </property>
- <property name="text">
- <string>End</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <property name="buddy">
- <cstring>end_date_time</cstring>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QDateTimeEdit" name="end_date_time">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="displayFormat">
- <string>dd/MM/yyyy HH:mm:ss</string>
- </property>
- <property name="timeSpec">
- <enum>Qt::UTC</enum>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_4" stretch="1,1,1,1,1,2">
- <item>
- <layout class="QVBoxLayout" name="verticalLayout_4">
- <item>
- <widget class="QLabel" name="lab4">
- <property name="font">
- <font>
- <pointsize>10</pointsize>
- </font>
- </property>
- <property name="text">
- <string>Mode</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <property name="buddy">
- <cstring>mode</cstring>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLineEdit" name="mode">
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QVBoxLayout" name="verticalLayout_6">
- <item>
- <widget class="QLabel" name="lab5">
- <property name="font">
- <font>
- <pointsize>10</pointsize>
- </font>
- </property>
- <property name="text">
- <string>Band</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <property name="buddy">
- <cstring>band</cstring>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLineEdit" name="band">
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QVBoxLayout" name="verticalLayout_7">
- <item>
- <widget class="QLabel" name="lab6">
- <property name="font">
- <font>
- <pointsize>10</pointsize>
- </font>
- </property>
- <property name="text">
- <string>Rpt Sent</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <property name="buddy">
- <cstring>sent</cstring>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLineEdit" name="sent">
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QVBoxLayout" name="verticalLayout_8">
- <item>
- <widget class="QLabel" name="lab7">
- <property name="font">
- <font>
- <pointsize>10</pointsize>
- </font>
- </property>
- <property name="text">
- <string>Rpt Rcvd</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <property name="buddy">
- <cstring>rcvd</cstring>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLineEdit" name="rcvd">
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QVBoxLayout" name="verticalLayout_9">
- <item>
- <widget class="QLabel" name="lab8">
- <property name="font">
- <font>
- <pointsize>10</pointsize>
- </font>
- </property>
- <property name="text">
- <string>Grid</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <property name="buddy">
- <cstring>grid</cstring>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLineEdit" name="grid">
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QVBoxLayout" name="verticalLayout_10">
- <item>
- <widget class="QLabel" name="lab9">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="font">
- <font>
- <pointsize>10</pointsize>
- </font>
- </property>
- <property name="text">
- <string>Name</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <property name="buddy">
- <cstring>name</cstring>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLineEdit" name="name">
- <property name="enabled">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QGridLayout" name="gridLayout_2" rowstretch="0,0,0,0" columnstretch="0,1,0,0,0,0">
- <item row="0" column="0">
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>Tx power</string>
- </property>
- <property name="buddy">
- <cstring>txPower</cstring>
- </property>
- </widget>
- </item>
- <item row="1" column="4">
- <widget class="QPushButton" name="addButton">
- <property name="maximumSize">
- <size>
- <width>45</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string><html><head/><body><p>Add comment to the comments list.</p></body></html></string>
- </property>
- <property name="text">
- <string>Add</string>
- </property>
- </widget>
- </item>
- <item row="0" column="5">
- <widget class="QCheckBox" name="cbTxPower">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Retain</string>
- </property>
- </widget>
- </item>
- <item row="1" column="5">
- <widget class="QCheckBox" name="cbComments">
- <property name="text">
- <string>Retain</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="lab10">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="font">
- <font>
- <pointsize>10</pointsize>
- </font>
- </property>
- <property name="text">
- <string>Comments</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="operatorLabel">
- <property name="font">
- <font>
- <pointsize>10</pointsize>
- </font>
- </property>
- <property name="text">
- <string>Operator</string>
- </property>
- <property name="buddy">
- <cstring>loggedOperator</cstring>
- </property>
- </widget>
- </item>
- <item row="3" column="0">
- <widget class="QLabel" name="label_3">
- <property name="text">
- <string>Exch sent</string>
- </property>
- <property name="buddy">
- <cstring>exchSent</cstring>
- </property>
- </widget>
- </item>
- <item row="3" column="1" colspan="5">
- <layout class="QHBoxLayout" name="horizontalLayout_3">
- <item>
- <widget class="QLineEdit" name="exchSent">
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer_2">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Fixed</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QLabel" name="label_4">
- <property name="text">
- <string>Rcvd</string>
- </property>
- <property name="buddy">
- <cstring>exchRcvd</cstring>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLineEdit" name="exchRcvd">
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="0" column="1" colspan="4">
- <widget class="QLineEdit" name="txPower"/>
- </item>
- <item row="1" column="1" colspan="3">
- <widget class="QComboBox" name="comments">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="editable">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="2" column="1" colspan="4">
- <widget class="QLineEdit" name="loggedOperator">
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QGridLayout" name="gridLayout" columnstretch="0,2,0,0">
- <item row="0" column="0">
- <widget class="QLabel" name="label_5">
- <property name="text">
- <string>Prop Mode</string>
- </property>
- <property name="buddy">
- <cstring>comboBoxPropMode</cstring>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_6">
- <property name="text">
- <string>Satellite</string>
- </property>
- <property name="buddy">
- <cstring>comboBoxSatellite</cstring>
- </property>
- </widget>
- </item>
- <item row="2" column="3">
- <widget class="QCheckBox" name="cbSatMode">
- <property name="text">
- <string>Retain</string>
- </property>
- </widget>
- </item>
- <item row="0" column="3">
- <widget class="QCheckBox" name="cbPropMode">
- <property name="text">
- <string>Retain</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="label_8">
- <property name="text">
- <string>Sat Mode</string>
- </property>
- </widget>
- </item>
- <item row="1" column="3">
- <widget class="QCheckBox" name="cbSatellite">
- <property name="text">
- <string>Retain</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QComboBox" name="comboBoxSatMode"/>
- </item>
- <item row="3" column="0">
- <widget class="QLabel" name="label_7">
- <property name="text">
- <string>RX Frequency</string>
- </property>
- </widget>
- </item>
- <item row="3" column="3">
- <widget class="QCheckBox" name="cbFreqRx">
- <property name="text">
- <string>Retain</string>
- </property>
- </widget>
- </item>
- <item row="2" column="2">
- <spacer name="horizontalSpacer_4">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>120</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="0" column="1" colspan="2">
- <widget class="QComboBox" name="comboBoxPropMode"/>
- </item>
- <item row="1" column="1" colspan="2">
- <widget class="QComboBox" name="comboBoxSatellite">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </item>
- <item row="3" column="1" colspan="2">
- <widget class="QLineEdit" name="freqRx"/>
- </item>
- </layout>
- </item>
- <item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QDialogButtonBox" name="buttonBox">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="standardButtons">
- <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <tabstops>
- <tabstop>call</tabstop>
- <tabstop>start_date_time</tabstop>
- <tabstop>end_date_time</tabstop>
- <tabstop>mode</tabstop>
- <tabstop>band</tabstop>
- <tabstop>sent</tabstop>
- <tabstop>rcvd</tabstop>
- <tabstop>grid</tabstop>
- <tabstop>name</tabstop>
- </tabstops>
- <resources/>
- <connections>
- <connection>
- <sender>buttonBox</sender>
- <signal>accepted()</signal>
- <receiver>LogQSO</receiver>
- <slot>accept()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>248</x>
- <y>254</y>
- </hint>
- <hint type="destinationlabel">
- <x>157</x>
- <y>274</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>buttonBox</sender>
- <signal>rejected()</signal>
- <receiver>LogQSO</receiver>
- <slot>reject()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>316</x>
- <y>260</y>
- </hint>
- <hint type="destinationlabel">
- <x>286</x>
- <y>274</y>
- </hint>
- </hints>
- </connection>
- </connections>
-</ui>
+<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>LogQSO</class> + <widget class="QDialog" name="LogQSO"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>480</width> + <height>420</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <layout class="QVBoxLayout" name="verticalLayout_5"> + <item> + <widget class="QLabel" name="label"> + <property name="font"> + <font> + <pointsize>10</pointsize> + </font> + </property> + <property name="text"> + <string>Click OK to confirm the following QSO:</string> + </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QLabel" name="lab1"> + <property name="font"> + <font> + <pointsize>10</pointsize> + </font> + </property> + <property name="text"> + <string>Call</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="buddy"> + <cstring>call</cstring> + </property> + </widget> + </item> + <item> + <widget class="QLineEdit" name="call"/> + </item> + </layout> + </item> + <item> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <item> + <widget class="QLabel" name="lab2"> + <property name="font"> + <font> + <pointsize>10</pointsize> + </font> + </property> + <property name="text"> + <string>Start</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="buddy"> + <cstring>start_date_time</cstring> + </property> + </widget> + </item> + <item> + <widget class="QDateTimeEdit" name="start_date_time"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="displayFormat"> + <string>dd/MM/yyyy HH:mm:ss</string> + </property> + <property name="timeSpec"> + <enum>Qt::UTC</enum> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <item> + <widget class="QLabel" name="lab2_3"> + <property name="font"> + <font> + <pointsize>10</pointsize> + </font> + </property> + <property name="text"> + <string>End</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="buddy"> + <cstring>end_date_time</cstring> + </property> + </widget> + </item> + <item> + <widget class="QDateTimeEdit" name="end_date_time"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="displayFormat"> + <string>dd/MM/yyyy HH:mm:ss</string> + </property> + <property name="timeSpec"> + <enum>Qt::UTC</enum> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_4" stretch="1,1,1,1,1,2"> + <item> + <layout class="QVBoxLayout" name="verticalLayout_4"> + <item> + <widget class="QLabel" name="lab4"> + <property name="font"> + <font> + <pointsize>10</pointsize> + </font> + </property> + <property name="text"> + <string>Mode</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="buddy"> + <cstring>mode</cstring> + </property> + </widget> + </item> + <item> + <widget class="QLineEdit" name="mode"> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QVBoxLayout" name="verticalLayout_6"> + <item> + <widget class="QLabel" name="lab5"> + <property name="font"> + <font> + <pointsize>10</pointsize> + </font> + </property> + <property name="text"> + <string>Band</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="buddy"> + <cstring>band</cstring> + </property> + </widget> + </item> + <item> + <widget class="QLineEdit" name="band"> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QVBoxLayout" name="verticalLayout_7"> + <item> + <widget class="QLabel" name="lab6"> + <property name="font"> + <font> + <pointsize>10</pointsize> + </font> + </property> + <property name="text"> + <string>Rpt Sent</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="buddy"> + <cstring>sent</cstring> + </property> + </widget> + </item> + <item> + <widget class="QLineEdit" name="sent"> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QVBoxLayout" name="verticalLayout_8"> + <item> + <widget class="QLabel" name="lab7"> + <property name="font"> + <font> + <pointsize>10</pointsize> + </font> + </property> + <property name="text"> + <string>Rpt Rcvd</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="buddy"> + <cstring>rcvd</cstring> + </property> + </widget> + </item> + <item> + <widget class="QLineEdit" name="rcvd"> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QVBoxLayout" name="verticalLayout_9"> + <item> + <widget class="QLabel" name="lab8"> + <property name="font"> + <font> + <pointsize>10</pointsize> + </font> + </property> + <property name="text"> + <string>Grid</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="buddy"> + <cstring>grid</cstring> + </property> + </widget> + </item> + <item> + <widget class="QLineEdit" name="grid"> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QVBoxLayout" name="verticalLayout_10"> + <item> + <widget class="QLabel" name="lab9"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="font"> + <font> + <pointsize>10</pointsize> + </font> + </property> + <property name="text"> + <string>Name</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="buddy"> + <cstring>name</cstring> + </property> + </widget> + </item> + <item> + <widget class="QLineEdit" name="name"> + <property name="enabled"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </item> + <item> + <layout class="QGridLayout" name="gridLayout_2" rowstretch="0,0,0,0" columnstretch="0,1,0,0,0,0"> + <item row="0" column="0"> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>Tx power</string> + </property> + <property name="buddy"> + <cstring>txPower</cstring> + </property> + </widget> + </item> + <item row="1" column="4"> + <widget class="QPushButton" name="addButton"> + <property name="maximumSize"> + <size> + <width>45</width> + <height>16777215</height> + </size> + </property> + <property name="toolTip"> + <string><html><head/><body><p>Add comment to the comments list.</p></body></html></string> + </property> + <property name="text"> + <string>Add</string> + </property> + </widget> + </item> + <item row="0" column="5"> + <widget class="QCheckBox" name="cbTxPower"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Retain</string> + </property> + </widget> + </item> + <item row="1" column="5"> + <widget class="QCheckBox" name="cbComments"> + <property name="text"> + <string>Retain</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="lab10"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="font"> + <font> + <pointsize>10</pointsize> + </font> + </property> + <property name="text"> + <string>Comments</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="operatorLabel"> + <property name="font"> + <font> + <pointsize>10</pointsize> + </font> + </property> + <property name="text"> + <string>Operator</string> + </property> + <property name="buddy"> + <cstring>loggedOperator</cstring> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="label_3"> + <property name="text"> + <string>Exch sent</string> + </property> + <property name="buddy"> + <cstring>exchSent</cstring> + </property> + </widget> + </item> + <item row="3" column="1" colspan="5"> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <item> + <widget class="QLineEdit" name="exchSent"> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Fixed</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="label_4"> + <property name="text"> + <string>Rcvd</string> + </property> + <property name="buddy"> + <cstring>exchRcvd</cstring> + </property> + </widget> + </item> + <item> + <widget class="QLineEdit" name="exchRcvd"> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + </widget> + </item> + </layout> + </item> + <item row="0" column="1" colspan="4"> + <widget class="QLineEdit" name="txPower"/> + </item> + <item row="1" column="1" colspan="3"> + <widget class="QComboBox" name="comments"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="editable"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="2" column="1" colspan="4"> + <widget class="QLineEdit" name="loggedOperator"> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QGridLayout" name="gridLayout" columnstretch="0,2,0,0"> + <item row="0" column="0"> + <widget class="QLabel" name="label_5"> + <property name="text"> + <string>Prop Mode</string> + </property> + <property name="buddy"> + <cstring>comboBoxPropMode</cstring> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_6"> + <property name="text"> + <string>Satellite</string> + </property> + <property name="buddy"> + <cstring>comboBoxSatellite</cstring> + </property> + </widget> + </item> + <item row="2" column="3"> + <widget class="QCheckBox" name="cbSatMode"> + <property name="text"> + <string>Retain</string> + </property> + </widget> + </item> + <item row="0" column="3"> + <widget class="QCheckBox" name="cbPropMode"> + <property name="text"> + <string>Retain</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label_8"> + <property name="text"> + <string>Sat Mode</string> + </property> + </widget> + </item> + <item row="1" column="3"> + <widget class="QCheckBox" name="cbSatellite"> + <property name="text"> + <string>Retain</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QComboBox" name="comboBoxSatMode"/> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="label_7"> + <property name="text"> + <string>RX Frequency</string> + </property> + </widget> + </item> + <item row="3" column="3"> + <widget class="QCheckBox" name="cbFreqRx"> + <property name="text"> + <string>Retain</string> + </property> + </widget> + </item> + <item row="2" column="2"> + <spacer name="horizontalSpacer_4"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>120</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="0" column="1" colspan="2"> + <widget class="QComboBox" name="comboBoxPropMode"/> + </item> + <item row="1" column="1" colspan="2"> + <widget class="QComboBox" name="comboBoxSatellite"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </item> + <item row="3" column="1" colspan="2"> + <widget class="QLineEdit" name="freqRx"/> + </item> + </layout> + </item> + <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + </property> + </widget> + </item> + </layout> + </widget> + <tabstops> + <tabstop>call</tabstop> + <tabstop>start_date_time</tabstop> + <tabstop>end_date_time</tabstop> + <tabstop>mode</tabstop> + <tabstop>band</tabstop> + <tabstop>sent</tabstop> + <tabstop>rcvd</tabstop> + <tabstop>grid</tabstop> + <tabstop>name</tabstop> + </tabstops> + <resources/> + <connections> + <connection> + <sender>buttonBox</sender> + <signal>accepted()</signal> + <receiver>LogQSO</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel"> + <x>248</x> + <y>254</y> + </hint> + <hint type="destinationlabel"> + <x>157</x> + <y>274</y> + </hint> + </hints> + </connection> + <connection> + <sender>buttonBox</sender> + <signal>rejected()</signal> + <receiver>LogQSO</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel"> + <x>316</x> + <y>260</y> + </hint> + <hint type="destinationlabel"> + <x>286</x> + <y>274</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp index 1d82a57b..b2c399ed 100755..100644 --- a/widgets/mainwindow.cpp +++ b/widgets/mainwindow.cpp @@ -1,17044 +1,17389 @@ -//---------------------------------------------------------- MainWindow
-#include "mainwindow.h"
-
-#include <QAudio>
-#include <QAudioOutput>
-#include <QSound>
-#include <QCoreApplication>
-#include <cinttypes>
-#include <cstring>
-#include <cmath>
-#include <limits>
-#include <functional>
-#include <fstream>
-#include <iterator>
-#include <algorithm>
-#include <fftw3.h>
-#include <thread> // TCI
-#include <QApplication>
-#include <QStringListModel>
-#include <QSettings>
-#include <QKeyEvent>
-#include <QWheelEvent>
-#include <QProcessEnvironment>
-#include <QSharedMemory>
-#include <QFileDialog>
-#include <QTextBlock>
-#include <QProgressBar>
-#include <QLineEdit>
-#include <QRegExpValidator>
-#include <QRegExp>
-#include <QRegularExpression>
-#include <QDesktopServices>
-#include <QNetworkAccessManager> // TCI
-#include <QNetworkRequest> // TCI
-#include <QNetworkReply> // TCI
-#include <QUrl>
-#include <QStandardPaths>
-#include <QDir>
-#include <QDebug>
-#include <QtConcurrent/QtConcurrentRun>
-#include <QProgressDialog>
-#include <QHostInfo>
-#include <QVector>
-#include <QCursor>
-#include <QToolTip>
-#include <QAction>
-#include <QButtonGroup>
-#include <QActionGroup>
-#include <QSplashScreen>
-#include <QUdpSocket>
-#include <QAbstractItemView>
-#include <QInputDialog>
-#include <QSound> // TCI
-#include <QtMath> // TCI
-#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0)
-#include <QRandomGenerator>
-#endif
-
-#include "itoneAndicw.h" // TCI
-
-#include "helper_functions.h"
-#include "revision_utils.hpp"
-#include "qt_helpers.hpp"
-#include "Network/NetworkAccessManager.hpp"
-#include "Audio/soundout.h"
-#include "Audio/soundin.h"
-#include "Modulator/Modulator.hpp"
-#include "Detector/Detector.hpp"
-#include "plotter.h"
-#include "echoplot.h"
-#include "echograph.h"
-#include "fastplot.h"
-#include "fastgraph.h"
-#include "otpgenerator.h"
-#include "about.h"
-#include "messageaveraging.h"
-#include "activeStations.h"
-#include "colorhighlighting.h"
-#include "widegraph.h"
-#include "sleep.h"
-#include "logqso.h"
-#include "Decoder/decodedtext.h"
-#include "Radio.hpp"
-#include "models/Bands.hpp"
-#include "Transceiver/TransceiverFactory.hpp"
-#include "models/StationList.hpp"
-#include "validators/LiveFrequencyValidator.hpp"
-#include "Network/MessageClient.hpp"
-#include "Network/FoxVerifier.hpp"
-#include "Network/wsprnet.h"
-#include "signalmeter.h"
-#include "HelpTextWindow.hpp"
-#include "SampleDownloader.hpp"
-#include "Audio/BWFFile.hpp"
-#include "MultiSettings.hpp"
-#include "validators/MaidenheadLocatorValidator.hpp"
-#include "validators/CallsignValidator.hpp"
-#include "EqualizationToolsDialog.hpp"
-#include "Network/LotWUsers.hpp"
-#include "logbook/AD1CCty.hpp"
-#include "models/FoxLog.hpp"
-#include "models/CabrilloLog.hpp"
-#include "FoxLogWindow.hpp"
-#include "CabrilloLogWindow.hpp"
-#include "ExportCabrillo.h"
-#include "Network/Cloudlog.hpp"
-#include "ui_mainwindow.h"
-#include "moc_mainwindow.cpp"
-#include "Logger.hpp"
-#include "widgets/QSYMessage.h"
-#include "widgets/QSYMessageCreator.h"
-#include "widgets/qsymonitor.h"
-
-#define FCL fortran_charlen_t
-
-extern "C" {
- //----------------------------------------------------- C and Fortran routines
- void symspec_(struct dec_data *, int* k, double* trperiod, int* nsps, int* ingain,
- bool* bLowSidelobes, int* minw, float* px, float s[], float* df3,
- int* nhsym, int* npts8, float *m_pxmax, int* npct);
-
- void hspec_(short int d2[], int* k, int* nutc0, int* ntrperiod, int* nrxfreq, int* ntol,
- bool* bmsk144, bool* btrain, double const pcoeffs[], int* ingain,
- char const * mycall, char const * hiscall, bool* bshmsg, bool* bswl,
- char const * ddir, float green[],
- float s[], int* jh, float *pxmax, float *rmsNoGain, char line[],
- fortran_charlen_t, fortran_charlen_t, fortran_charlen_t, fortran_charlen_t);
-
- void gen_echocall_(char* basecall, int itone[], fortran_charlen_t);
-
- void genft8_(char* msg, int* i3, int* n3, char* msgsent, char ft8msgbits[],
- int itone[], fortran_charlen_t, fortran_charlen_t);
-
- void genft4_(char* msg, int* ichk, char* msgsent, char ft4msgbits[], int itone[],
- fortran_charlen_t, fortran_charlen_t);
-
- void genfst4_(char* msg, int* ichk, char* msgsent, char fst4msgbits[],
- int itone[], int* iwspr, fortran_charlen_t, fortran_charlen_t);
-
- void gen_ft8wave_(int itone[], int* nsym, int* nsps, float* bt, float* fsample, float* f0,
- float xjunk[], float wave[], int* icmplx, int* nwave);
-
- void gen_ft4wave_(int itone[], int* nsym, int* nsps, float* fsample, float* f0,
- float xjunk[], float wave[], int* icmplx, int* nwave);
-
- void gen_fst4wave_(int itone[], int* nsym, int* nsps, int* nwave, float* fsample,
- int* hmod, float* f0, int* icmplx, float xjunk[], float wave[]);
-
- void genwave_(int itone[], int* nsym, int* nsps, int* nwave, float* fsample,
- double* toneSpacing, float* f0, int* icmplx, float xjunk[], float wave[]);
-
- void gen4_(char* msg, int* ichk, char* msgsent, int itone[],
- int* itext, fortran_charlen_t, fortran_charlen_t);
-
- void gen9_(char* msg, int* ichk, char* msgsent, int itone[],
- int* itext, fortran_charlen_t, fortran_charlen_t);
-
- void genmsk_128_90_(char* msg, int* ichk, char* msgsent, int itone[], int* itype,
- fortran_charlen_t, fortran_charlen_t);
-
- void gen65(char* msg, int* ichk, char msgsent[], int itone[], int* itext);
-
- void gen_cw_wave_(char* msg, int* ifreq, float wave[], fortran_charlen_t);
-
- void genq65_(char* msg, int* ichk, char* msgsent, int itone[],
- int* i3, int* n3, fortran_charlen_t, fortran_charlen_t);
-
- void genwspr_(char* msg, char* msgsent, int itone[], fortran_charlen_t, fortran_charlen_t);
-
- void azdist_(char* MyGrid, char* HisGrid, double* utch, int* nAz, int* nEl,
- int* nDmiles, int* nDkm, int* nHotAz, int* nHotABetter,
- fortran_charlen_t, fortran_charlen_t);
-
- void morse_(char* msg, int* icw, int* ncw, fortran_charlen_t);
-
- void wspr_downsample_(short int d2[], int* k);
-
- int savec2_(char const * fname, int* TR_seconds, double* dial_freq, fortran_charlen_t);
-
- void save_echo_params_(int* ndoptotal, int* ndop, int* nfrit, float* f1, float* fspread,
- int* toneSpacing, volatile int itone[], short id2[], int* idir);
-
- void avecho_( short id2[], int* dop, int* nfrit, int* nauto, int* ndf, int* navg,
- int* nqual, float* f1, float* level, float* sigdb, float* snr, float* dfreq,
- float* width, bool* bDiskData, bool* bEchoCall, char const * txcall,
- char rxcall[], float* xdt, FCL len1, FCL len2);
-
- void fast_decode_(short id2[], int narg[], double * trperiod,
- char msg[], char mycall[], char hiscall[],
- fortran_charlen_t, fortran_charlen_t, fortran_charlen_t);
- void degrade_snr_(short d2[], int* n, float* db, float* bandwidth);
-
- void wav12_(short d2[], short d1[], int* nbytes, short* nbitsam2);
-
- void refspectrum_(short int d2[], bool* bclearrefspec,
- bool* brefspec, bool* buseref, const char* c_fname, fortran_charlen_t);
-
- void freqcal_(short d2[], int* k, int* nkhz,int* noffset, int* ntol,
- char line[], fortran_charlen_t);
-
- void calibrate_(char const * data_dir, int* iz, double* a, double* b, double* rms,
- double* sigmaa, double* sigmab, int* irc, fortran_charlen_t);
-
- void foxgen_(bool* bSuperFox, char const * fname, FCL len);
-
- void sfox_wave_gfsk_();
-
- void sftx_sub_(char const * otp_key, FCL len1);
-
- void plotsave_(float swide[], int* m_w , int* m_h1, int* irow);
-
- void chk_samples_(int* m_ihsym,int* k, int* m_hsymStop);
-
- void save_dxbase_(char* dxbase, FCL len);
-
- void indexx_(float arr[], int* n, int indx[]);
-
- void get_q3list_(char* fname, bool* bDiskData, int* nlist, char* list, FCL len1, FCL len2);
-
- void rm_q3list_(char* callsign, FCL len);
-
- void jpl_setup_(char* fname, FCL len);
-}
-QList<FoxVerifier *> m_verifications;
-int volatile itone[MAX_NUM_SYMBOLS]; //Audio tones for all Tx symbols
-int volatile itone0[MAX_NUM_SYMBOLS]; //Dummy array, data not actually used
-int volatile icw[NUM_CW_SYMBOLS]; //Dits for CW ID
-dec_data_t dec_data; //For sharing with Fortran
-int outBufSize;
-int rc;
-qint32 g_iptt {0};
-wchar_t buffer[256];
-float fast_green[703];
-float fast_green2[703];
-float fast_s[44992]; //44992=64*703
-float fast_s2[44992];
-int fast_jh {0};
-int fast_jhpeak {0};
-int fast_jh2 {0};
-int narg[15];
-QVector<QColor> g_ColorTbl;
-
-using SpecOp = Configuration::SpecialOperatingActivity;
-
-bool verified = false;
-bool blocked = false;
-bool m_displayBand = false;
-bool wait_and_call = false;
-bool no_wait_and_call = false;
-bool no_a7_decodes = false;
-bool keep_frequency = false;
-bool keep_msk144_frequency = false;
-bool msk144qsy = false;
-bool keep_last_tx_label = false;
-int m_Nslots0 {1};
-int m_TxFreqFox {300};
-bool not_erase = false;
-bool first_Fox_alert = true;
-bool second_Fox_alert = true;
-bool no_Fox_alert = false;
-int Dpoints=0;
-int maxDPoints=0;
-int dBpoints=-28;
-int dBpoints2=99;
-int maxdBPoints=-28;
-int mindBPoints=99;
-bool pounce = false;
-bool filtered = false;
-bool ignored = false;
-bool selected = false;
-bool keepTx5 = false;
-bool no_logging = false;
-bool BlankLineInserted = false;
-bool m_txing;
-bool HoldTxFreqStatus;
-bool m_band_changed = false;
-bool m_muted = false;
-bool no_decodes_to_UDP = false;
-bool rigFailed = false;
-bool programStart = true;
-QString txLog;
-QString ignoreList;
-QString ALLCALL7 = "";
-QString m_hisCall0 = "";
-QString earlyDecodes = ""; //ft8md
-
-QSharedMemory mem_qmap("mem_qmap"); //Memory segment to be shared (optionally) with QMAP
-struct {
- int ndecodes; //Number of QMAP decodes available (so far)
- int ncand; //Number of QMAP candidates considered for decoding
- int nQDecoderDone; //QMAP decoder is finished (0 or 1)
- int nWDecoderBusy; //WSJT-X decoder is busy (0 or 1)
- int nWTransmitting; //WSJT-X is transmitting (0 or 1)
- int kHzRequested; //Integer kHz dial frequency requested from QMAP
- char result[50][72]; //Decodes as character*72 arrays
-} qmapcom;
-int* ipc_qmap;
-
-namespace
-{
- Radio::Frequency constexpr default_frequency {14074000};
- QRegExp message_alphabet {"[- @A-Za-z0-9+./?#<>;$]*"};
- // grid exact match excluding RR73
- QRegularExpression grid_regexp {"\\A(?![Rr]{2}73)[A-Ra-r]{2}[0-9]{2}([A-Xa-x]{2}){0,1}\\z"};
- QRegularExpression non_r_db_regexp {"\\A[-+]{1}[0-9]{1,2}\\z"};
- auto quint32_max = std::numeric_limits<quint32>::max ();
- constexpr int N_WIDGETS {38};
- constexpr int default_rx_audio_buffer_frames {-1}; // lets Qt decide
- constexpr int default_tx_audio_buffer_frames {-1}; // lets Qt decide
-
- bool message_is_73 (int type, QStringList const& msg_parts)
- {
- return type >= 0
- && (((type < 6 || 7 == type)
- && (msg_parts.contains ("73") || msg_parts.contains ("RR73")))
- || (type == 6 && !msg_parts.filter ("73").isEmpty ()));
- }
-
- int ms_minute_error ()
- {
- auto const& now = QDateTime::currentDateTimeUtc ();
- auto const& time = now.time ();
- auto second = time.second ();
- return now.msecsTo (now.addSecs (second > 30 ? 60 - second : -second)) - time.msec ();
- }
-}
-
-//--------------------------------------------------- MainWindow constructor
-MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
- MultiSettings * multi_settings, QSharedMemory *shdmem,
- unsigned downSampleFactor,
- QSplashScreen * splash, QProcessEnvironment const& env, QWidget *parent) :
- MultiGeometryWidget {parent},
- m_env {env},
- m_network_manager {this},
- m_valid {true},
- m_splash {splash},
- m_revision {revision ()},
- m_multiple {multiple},
- m_multi_settings {multi_settings},
- m_configurations_button {0},
- m_settings {multi_settings->settings ()},
- ui(new Ui::MainWindow),
- m_config {&m_network_manager, temp_directory, m_settings, &m_logBook, this},
- m_logBook {&m_config},
- m_cloudlog {&m_config, &m_network_manager},
- m_WSPR_band_hopping {m_settings, &m_config, this},
- m_WSPR_tx_next {false},
- m_rigErrorMessageBox {MessageBox::Critical, tr ("Rig Control Error")
- , MessageBox::Cancel | MessageBox::Ok | MessageBox::Retry},
- m_wideGraph (new WideGraph(m_settings)),
- m_echoGraph (new EchoGraph(m_settings)),
- m_fastGraph (new FastGraph(m_settings)),
- // no parent so that it has a taskbar icon
- m_logDlg (new LogQSO (program_title (), m_settings, &m_config, &m_logBook, nullptr)),
- m_lastDialFreq {0},
- m_dialFreqRxWSPR {0},
- m_detector {new Detector {RX_SAMPLE_RATE, double(NTMAX), downSampleFactor}},
- m_FFTSize {6192 / 2}, // conservative value to avoid buffer overruns
- m_soundInput {new SoundInput},
- m_modulator {new Modulator {TX_SAMPLE_RATE, NTMAX}},
- m_soundOutput {new SoundOutput},
- m_rx_audio_buffer_frames {0},
- m_tx_audio_buffer_frames {0},
- m_msErase {0},
- m_secBandChanged {0},
- m_msDecStarted {0}, //ft8md
- m_freqNominal {0},
- m_freqNominalPeriod {0},
- m_freqTxNominal {0},
- m_mslastTX {0}, //ft8md
- m_nlasttx {0}, //ft8md
- m_lapmyc {0}, //ft8md
- m_reverse_Doppler {"1" == env.value ("WSJT_REVERSE_DOPPLER", "0")},
- m_tRemaining {0.},
- m_TRperiod {60.0},
- m_DTtol {3.0},
- m_waterfallAvg {1},
- m_ntx {1},
- m_gen_message_is_cq {false},
- m_send_RR73 {false},
- m_XIT {0},
- m_ncandthin {100}, //ft8md
- m_nFT8Cycles {3}, //ft8md
- m_nFT8RXfSens {3} , //ft8md
- m_ft8threads {0}, //ft8md
- m_ft8Sensitivity {3}, //ft8md
- m_ft8DecoderStart {3}, //ft8md
- m_nsecBandChanged {0},//ft8md
- m_nFT4depth {3}, //ft8md
- m_sec0 {-1},
- m_RxLog {1}, //Write Date and Time to RxLog
- m_nutc0 {999999},
- m_ntr {0},
- m_tx {0},
- m_mslastMon {0},
- m_delay {0},
- m_inGain {0},
- m_secID {0},
- m_idleMinutes {0},
- m_nSubMode {0},
- m_nclearave {1},
- m_nWSPRdecodes {0},
- m_k0 {9999999},
- m_nPick {0},
- m_frequency_list_fcal_iter {m_config.frequencies ()->begin ()},
- m_nTx73 {0},
- m_position {0},
- m_btxok {false},
- m_diskData {false},
- m_loopall {false},
- m_txFirst {false},
- m_auto {false},
- m_restart {false},
- m_startAnother {false},
- m_skipTx1 {false}, //ft8md
- m_filter {false}, //ft8md
- m_agcc {false}, //ft8md
- m_hint {true}, //ft8md
- m_multithreadFT8 (false), //ft8md
- m_houndMode {false}, //ft8md
- m_commonFT8b {true}, //ft8md
- m_manualDecode (false), //ft8md
- m_modeChanged {false}, //ft8md
- m_multInst {false}, //ft8md
- m_saveDecoded {false},
- m_saveAll {false},
- m_widebandDecode {false},
- m_dataAvailable {false},
- m_decodedText2 {false},
- m_sentFirst73 {false},
- m_tci_mod_active {false}, // TCI
- m_tci {false}, // TCI
- m_tci_audio {false}, // TCI
- m_currentMessageType {-1},
- m_lastMessageType {-1},
- m_bShMsgs {false},
- m_bSWL {false},
- m_uploading {false},
- m_grid6 {false},
- m_tuneup {false},
- m_bTxTime {false},
- m_rxDone {true},
- m_bSimplex {false},
- m_bEchoTxOK {false},
- m_bTransmittedEcho {false},
- m_bEchoTxed {false},
- m_bFastDecodeCalled {false},
- m_bDoubleClickAfterCQnnn {false},
- m_bRefSpec {false},
- m_bClearRefSpec {false},
- m_bTrain {false},
- m_bAutoReply {false},
- m_lastloggedcall {""},
- m_QSOProgress {CALLING},
- m_ihsym {0},
- m_nzap {0},
- m_px {0.0},
- m_iptt0 {0},
- m_btxok0 {false},
- m_nsendingsh {0},
- m_onAirFreq0 {0.0},
- m_first_error {true},
- tx_status_label {tr ("Receiving")},
- wsprNet {new WSPRNet {&m_network_manager, this}},
- m_baseCall {Radio::base_callsign (m_config.my_callsign ())},
- m_appDir {QApplication::applicationDirPath ()},
- m_cqStr {""},
- m_palette {"Linrad"},
- m_mode {"FT8"},
- m_modeTx {"FT8"},
- m_rpt {"-15"},
- m_pfx {
- "1A", "1S",
- "3A", "3B6", "3B8", "3B9", "3C", "3C0", "3D2", "3D2C",
- "3D2R", "3DA", "3V", "3W", "3X", "3Y", "3YB", "3YP",
- "4J", "4L", "4S", "4U1I", "4U1U", "4W", "4X",
- "5A", "5B", "5H", "5N", "5R", "5T", "5U", "5V", "5W", "5X", "5Z",
- "6W", "6Y",
- "7O", "7P", "7Q", "7X",
- "8P", "8Q", "8R",
- "9A", "9G", "9H", "9J", "9K", "9L", "9M2", "9M6", "9N",
- "9Q", "9U", "9V", "9X", "9Y",
- "A2", "A3", "A4", "A5", "A6", "A7", "A9", "AP",
- "BS7", "BV", "BV9", "BY",
- "C2", "C3", "C5", "C6", "C9", "CE", "CE0X", "CE0Y",
- "CE0Z", "CE9", "CM", "CN", "CP", "CT", "CT3", "CU",
- "CX", "CY0", "CY9",
- "D2", "D4", "D6", "DL", "DU",
- "E3", "E4", "E5", "EA", "EA6", "EA8", "EA9", "EI", "EK",
- "EL", "EP", "ER", "ES", "ET", "EU", "EX", "EY", "EZ",
- "F", "FG", "FH", "FJ", "FK", "FKC", "FM", "FO", "FOA",
- "FOC", "FOM", "FP", "FR", "FRG", "FRJ", "FRT", "FT5W",
- "FT5X", "FT5Z", "FW", "FY",
- "M", "MD", "MI", "MJ", "MM", "MU", "MW",
- "H4", "H40", "HA", "HB", "HB0", "HC", "HC8", "HH",
- "HI", "HK", "HK0", "HK0M", "HL", "HM", "HP", "HR",
- "HS", "HV", "HZ",
- "I", "IS", "IS0",
- "J2", "J3", "J5", "J6", "J7", "J8", "JA", "JDM",
- "JDO", "JT", "JW", "JX", "JY",
- "K", "KC4", "KG4", "KH0", "KH1", "KH2", "KH3", "KH4", "KH5",
- "KH5K", "KH6", "KH7", "KH8", "KH9", "KL", "KP1", "KP2",
- "KP4", "KP5",
- "LA", "LU", "LX", "LY", "LZ",
- "OA", "OD", "OE", "OH", "OH0", "OJ0", "OK", "OM", "ON",
- "OX", "OY", "OZ",
- "P2", "P4", "PA", "PJ2", "PJ7", "PY", "PY0F", "PT0S", "PY0T", "PZ",
- "R1F", "R1M",
- "S0", "S2", "S5", "S7", "S9", "SM", "SP", "ST", "SU",
- "SV", "SVA", "SV5", "SV9",
- "T2", "T30", "T31", "T32", "T33", "T5", "T7", "T8", "T9", "TA",
- "TF", "TG", "TI", "TI9", "TJ", "TK", "TL", "TN", "TR", "TT",
- "TU", "TY", "TZ",
- "UA", "UA2", "UA9", "UK", "UN", "UR",
- "V2", "V3", "V4", "V5", "V6", "V7", "V8", "VE", "VK", "VK0H",
- "VK0M", "VK9C", "VK9L", "VK9M", "VK9N", "VK9W", "VK9X", "VP2E",
- "VP2M", "VP2V", "VP5", "VP6", "VP6D", "VP8", "VP8G", "VP8H",
- "VP8O", "VP8S", "VP9", "VQ9", "VR", "VU", "VU4", "VU7",
- "XE", "XF4", "XT", "XU", "XW", "XX9", "XZ",
- "YA", "YB", "YI", "YJ", "YK", "YL", "YN", "YO", "YS", "YU", "YV", "YV0",
- "Z2", "Z3", "ZA", "ZB", "ZC4", "ZD7", "ZD8", "ZD9", "ZF", "ZK1N",
- "ZK1S", "ZK2", "ZK3", "ZL", "ZL7", "ZL8", "ZL9", "ZP", "ZS", "ZS8"
- },
- m_sfx {"P", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A"},
- mem_jt9 {shdmem},
- m_downSampleFactor (downSampleFactor),
- m_audioThreadPriority (QThread::HighPriority),
- m_bandEdited {false},
- m_splitMode {false},
- m_monitoring {false},
- m_tx_when_ready {false},
- m_transmitting {false},
- m_tune {false},
- m_tx_watchdog {false},
- m_block_pwr_tooltip {false},
- m_PwrBandSetOK {true},
- m_lastMonitoredFrequency {default_frequency},
- m_toneSpacing {0.},
- m_firstDecode {0},
- m_optimizingProgress {"Optimizing decoder FFTs for your CPU.\n"
- "Please be patient,\n"
- "this may take a few minutes", QString {}, 0, 1, this},
- m_messageClient {new MessageClient {QApplication::applicationName (),
- version (), revision (),
- m_config.udp_server_name (), m_config.udp_server_port (),
- m_config.udp_interface_names (), m_config.udp_TTL (),
- this}},
- m_psk_Reporter {&m_config, QString {"WSJT-X v" + version () + " " + m_revision}.simplified ()},
- m_manual {&m_network_manager},
- m_block_udp_status_updates {false},
- m_useDarkStyle {false}
-{
- ui->setupUi(this);
- setUnifiedTitleAndToolBarOnMac (true);
- createStatusBar();
- add_child_to_event_filter (this);
- ui->dxGridEntry->setValidator (new MaidenheadLocatorValidator {this});
- ui->dxCallEntry->setValidator (new CallsignValidator {this});
- ui->sbTR->values ({5, 10, 15, 30, 60, 120, 300, 900, 1800});
- ui->sbTR_FST4W->values ({120, 300, 900, 1800});
- ui->decodedTextBrowser->set_configuration (&m_config, true);
- ui->decodedTextBrowser2->set_configuration (&m_config);
-
- m_optimizingProgress.setWindowModality (Qt::WindowModal);
- m_optimizingProgress.setAutoReset (false);
- m_optimizingProgress.setMinimumDuration (15000); // only show after 15s delay
-
- //Attach or create a memory segment to be shared with QMAP.
- int memSize=4096;
- if(!mem_qmap.attach()) mem_qmap.create(memSize);
- ipc_qmap = (int*)mem_qmap.data();
- mem_qmap.lock();
- memset(ipc_qmap,0,memSize); //Zero all of QMAP shared memory
- mem_qmap.unlock();
-
- // Closedown.
- connect (ui->actionExit, &QAction::triggered, this, &QMainWindow::close);
-
- // parts of the rig error message box that are fixed
- m_rigErrorMessageBox.setInformativeText (tr ("Do you want to reconfigure the radio interface?"));
- m_rigErrorMessageBox.setDefaultButton (MessageBox::Ok);
-
- // start audio thread and hook up slots & signals for shutdown management
- // these objects need to be in the audio thread so that invoking
- // their slots is done in a thread safe way
- m_soundOutput->moveToThread (&m_audioThread);
- m_modulator->moveToThread (&m_audioThread);
- m_soundInput->moveToThread (&m_audioThread);
- m_detector->moveToThread (&m_audioThread);
- bool ok;
- auto buffer_size = env.value ("WSJT_RX_AUDIO_BUFFER_FRAMES", "0").toInt (&ok);
- m_rx_audio_buffer_frames = ok && buffer_size ? buffer_size : default_rx_audio_buffer_frames;
- buffer_size = env.value ("WSJT_TX_AUDIO_BUFFER_FRAMES", "0").toInt (&ok);
- m_tx_audio_buffer_frames = ok && buffer_size ? buffer_size : default_tx_audio_buffer_frames;
-
- // hook up sound output stream slots & signals and disposal
- connect (this, &MainWindow::initializeAudioOutputStream, m_soundOutput, &SoundOutput::setFormat);
- connect (m_soundOutput, &SoundOutput::error, this, &MainWindow::showSoundOutError);
- connect (m_soundOutput, &SoundOutput::error, &m_config, &Configuration::invalidate_audio_output_device);
- // connect (m_soundOutput, &SoundOutput::status, this, &MainWindow::showStatusMessage);
- connect (this, &MainWindow::outAttenuationChanged, m_soundOutput, &SoundOutput::setAttenuation);
- connect (&m_audioThread, &QThread::finished, m_soundOutput, &QObject::deleteLater);
-
- // hook up Modulator slots and disposal
- connect (this, &MainWindow::transmitFrequency, m_modulator, &Modulator::setFrequency);
- connect (this, &MainWindow::endTransmitMessage, m_modulator, &Modulator::stop);
- connect (this, &MainWindow::tune, m_modulator, &Modulator::tune);
- connect (this, &MainWindow::sendMessage, m_modulator, &Modulator::start);
- connect (&m_audioThread, &QThread::finished, m_modulator, &QObject::deleteLater);
-
- // hook up the audio input stream signals, slots and disposal
- connect (this, &MainWindow::startAudioInputStream, m_soundInput, &SoundInput::start);
- connect (this, &MainWindow::suspendAudioInputStream, m_soundInput, &SoundInput::suspend);
- connect (this, &MainWindow::resumeAudioInputStream, m_soundInput, &SoundInput::resume);
- connect (this, &MainWindow::reset_audio_input_stream, m_soundInput, &SoundInput::reset);
- connect (this, &MainWindow::finished, m_soundInput, &SoundInput::stop);
- connect(m_soundInput, &SoundInput::error, this, &MainWindow::showSoundInError);
- connect(m_soundInput, &SoundInput::error, &m_config, &Configuration::invalidate_audio_input_device);
- // connect(m_soundInput, &SoundInput::status, this, &MainWindow::showStatusMessage);
- connect (&m_audioThread, &QThread::finished, m_soundInput, &QObject::deleteLater);
-
- connect (this, &MainWindow::finished, this, &MainWindow::close);
-
- // hook up the detector signals, slots and disposal
- connect (this, &MainWindow::FFTSize, m_detector, &Detector::setBlockSize);
- connect(m_detector, &Detector::framesWritten, this, &MainWindow::dataSink);
- connect (&m_audioThread, &QThread::finished, m_detector, &QObject::deleteLater);
-
- // setup the waterfall
- connect(m_wideGraph.data (), SIGNAL(freezeDecode2(int)),this,SLOT(freezeDecode(int)));
- connect(m_wideGraph.data (), SIGNAL(f11f12(int)),this,SLOT(bumpFqso(int)));
- connect(m_wideGraph.data (), SIGNAL(setXIT2(int)),this,SLOT(setXIT(int)));
-
- connect (m_fastGraph.data (), &FastGraph::fastPick, this, &MainWindow::fastPick);
-
- connect (this, &MainWindow::finished, m_wideGraph.data (), &WideGraph::close);
- connect (this, &MainWindow::finished, m_echoGraph.data (), &EchoGraph::close);
- connect (this, &MainWindow::finished, m_fastGraph.data (), &FastGraph::close);
-
- // setup the log QSO dialog
- connect (m_logDlg.data (), &LogQSO::acceptQSO, this, &MainWindow::acceptQSO);
- connect (this, &MainWindow::finished, m_logDlg.data (), &LogQSO::close);
-
- // hook up the log book
- connect (&m_logBook, &LogBook::finished_loading, [this] (int record_count, QString cty_version, QString const& error) {
- if (error.size ())
- {
- MessageBox::warning_message (this, tr ("Error Scanning ADIF Log"), error);
- }
- else
- {
- m_config.set_CTY_DAT_version(cty_version);
- showStatusMessage (tr ("Scanned ADIF log, %1 worked-before records created. CTY: %2").arg (record_count).arg (cty_version));
- }
- });
-
- // Network message handlers
- m_messageClient->enable (m_config.accept_udp_requests ());
- connect (m_messageClient, &MessageClient::clear_decodes, [this] (quint8 window) {
- ++window;
- if (window & 1)
- {
- ui->decodedTextBrowser->erase ();
- }
- if (window & 2)
- {
- ui->decodedTextBrowser2->erase ();
- }
- });
- connect (m_messageClient, &MessageClient::reply, this, &MainWindow::replyToCQ);
- connect (m_messageClient, &MessageClient::close, this, &MainWindow::close);
- connect (m_messageClient, &MessageClient::replay, this, &MainWindow::replayDecodes);
- connect (m_messageClient, &MessageClient::location, this, &MainWindow::locationChange);
- connect (m_messageClient, &MessageClient::halt_tx, [this] (bool auto_only) {
- if (auto_only) {
- if (ui->autoButton->isChecked ()) {
- ui->autoButton->click();
- }
- } else {
- ui->stopTxButton->click();
- }
- });
- connect (m_messageClient, &MessageClient::error, this, &MainWindow::networkError);
- connect (m_messageClient, &MessageClient::free_text, [this] (QString const& text, bool send) {
- tx_watchdog (false);
- // send + non-empty text means set and send the free text
- // message, !send + non-empty text means set the current free
- // text message, send + empty text means send the current free
- // text message without change, !send + empty text means clear
- // the current free text message
- if (0 == ui->tabWidget->currentIndex ()) {
- if (!text.isEmpty ()) {
- ui->tx5->setCurrentText (text);
- }
- if (send) {
- ui->txb5->click ();
- } else if (text.isEmpty ()) {
- ui->tx5->setCurrentText (text);
- }
- }
- QApplication::alert (this);
- });
-
- connect (m_messageClient, &MessageClient::highlight_callsign, ui->decodedTextBrowser, &DisplayText::highlight_callsign);
- connect (m_messageClient, &MessageClient::switch_configuration, m_multi_settings, &MultiSettings::select_configuration);
- connect (m_messageClient, &MessageClient::configure, this, &MainWindow::remote_configure);
-
- // Hook up WSPR band hopping
- connect (ui->band_hopping_schedule_push_button, &QPushButton::clicked
- , &m_WSPR_band_hopping, &WSPRBandHopping::show_dialog);
- connect (ui->sbTxPercent, static_cast<void (QSpinBox::*) (int)> (&QSpinBox::valueChanged)
- , &m_WSPR_band_hopping, &WSPRBandHopping::set_tx_percent);
-
- on_EraseButton_clicked ();
-
- QActionGroup* modeGroup = new QActionGroup(this);
- ui->actionFST4->setActionGroup(modeGroup);
- ui->actionFST4W->setActionGroup(modeGroup);
- ui->actionFT4->setActionGroup(modeGroup);
- ui->actionFT8->setActionGroup(modeGroup);
- ui->actionJT9->setActionGroup(modeGroup);
- ui->actionJT65->setActionGroup(modeGroup);
- ui->actionJT4->setActionGroup(modeGroup);
- ui->actionWSPR->setActionGroup(modeGroup);
- ui->actionEcho->setActionGroup(modeGroup);
- ui->actionMSK144->setActionGroup(modeGroup);
- ui->actionQ65->setActionGroup(modeGroup);
- ui->actionFreqCal->setActionGroup(modeGroup);
-
- QActionGroup* saveGroup = new QActionGroup(this);
- ui->actionNone->setActionGroup(saveGroup);
- ui->actionSave_decoded->setActionGroup(saveGroup);
- ui->actionSave_all->setActionGroup(saveGroup);
-
- QActionGroup* alltxtGroup = new QActionGroup(this);
- ui->actionDon_t_split_ALL_TXT->setActionGroup(alltxtGroup);
- ui->actionSplit_ALL_TXT_yearly->setActionGroup(alltxtGroup);
- ui->actionSplit_ALL_TXT_monthly->setActionGroup(alltxtGroup);
- ui->actionDisable_writing_of_ALL_TXT->setActionGroup(alltxtGroup);
-
- QActionGroup* EventLoggingGroup = new QActionGroup(this);
- ui->actionDefault_event_logging->setActionGroup(EventLoggingGroup);
- ui->actionDiagnostic_mode->setActionGroup(EventLoggingGroup);
- ui->actionDisable_event_logging->setActionGroup(EventLoggingGroup);
-
- QActionGroup* DepthGroup = new QActionGroup(this);
- ui->actionQuickDecode->setActionGroup(DepthGroup);
- ui->actionMediumDecode->setActionGroup(DepthGroup);
- ui->actionDeepestDecode->setActionGroup(DepthGroup);
-
- QActionGroup* FT8CyclesGroup = new QActionGroup(this);
- ui->actionDecFT8cycles1->setActionGroup(FT8CyclesGroup);
- ui->actionDecFT8cycles2->setActionGroup(FT8CyclesGroup);
- ui->actionDecFT8cycles3->setActionGroup(FT8CyclesGroup);
-
- QActionGroup* FT8RXfreqSensitivityGroup = new QActionGroup(this);
- ui->actionRXfLow->setActionGroup(FT8RXfreqSensitivityGroup);
- ui->actionRXfMedium->setActionGroup(FT8RXfreqSensitivityGroup);
- ui->actionRXfHigh->setActionGroup(FT8RXfreqSensitivityGroup);
-
- QActionGroup* FT8DecoderSensitivityGroup = new QActionGroup(this);
- ui->actionFT8SensMin->setActionGroup(FT8DecoderSensitivityGroup);
- ui->actionlowFT8thresholds->setActionGroup(FT8DecoderSensitivityGroup);
- ui->actionFT8subpass->setActionGroup(FT8DecoderSensitivityGroup);
-
- QActionGroup* FT8DecoderStartGroup = new QActionGroup(this);
- ui->actionStartTwoStage->setActionGroup(FT8DecoderStartGroup);
- ui->actionStartThreeStage->setActionGroup(FT8DecoderStartGroup);
- ui->actionStartEarly->setActionGroup(FT8DecoderStartGroup);
- ui->actionStartNormal->setActionGroup(FT8DecoderStartGroup);
- ui->actionStartLate->setActionGroup(FT8DecoderStartGroup);
-
- QActionGroup* FT8threadsGroup = new QActionGroup(this);
- ui->actionMTAuto->setActionGroup(FT8threadsGroup);
- ui->actionMT1->setActionGroup(FT8threadsGroup);
- ui->actionMT2->setActionGroup(FT8threadsGroup);
- ui->actionMT3->setActionGroup(FT8threadsGroup);
- ui->actionMT4->setActionGroup(FT8threadsGroup);
- ui->actionMT5->setActionGroup(FT8threadsGroup);
- ui->actionMT6->setActionGroup(FT8threadsGroup);
- ui->actionMT7->setActionGroup(FT8threadsGroup);
- ui->actionMT8->setActionGroup(FT8threadsGroup);
- ui->actionMT9->setActionGroup(FT8threadsGroup);
- ui->actionMT10->setActionGroup(FT8threadsGroup);
- ui->actionMT11->setActionGroup(FT8threadsGroup);
- ui->actionMT12->setActionGroup(FT8threadsGroup);
-
- connect (ui->download_samples_action, &QAction::triggered, [this] () {
- if (!m_sampleDownloader)
- {
- m_sampleDownloader.reset (new SampleDownloader {m_settings, &m_config, &m_network_manager, this});
- }
- m_sampleDownloader->show ();
- });
-
- connect (ui->view_phase_response_action, &QAction::triggered, [this] () {
- if (!m_equalizationToolsDialog)
- {
- m_equalizationToolsDialog.reset (new EqualizationToolsDialog {m_settings, m_config.writeable_data_dir (), m_phaseEqCoefficients, this});
- connect (m_equalizationToolsDialog.data (), &EqualizationToolsDialog::phase_equalization_changed,
- [this] (QVector<double> const& coeffs) {
- m_phaseEqCoefficients = coeffs;
- });
- }
- m_equalizationToolsDialog->show ();
- });
-
- connect (&m_config.lotw_users (), &LotWUsers::LotW_users_error, this, [this] (QString const& reason) {
- MessageBox::warning_message (this, tr ("Error Loading LotW Users Data"), reason);
- }, Qt::QueuedConnection);
-
- QButtonGroup* txMsgButtonGroup = new QButtonGroup {this};
- txMsgButtonGroup->addButton(ui->txrb1,1);
- txMsgButtonGroup->addButton(ui->txrb2,2);
- txMsgButtonGroup->addButton(ui->txrb3,3);
- txMsgButtonGroup->addButton(ui->txrb4,4);
- txMsgButtonGroup->addButton(ui->txrb5,5);
- txMsgButtonGroup->addButton(ui->txrb6,6);
- set_dateTimeQSO(-1);
- connect(txMsgButtonGroup,SIGNAL(buttonClicked(int)),SLOT(set_ntx(int)));
- connect (ui->decodedTextBrowser, &DisplayText::selectCallsign, this, &MainWindow::doubleClickOnCall2);
- connect (ui->decodedTextBrowser2, &DisplayText::selectCallsign, this, &MainWindow::doubleClickOnCall);
- connect (ui->houndQueueTextBrowser, &DisplayText::selectCallsign, this, &MainWindow::doubleClickOnFoxQueue);
- connect (ui->foxTxListTextBrowser, &DisplayText::selectCallsign, this, &MainWindow::doubleClickOnFoxInProgress);
- connect (ui->decodedTextBrowser, &DisplayText::erased, this, &MainWindow::band_activity_cleared);
- connect (ui->decodedTextBrowser2, &DisplayText::erased, this, &MainWindow::rx_frequency_activity_cleared);
- connect (ui->decodedTextBrowser->horizontalScrollBar(),SIGNAL(sliderMoved(int)),SLOT(ScrollBarPosition(int)));
-
- // initialize decoded text font and hook up font change signals
- // defer initialization until after construction otherwise menu fonts do not get set
- // with 50 ms delay we are on the safe side
- QTimer::singleShot (50, this, SLOT (initialize_fonts ()));
- connect (&m_config, &Configuration::text_font_changed, [this] (QFont const& font) {
- set_application_font (font);
- });
- connect (&m_config, &Configuration::decoded_text_font_changed, [this] (QFont const& font) {
- setDecodedTextFont (font);
- });
-
- setWindowTitle (program_title ());
-
- connect(&proc_jt9, &QProcess::readyReadStandardOutput, this, &MainWindow::readFromStdout);
-#if QT_VERSION < QT_VERSION_CHECK (5, 6, 0)
- connect(&proc_jt9, static_cast<void (QProcess::*) (QProcess::ProcessError)> (&QProcess::error),
- [this] (QProcess::ProcessError error) {
- subProcessError (&proc_jt9, error);
- });
-#else
- connect(&proc_jt9, &QProcess::errorOccurred, [this] (QProcess::ProcessError error) {
- subProcessError (&proc_jt9, error);
- });
-#endif
- connect(&proc_jt9, static_cast<void (QProcess::*) (int, QProcess::ExitStatus)> (&QProcess::finished),
- [this] (int exitCode, QProcess::ExitStatus status) {
- if (subProcessFailed (&proc_jt9, exitCode, status))
- {
- m_valid = false; // ensures exit if still
- // constructing
- QTimer::singleShot (0, this, SLOT (close ()));
- }
- });
- connect(&p1, &QProcess::started, [this] () {
- showStatusMessage (QString {"Started: %1 \"%2\""}.arg (p1.program ()).arg (p1.arguments ().join ("\" \"")));
- });
- connect(&p1, &QProcess::readyReadStandardOutput, this, &MainWindow::p1ReadFromStdout);
-#if QT_VERSION < QT_VERSION_CHECK (5, 6, 0)
- connect(&p1, static_cast<void (QProcess::*) (QProcess::ProcessError)> (&QProcess::error),
- [this] (QProcess::ProcessError error) {
- subProcessError (&p1, error);
- });
-#else
- connect(&p1, &QProcess::errorOccurred, [this] (QProcess::ProcessError error) {
- subProcessError (&p1, error);
- });
-#endif
- connect(&p1, static_cast<void (QProcess::*) (int, QProcess::ExitStatus)> (&QProcess::finished),
- [this] (int exitCode, QProcess::ExitStatus status) {
- if (subProcessFailed (&p1, exitCode, status))
- {
- m_valid = false; // ensures exit if still
- // constructing
- QTimer::singleShot (0, this, SLOT (close ()));
- }
- });
-
-#if QT_VERSION < QT_VERSION_CHECK (5, 6, 0)
- connect(&p3, static_cast<void (QProcess::*) (QProcess::ProcessError)> (&QProcess::error),
- [this] (QProcess::ProcessError error) {
-#else
- connect(&p3, &QProcess::errorOccurred, [this] (QProcess::ProcessError error) {
-#endif
-#if !defined(Q_OS_WIN)
- if (QProcess::FailedToStart != error)
-#else
- if (QProcess::Crashed != error)
-#endif
- {
- subProcessError (&p3, error);
- }
- });
- connect(&p3, &QProcess::started, [this] () {
- showStatusMessage (QString {"Started: %1 \"%2\""}.arg (p3.program ()).arg (p3.arguments ().join ("\" \"")));
- });
- connect(&p3, static_cast<void (QProcess::*) (int, QProcess::ExitStatus)> (&QProcess::finished),
- [this] (int exitCode, QProcess::ExitStatus status) {
-#if defined(Q_OS_WIN)
- // We forgo detecting user_hardware failures with exit
- // code 1 on Windows. This is because we use CMD.EXE to
- // run the executable. CMD.EXE returns exit code 1 when it
- // can't find the target executable.
- if (exitCode != 1) // CMD.EXE couldn't find file to execute
-#else
- // We forgo detecting user_hardware failures with exit
- // code 127 non-Windows. This is because we use /bin/sh to
- // run the executable. /bin/sh returns exit code 127 when it
- // can't find the target executable.
- if (exitCode != 127) // /bin/sh couldn't find file to execute
-#endif
- {
- subProcessFailed (&p3, exitCode, status);
- }
- });
-
- // hook up save WAV file exit handling
- connect (&m_saveWAVWatcher, &QFutureWatcher<QString>::finished, [this] {
- // extract the promise from the future
- auto const& result = m_saveWAVWatcher.future ().result ();
- if (!result.isEmpty ()) // error
- {
- MessageBox::critical_message (this, tr("Error Writing WAV File"), result);
- }
- });
-
- // Hook up working frequencies.
- ui->bandComboBox->setModel (m_config.frequencies ());
- ui->bandComboBox->setModelColumn (FrequencyList_v2_101::frequency_mhz_column);
-
- // Enable live band combo box entry validation and action.
- auto band_validator = new LiveFrequencyValidator {ui->bandComboBox
- , m_config.bands ()
- , m_config.frequencies ()
- , &m_freqNominal
- , m_config.kHz_without_k ()
- , this};
- ui->bandComboBox->setValidator (band_validator);
-
- // Hook up signals.
- connect (band_validator, &LiveFrequencyValidator::valid, this, &MainWindow::band_changed);
- connect (ui->bandComboBox->lineEdit (), &QLineEdit::textEdited, [this] (QString const&) {m_bandEdited = true;});
-
- // hook up configuration signals
- connect (&m_config, &Configuration::leavingSettings, this, &MainWindow::handle_leavingSettings);
- connect (&m_config, &Configuration::transceiver_update, this, &MainWindow::handle_transceiver_update);
- connect (&m_config, &Configuration::transceiver_TCIframesWritten, this, &MainWindow::dataSink);
- connect (&m_config, &Configuration::transceiver_TCImodActive, this, &MainWindow::tci_mod_active);
- connect (&m_config, &Configuration::transceiver_failure, this, &MainWindow::handle_transceiver_failure);
- connect (&m_config, &Configuration::udp_server_changed, m_messageClient, &MessageClient::set_server);
- connect (&m_config, &Configuration::udp_server_port_changed, m_messageClient, &MessageClient::set_server_port);
- connect (&m_config, &Configuration::udp_TTL_changed, m_messageClient, &MessageClient::set_TTL);
- connect (&m_config, &Configuration::accept_udp_requests_changed, m_messageClient, &MessageClient::enable);
- connect (&m_config, &Configuration::enumerating_audio_devices, [this] () {
- showStatusMessage (tr ("Enumerating audio devices"));
- });
-
- // set up configurations menu
- connect (m_multi_settings, &MultiSettings::configurationNameChanged, [this] (QString const& name) {
- if ("Default" != name) {
- config_label.setText (name);
- config_label.show ();
- }
- else {
- config_label.hide ();
- }
- statusUpdate ();
-#if defined(Q_OS_WIN)
- QTimer::singleShot (250, [=] {
- setRig (m_lastMonitoredFrequency); // This is needed for Hamradio Deluxe
- m_msk144basefreq = m_lastMonitoredFrequency; // This is needed for Hamradio Deluxe
- });
-#endif
- });
- m_multi_settings->create_menu_actions (this, ui->menuConfig);
- m_configurations_button = m_rigErrorMessageBox.addButton (tr ("Configurations...")
- , QMessageBox::ActionRole);
-
- // set up message text validators
- ui->tx1->setValidator (new QRegExpValidator {message_alphabet, this});
- ui->tx2->setValidator (new QRegExpValidator {message_alphabet, this});
- ui->tx3->setValidator (new QRegExpValidator {message_alphabet, this});
- ui->tx4->setValidator (new QRegExpValidator {message_alphabet, this});
- ui->tx5->setValidator (new QRegExpValidator {message_alphabet, this});
- ui->tx6->setValidator (new QRegExpValidator {message_alphabet, this});
-
- // Free text macros model to widget hook up.
- ui->tx5->setModel (m_config.macros ());
- connect (ui->tx5->lineEdit(), &QLineEdit::editingFinished,
- [this] () {on_tx5_currentTextChanged (ui->tx5->lineEdit()->text());});
- connect(&m_guiTimer, &QTimer::timeout, this, &MainWindow::guiUpdate);
- m_guiTimer.start(100); //### Don't change the 100 ms! ###
-
- stopWRTimer.setSingleShot(true);
- connect(&stopWRTimer, &QTimer::timeout, this, &MainWindow::stopWRTimeout);
-
- stopWCTimer.setSingleShot(true);
- connect(&stopWCTimer, &QTimer::timeout, this, &MainWindow::stopWCTimeout);
-
- ptt0Timer.setSingleShot(true);
- connect(&ptt0Timer, &QTimer::timeout, this, &MainWindow::stopTx2);
-
- ptt1Timer.setSingleShot(true);
- connect(&ptt1Timer, &QTimer::timeout, this, &MainWindow::startTx2);
-
- p1Timer.setSingleShot(true);
- connect(&p1Timer, &QTimer::timeout, this, &MainWindow::startP1);
-
- logQSOTimer.setSingleShot(true);
- connect(&logQSOTimer, &QTimer::timeout, this, &MainWindow::on_logQSOButton_clicked);
-
- tuneButtonTimer.setSingleShot(true);
- connect(&tuneButtonTimer, &QTimer::timeout, this, &MainWindow::end_tuning);
-
- tuneATU_Timer.setSingleShot(true);
- connect(&tuneATU_Timer, &QTimer::timeout, this, &MainWindow::stopTuneATU);
-
- killFileTimer.setSingleShot(true);
- connect(&killFileTimer, &QTimer::timeout, this, &MainWindow::killFile);
-
- uploadTimer.setSingleShot(true);
- connect(&uploadTimer, &QTimer::timeout, [this] () {uploadWSPRSpots ();});
-
- TxAgainTimer.setSingleShot(true);
- connect(&TxAgainTimer, SIGNAL(timeout()), this, SLOT(TxAgain()));
-
- connect(m_wideGraph.data (), SIGNAL(setFreq3(int,int)),this,
- SLOT(setFreq4(int,int)));
-
- decodeBusy(false);
-
- m_msg[0][0]=0;
-
- char const * const power[] = {"1 mW","2 mW","5 mW","10 mW","20 mW","50 mW","100 mW","200 mW","500 mW",
- "1 W","2 W","5 W","10 W","20 W","50 W","100 W","200 W","500 W","1 kW"};
- for(auto i = 0u; i < sizeof power / sizeof power[0]; ++i) { //Initialize dBm values
- auto dBm = int ((10. * i / 3.) + .5);
- ui->TxPowerComboBox->addItem (QString {"%1 dBm %2"}.arg (dBm).arg (power[i]), dBm);
- }
- ui->respondComboBox->addItem("CQ: None");
- ui->respondComboBox->addItem("CQ: First");
- ui->respondComboBox->addItem("CQ: Max Dist");
- ui->respondComboBox->addItem("CQ: Max dB");
- ui->respondComboBox->addItem("CQ: Min dB");
-
- m_dateTimeRcvdRR73=QDateTime::currentDateTimeUtc();
- m_dateTimeSentTx3=QDateTime::currentDateTimeUtc();
-
- ui->labAz->setStyleSheet("border: 0px;");
- ui->labAz->setText("");
- auto t = "UTC dB DT Freq " + tr ("Message");
- ui->lh_decodes_headings_label->setText(t);
- ui->rh_decodes_headings_label->setText(t);
- readSettings(); //Restore user's setup parameters
- if(m_mode=="Q65") {
- m_score=0;
- read_log();
- }
- m_audioThread.start (m_audioThreadPriority);
-
-#ifdef WIN32
- if (!m_multiple)
- {
- while(true)
- {
- int iret=killbyname("jt9.exe");
- if(iret == 603) break;
- if(iret != 0)
- MessageBox::warning_message (this, tr ("Error Killing jt9.exe Process")
- , tr ("KillByName return code: %1")
- .arg (iret));
- }
- }
-#endif
-
- {
- //delete any .quit file that might have been left lying around
- //since its presence will cause jt9 to exit a soon as we start it
- //and decodes will hang
- QFile quitFile {m_config.temp_dir ().absoluteFilePath (".quit")};
- while (quitFile.exists ())
- {
- if (!quitFile.remove ())
- {
- MessageBox::query_message (this, tr ("Error removing \"%1\"").arg (quitFile.fileName ())
- , tr ("Click OK to retry"));
- }
- }
- }
-
- to_jt9(0,0,0); //initialize IPC variables
-
- QStringList jt9_args {
- "-s", QApplication::applicationName () // shared memory key,
- // includes rig
-#ifdef NDEBUG
- , "-w", "1" //FFTW patience - release
-#else
- , "-w", "1" //FFTW patience - debug builds for speed
-#endif
- // The number of threads for FFTW specified here is chosen as
- // three because that gives the best throughput of the large
- // FFTs used in jt9. The count is the minimum of (the number
- // available CPU threads less one) and three. This ensures that
- // there is always at least one free CPU thread to run the other
- // mode decoder in parallel.
- , "-m", QString::number (qMin (qMax (QThread::idealThreadCount () - 1, 1), 3)) //FFTW threads
-
- , "-e", QDir::toNativeSeparators (m_appDir)
- , "-a", QDir::toNativeSeparators (m_config.writeable_data_dir ().absolutePath ())
- , "-t", QDir::toNativeSeparators (m_config.temp_dir ().absolutePath ())
- };
- QProcessEnvironment new_env {m_env};
- new_env.insert ("OMP_STACKSIZE", "10M");
- proc_jt9.setProcessEnvironment (new_env);
- proc_jt9.start(QDir::toNativeSeparators (m_appDir) + QDir::separator () +
- "jt9", jt9_args, QIODevice::ReadWrite | QIODevice::Unbuffered);
-
- auto fname {QDir::toNativeSeparators(m_config.writeable_data_dir ().absoluteFilePath ("wsjtx_wisdom.dat"))};
- fftwf_import_wisdom_from_filename (fname.toLocal8Bit ());
-
- m_ntx = 6;
- ui->txrb6->setChecked(true);
-
- connect (&m_wav_future_watcher, &QFutureWatcher<void>::finished, this, &MainWindow::diskDat);
-
- connect(&watcher3, SIGNAL(finished()),this,SLOT(fast_decode_done()));
-
- m_tci = m_config.is_tci();
- m_tci_audio = (m_config.tci_audio() && m_config.is_tci());
-
- if (!m_tci_audio) {
- if (!m_config.audio_input_device ().isNull ())
- {
- Q_EMIT startAudioInputStream (m_config.audio_input_device ()
- , m_rx_audio_buffer_frames
- , m_detector, m_downSampleFactor, m_config.audio_input_channel ());
- }
- if (!m_config.audio_output_device ().isNull ())
- {
- Q_EMIT initializeAudioOutputStream (m_config.audio_output_device ()
- , AudioDevice::Mono == m_config.audio_output_channel () ? 1 : 2
- , m_tx_audio_buffer_frames);
- }
- Q_EMIT transmitFrequency (ui->TxFreqSpinBox->value () - m_XIT);
- }
-
- enable_DXCC_entity (m_config.DXCC ()); // sets text window proportions and (re)inits the logbook
-
- // this must be done before initializing the mode as some modes need
- // to turn off split on the rig e.g. WSPR
- m_config.transceiver_online ();
- bool vhf {m_config.enable_VHF_features ()};
-
- ui->txFirstCheckBox->setChecked(m_txFirst);
- morse_(const_cast<char *> (m_config.my_callsign ().toLatin1().constData()),
- const_cast<int *> (icw), &m_ncw, (FCL)m_config.my_callsign().length());
- on_actionWide_Waterfall_triggered();
- ui->cbShMsgs->setChecked(m_bShMsgs);
- ui->cbSWL->setChecked(m_bSWL);
- if(m_bFast9) m_bFastMode=true;
- ui->cbFast9->setChecked(m_bFast9 or m_bFastMode);
-
- set_mode (m_mode);
- if(m_mode=="Echo") monitor(false); //Don't auto-start Monitor in Echo mode.
-
- // Ensure that the correct frequency is set and displayed
- if(m_mode=="Echo") {
- QTimer::singleShot (5000, [=] {
- auto const& row = m_config.frequencies ()->best_working_frequency (m_freqNominal);
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0) on_bandComboBox_activated (row);
- if (m_monitoring) ui->monitorButton->click();
- });
- }
-
- ui->sbSubmode->setValue (vhf ? m_nSubMode : 0); //Submodes require VHF features
-
- if(m_mode=="MSK144") {
- if (m_tci_audio) {
- QTimer::singleShot (5000, [=] {
- if (ui->bandComboBox->currentText()!="OOB") {
- Q_EMIT m_config.transceiver_trfrequency(1000.0);
- } else {
- rigFailure("TCI audio cannot be started as frequency is OOB");
- }
- });
- } else {
- Q_EMIT transmitFrequency (1000.0);
- }
- } else {
- if (m_tci_audio) {
- QTimer::singleShot (5000, [=] {
- if (ui->bandComboBox->currentText()!="OOB") {
- Q_EMIT m_config.transceiver_trfrequency(ui->TxFreqSpinBox->value () - m_XIT);
- } else {
- rigFailure("TCI audio cannot be started as frequency is OOB");
- }
- });
- } else {
- Q_EMIT transmitFrequency (ui->TxFreqSpinBox->value() - m_XIT);
- }
- }
-
- if(m_tci_audio)
- {
- QTimer::singleShot (5000, [=] {
- int attVal = ui->outAttenuation->value();
- ui->outAttenuation->setValue(0);
- ui->outAttenuation->setValue(attVal);
- Q_EMIT m_config.transceiver_volume(m_config.volume());
- });
- }
-
- m_saveDecoded=ui->actionSave_decoded->isChecked();
- m_saveAll=ui->actionSave_all->isChecked();
- ui->TxPowerComboBox->setCurrentIndex(int(.3 * m_dBm + .2));
- ui->cbUploadWSPR_Spots->setChecked(m_uploadWSPRSpots);
- if((m_ndepth&7)==1) ui->actionQuickDecode->setChecked(true);
- if((m_ndepth&7)==2) ui->actionMediumDecode->setChecked(true);
- if((m_ndepth&7)==3) ui->actionDeepestDecode->setChecked(true);
- ui->actionInclude_averaging->setChecked(m_ndepth&16);
- ui->actionInclude_correlation->setChecked(m_ndepth&32);
- ui->actionEnable_AP_DXcall->setChecked(m_ndepth&64);
- ui->actionAuto_Clear_Avg->setChecked(m_ndepth&128);
-
- m_UTCdisk=-1;
- m_UTCdiskDateTime=QDateTime{}; // UTCDateTime of file being read from disk.
- m_fCPUmskrtd=0.0;
- m_bFastDone=false;
- m_bAltV=false;
- m_bNoMoreFiles=false;
- m_bDoubleClicked=false;
- m_bCallingCQ=false;
- m_bCheckedContest=false;
- m_bDisplayedOnce=false;
- m_wait=0;
- m_isort=-3;
- m_max_dB=70;
- m_CQtype="CQ";
- fixStop();
- VHF_features_enabled(m_config.enable_VHF_features());
- m_wideGraph->setVHF(m_config.enable_VHF_features());
-
- connect( wsprNet, SIGNAL(uploadStatus(QString)), this, SLOT(uploadResponse(QString)));
-
- statusChanged();
-
- m_fastGraph->setMode(m_mode);
- m_wideGraph->setMode(m_mode);
-
- connect (&minuteTimer, &QTimer::timeout, this, &MainWindow::bandHoppingTimer);
- connect (&minuteTimer, &QTimer::timeout, this, &MainWindow::on_the_minute);
- connect (&minuteTimer, &QTimer::timeout, this, &MainWindow::invalidate_frequencies_filter);
-
- minuteTimer.setSingleShot (true);
- minuteTimer.start (ms_minute_error () + 60 * 1000);
-
- connect (&splashTimer, &QTimer::timeout, this, &MainWindow::splash_done);
- splashTimer.setSingleShot (true);
- splashTimer.start (20 * 1000);
-
- if(QCoreApplication::applicationVersion().contains("-devel") or
- QCoreApplication::applicationVersion().contains("-rc")) {
- QTimer::singleShot (0, this, SLOT (not_GA_warning_message ()));
- }
-
- m_bMyCallStd=stdCall(m_config.my_callsign ()); //ft8md
- m_bHisCallStd=stdCall(m_hisCall); //ft8md
-
- m_specOp=m_config.special_op_id();
-
- // Starting in FT8 Hound mode needs this initialization
- if (m_specOp==SpecOp::HOUND) {
- on_ft8Button_clicked();
- QTimer::singleShot (50, [=] {ui->houndButton->click();});
- }
-
- ui->labDXped->setVisible(SpecOp::NONE != m_specOp);
- ui->labDXped->setStyleSheet("QLabel {background-color: red; color: white;}");
- ui->pbBestSP->setVisible(m_mode=="FT4");
-
- update_foxLogWindow_rate(); // update the rate on the window
- check_button_color();
- read_txLog();
- read_ignoreList();
- read_ALLCALL7();
- if (ui->actionRemove_after_30days->isChecked ()) {
- remove_old_files(m_config.save_directory().absolutePath(), 30); // remove saved audio files after 30 days
- }
-
- QString jpleph = m_config.data_dir().absoluteFilePath("JPLEPH");
- jpl_setup_(const_cast<char *>(jpleph.toLocal8Bit().constData()),256);
-
-#ifdef WIN32
- // backup libhamlib-4.dll file, so it is still available after the next program update
- QDir dataPath = QCoreApplication::applicationDirPath();
- QFile f {dataPath.absolutePath() + "/" + "libhamlib-4_old.dll"};
- if (!f.exists()) {
- QFile::copy(dataPath.absolutePath() + "/" + "libhamlib-4.dll", dataPath.absolutePath() + "/" + "libhamlib-4_old.dll");
- QTimer::singleShot (5000, [=] { //wait until hamlib has been started
- extern char* hamlib_version2;
- QString hamlib = QString(QLatin1String(hamlib_version2));
- m_settings->beginGroup("Configuration");
- m_settings->setValue ("HamlibBackedUp", hamlib);
- m_settings->endGroup();
- });
- }
-#endif
-
- ui->sbToneSpacing->values({10, 15, 20, 25, 30});
- QTimer::singleShot (4000, [=] {programStart=false;});
-
-// this must be the last statement of constructor
- if (!m_valid) throw std::runtime_error {"Fatal initialization exception"};
-}
-
-void MainWindow::not_GA_warning_message ()
-{
- if(m_config.my_callsign()=="K1JT" or m_config.my_callsign()=="W2ZQ") return;
- MessageBox::critical_message (this,
- "This is a pre-release version of WSJT-X " + version (false) + " made\n"
- "available for testing purposes. By design it will\n"
- "be nonfunctional after April 30, 2026.");
- auto now = QDateTime::currentDateTimeUtc ();
- if (now >= QDateTime {{2026, 4, 30}, {23, 59, 59, 999}, Qt::UTC}) {
- Q_EMIT finished ();
- }
-}
-
-void MainWindow::handle_leavingSettings ()
-{
- inSettings = false;
-}
-
-void MainWindow::initialize_fonts ()
-{
- set_application_font (m_config.text_font ());
- setDecodedTextFont (m_config.decoded_text_font ());
-}
-
-void MainWindow::splash_done ()
-{
- m_splash && m_splash->close ();
-}
-
-void MainWindow::invalidate_frequencies_filter ()
-{
- // every interval, invalidate the frequency filter, so that if any
- // working frequency goes in/out of scope, we pick it up.
- m_config.frequencies ()->filter_refresh ();
- ui->bandComboBox->update ();
-}
-
-void MainWindow::on_the_minute ()
-{
- if (minuteTimer.isSingleShot ())
- {
- minuteTimer.setSingleShot (false);
- minuteTimer.start (60 * 1000); // run free
- }
- else
- {
- auto const& ms_error = ms_minute_error ();
- if (qAbs (ms_error) > 1000) // keep drift within +-1s
- {
- minuteTimer.setSingleShot (true);
- minuteTimer.start (ms_error + 60 * 1000);
- }
- }
-
- if (m_config.watchdog () && m_mode!="WSPR" && m_mode!="FST4W") {
- if (m_idleMinutes < m_config.watchdog ()) ++m_idleMinutes;
- update_watchdog_label ();
- } else {
- tx_watchdog (false);
- }
- update_foxLogWindow_rate(); // update the rate on the window
- if ((!verified && ui->labDXped->isVisible()) or !ui->labDXped->text().contains("Hound"))
- ui->labDXped->setStyleSheet("QLabel {background-color: red; color: white;}");
- verified = false;
- if(!m_transmitting && m_mode=="FT8" && (QDateTime::currentMSecsSinceEpoch()-m_mslastTX) > 120000) m_lapmyc=0;
-}
-
-//--------------------------------------------------- MainWindow destructor
-MainWindow::~MainWindow()
-{
- if(m_astroWidget) m_astroWidget.reset ();
- if(m_QSYMessageCreatorWidget) m_QSYMessageCreatorWidget.reset ();
- if(m_QSYMessageWidget) m_QSYMessageWidget.reset ();
- if(m_qsymonitorWidget) m_qsymonitorWidget.reset ();
- auto fname {QDir::toNativeSeparators(m_config.writeable_data_dir ().absoluteFilePath ("wsjtx_wisdom.dat"))};
- fftwf_export_wisdom_to_filename (fname.toLocal8Bit ());
- m_audioThread.quit ();
- m_audioThread.wait ();
- remove_child_from_event_filter (this);
- memset(ipc_qmap,0,4096); //Zero all of QMAP shared memory
-}
-
-//-------------------------------------------------------- writeSettings()
-void MainWindow::writeSettings()
-{
- m_settings->beginGroup("MainWindow");
- if (ui->actionSWL_Mode->isChecked ())
- {
- m_settings->setValue ("SWLView", true);
- m_settings->setValue ("ShowMenus", ui->cbMenus->isChecked ());
- m_settings->setValue ("geometry", geometries ()[0]);
- m_settings->setValue ("SWLModeGeometry", saveGeometry ());
- m_settings->setValue ("geometryNoControls", geometries ()[2]);
- }
- else
- {
- if (ui->cbMenus->isChecked())
- {
- m_settings->setValue ("SWLView", ui->actionSWL_Mode->isChecked ());
- m_settings->setValue ("ShowMenus", true);
- m_settings->setValue ("geometry", saveGeometry ());
- m_settings->setValue ("SWLModeGeometry", geometries ()[1]);
- m_settings->setValue ("geometryNoControls", geometries ()[2]);
- }
- else
- {
- m_settings->setValue ("SWLView", ui->actionSWL_Mode->isChecked ());
- m_settings->setValue ("ShowMenus", false);
- m_settings->setValue ("geometry", geometries ()[0]);
- m_settings->setValue ("SWLModeGeometry", geometries ()[1]);
- m_settings->setValue ("geometryNoControls", saveGeometry ());
- }
- }
- m_settings->setValue ("state", saveState ());
- m_settings->setValue("MRUdir", m_path);
- m_settings->setValue("TxFirst",m_txFirst);
- m_settings->setValue("DXcall",ui->dxCallEntry->text());
- m_settings->setValue("DXgrid",ui->dxGridEntry->text());
- m_settings->setValue("AstroDisplayed", m_astroWidget && m_astroWidget->isVisible());
- m_settings->setValue("MsgAvgDisplayed", m_msgAvgWidget && m_msgAvgWidget->isVisible ());
- m_settings->setValue("FoxLogDisplayed", m_foxLogWindow && m_foxLogWindow->isVisible ());
- m_settings->setValue("ContestLogDisplayed", m_contestLogWindow && m_contestLogWindow->isVisible ());
- m_settings->setValue("ActiveStationsDisplayed", m_ActiveStationsWidget && m_ActiveStationsWidget->isVisible ());
- m_settings->setValue("QSYMessageCreatorDisplayed", m_QSYMessageCreatorWidget && m_QSYMessageCreatorWidget->isVisible ());
- m_settings->setValue("ShowQSYMessages", ui->actionEnable_QSY_Popups->isChecked());
- m_settings->setValue("QSYMonitorDisplayed", m_qsymonitorWidget && m_qsymonitorWidget->isVisible ());
- m_settings->setValue("RespondCQ",ui->respondComboBox->currentIndex());
- m_settings->setValue("HoundSort",ui->comboBoxHoundSort->currentIndex());
- m_settings->setValue("FoxNlist",ui->sbNlist->value());
- m_settings->setValue("FoxNslots",m_Nslots0);
- m_settings->setValue("SerialNumber",ui->sbSerialNumber->value ());
- m_settings->setValue("FoxTextMsg", m_freeTextMsg0);
- m_settings->setValue("WorkDupes", ui->cbWorkDupes->isChecked());
- m_settings->endGroup();
-
- // do this in the General group because we save the parameters from various places
- if(m_mode=="JT9") {
- m_settings->setValue("SubMode",ui->sbSubmode->value());
- m_settings->setValue("TRPeriod", ui->sbTR->value());
- }
- if(m_mode=="MSK144") m_settings->setValue("ShMsgs_MSK144",m_bShMsgs);
- if(m_mode=="Q65") m_settings->setValue("ShMsgs_Q65",m_bShMsgs);
- if(m_mode=="JT65") m_settings->setValue("ShMsgs_JT65",m_bShMsgs);
- if(m_mode=="JT4") m_settings->setValue("ShMsgs_JT4",m_bShMsgs);
-
- m_settings->beginGroup("Common");
- m_settings->setValue("Mode",m_mode);
- m_settings->setValue("SaveNone",ui->actionNone->isChecked());
- m_settings->setValue("SaveDecoded",ui->actionSave_decoded->isChecked());
- m_settings->setValue("SaveAll",ui->actionSave_all->isChecked());
- m_settings->setValue("RemoveAudioFiles",ui->actionRemove_after_30days->isChecked());
- m_settings->setValue("NDepth",m_ndepth);
-
- //ft8md
- m_settings->setValue ("MultithreadedFT8decoder",ui->actionUse_multithreaded_FT8_decoder->isChecked() );
- m_settings->setValue("NFT8Cycles",m_nFT8Cycles);
- m_settings->setValue("NFT8QSORXfreqSensitivity",m_nFT8RXfSens);
- m_settings->setValue("FT8threads",m_ft8threads);
- m_settings->setValue("FT8Sensitivity",m_ft8Sensitivity);
- m_settings->setValue("FT8DecoderStart",m_ft8DecoderStart);
- m_settings->setValue("FT8WideDXCallSearch",m_FT8WideDxCallSearch);
- m_settings->setValue("HideFT8Dupes",ui->actionHide_FT8_dupe_messages->isChecked());
- //ft8md
-
- m_settings->setValue("RxFreq",ui->RxFreqSpinBox->value());
- if(m_specOp!=SpecOp::FOX) m_settings->setValue("TxFreq",ui->TxFreqSpinBox->value());
- m_settings->setValue("TxFreqFox",m_TxFreqFox);
- m_settings->setValue("WSPRfreq",ui->WSPRfreqSpinBox->value());
- m_settings->setValue("FST4W_RxFreq",ui->sbFST4W_RxFreq->value());
- m_settings->setValue("FST4W_FTol",ui->sbFST4W_FTol->value());
- m_settings->setValue("FST4_FLow",ui->sbF_Low->value());
- m_settings->setValue("FST4_FHigh",ui->sbF_High->value());
- m_settings->setValue("EchoToneSpacing",ui->sbToneSpacing->value());
- m_settings->setValue("EchoFixedTone",ui->rbFixedTone->isChecked());
- m_settings->setValue("EchoMessageRB",ui->rbEchoMessage->isChecked());
- m_settings->setValue("EchoCW",ui->rbEchoCW->isChecked());
- m_settings->setValue("EchoMessage",ui->leEchoMessage->text());
- m_settings->setValue("DTtol",m_DTtol);
- m_settings->setValue("MinSync",m_minSync);
- m_settings->setValue ("AutoSeq", ui->cbAutoSeq->isChecked ());
- m_settings->setValue ("RxAll", ui->cbRxAll->isChecked ());
-// m_settings->setValue("ShMsgs",m_bShMsgs);
- m_settings->setValue("SWL",ui->cbSWL->isChecked());
- if(m_mode=="MSK144" && m_msk144basefreq > 0) {
- m_settings->setValue ("DialFreq", QVariant::fromValue(m_msk144basefreq)); // MSK144 QSY
- } else {
- m_settings->setValue ("DialFreq", QVariant::fromValue(m_lastMonitoredFrequency));
- }
- m_settings->setValue("OutAttenuation", ui->outAttenuation->value ());
- m_settings->setValue("NoSuffix",m_noSuffix);
- m_settings->setValue("GUItab",ui->tabWidget->currentIndex());
- m_settings->setValue("OutBufSize",outBufSize);
- m_settings->setValue ("HoldTxFreq", ui->cbHoldTxFreq->isChecked ());
- m_settings->setValue ("CQonly", ui->cbCQonly->isChecked ());
- m_settings->setValue ("BypassFilters", ui->cbBypass->isChecked ());
- m_settings->setValue("PctTx", ui->sbTxPercent->value ());
- m_settings->setValue("RoundRobin",ui->RoundRobin->currentText());
- m_settings->setValue("dBm",m_dBm);
- m_settings->setValue("RR73",m_send_RR73);
- m_settings->setValue ("WSPRPreferType1", ui->WSPR_prefer_type_1_check_box->isChecked ());
- m_settings->setValue("UploadSpots",m_uploadWSPRSpots);
- m_settings->setValue("NoOwnCall",ui->cbNoOwnCall->isChecked());
- m_settings->setValue ("BandHopping", ui->band_hopping_group_box->isChecked ());
- m_settings->setValue ("MaxDrift", ui->sbMaxDrift->value());
- m_settings->setValue ("TRPeriod_FST4W", ui->sbTR_FST4W->value ());
- m_settings->setValue("FastMode",m_bFastMode);
- m_settings->setValue("Fast9",m_bFast9);
- m_settings->setValue ("CQTxfreq", ui->sbCQTxFreq->value ());
- m_settings->setValue("pwrBandTxMemory",m_pwrBandTxMemory);
- m_settings->setValue("pwrBandTuneMemory",m_pwrBandTuneMemory);
- m_settings->setValue ("FT8AP", ui->actionEnable_AP_FT8->isChecked ());
- m_settings->setValue ("JT65AP", ui->actionEnable_AP_JT65->isChecked ());
- m_settings->setValue ("AutoClearAvg", ui->actionAuto_Clear_Avg->isChecked ());
- m_settings->setValue ("DisableClicksOnWaterfall", ui->actionDisable_clicks_on_waterfall->isChecked ());
- m_settings->setValue("SplitterState",ui->decodes_splitter->saveState());
- m_settings->setValue("Blanker",ui->sbNB->value());
- m_settings->setValue("Score",m_score);
- m_settings->setValue("labDXpedText",ui->labDXped->text());
- m_settings->setValue("EchoAvg",ui->sbEchoAvg->value());
- {
- QList<QVariant> coeffs; // suitable for QSettings
- for (auto const& coeff : m_phaseEqCoefficients)
- {
- coeffs << coeff;
- }
- m_settings->setValue ("PhaseEqualizationCoefficients", QVariant {coeffs});
- }
- m_settings->setValue ("bh_160m", ui->cb160m->isChecked() );
- m_settings->setValue ("bh_80m", ui->cb80m->isChecked() );
- m_settings->setValue ("bh_60m", ui->cb60m->isChecked() );
- m_settings->setValue ("bh_40m", ui->cb40m->isChecked() );
- m_settings->setValue ("bh_30m", ui->cb30m->isChecked() );
- m_settings->setValue ("bh_20m", ui->cb20m->isChecked() );
- m_settings->setValue ("bh_17m", ui->cb17m->isChecked() );
- m_settings->setValue ("bh_15m", ui->cb15m->isChecked() );
- m_settings->setValue ("bh_12m", ui->cb12m->isChecked() );
- m_settings->setValue ("bh_10m", ui->cb10m->isChecked() );
- m_settings->setValue ("bh_6m", ui->cb6m->isChecked() );
- m_settings->setValue ("bh_4m", ui->cb4m->isChecked() );
- m_settings->setValue ("bh_2m", ui->cb2m->isChecked() );
- m_settings->setValue ("bh_70cm", ui->cb70cm->isChecked() );
- m_settings->setValue ("bh_2mMSK", ui->cb2mMSK->isChecked() );
- m_settings->setValue ("bh_80mFT4", ui->cb80mFT4->isChecked() );
- m_settings->setValue ("bh_40mFT4", ui->cb40mFT4->isChecked() );
- m_settings->setValue ("bh_30mFT4", ui->cb30mFT4->isChecked() );
- m_settings->setValue ("bh_20mFT4", ui->cb20mFT4->isChecked() );
- m_settings->setValue ("bh_17mFT4", ui->cb17mFT4->isChecked() );
- m_settings->setValue ("bh_15mFT4", ui->cb15mFT4->isChecked() );
- m_settings->setValue ("bh_12mFT4", ui->cb12mFT4->isChecked() );
- m_settings->setValue ("bh_10mFT4", ui->cb10mFT4->isChecked() );
- m_settings->setValue ("bh_QRG1", ui->cbQRG1->isChecked() );
- m_settings->setValue ("bh_QRG2", ui->cbQRG2->isChecked() );
- m_settings->setValue ("bh_QRG3", ui->cbQRG3->isChecked() );
- m_settings->setValue ("bh_QRG4", ui->cbQRG4->isChecked() );
- m_settings->setValue ("bh_QRG5", ui->cbQRG5->isChecked() );
- m_settings->setValue ("bh_QRG6", ui->cbQRG6->isChecked() );
- m_settings->setValue ("bh_QRG7", ui->cbQRG7->isChecked() );
- m_settings->setValue ("bh_QRG8", ui->cbQRG8->isChecked() );
- m_settings->setValue ("QRG1", ui->sbQRG1->value ());
- m_settings->setValue ("QRG2", ui->sbQRG2->value ());
- m_settings->setValue ("QRG3", ui->sbQRG3->value ());
- m_settings->setValue ("QRG4", ui->sbQRG4->value ());
- m_settings->setValue ("QRG5", ui->sbQRG5->value ());
- m_settings->setValue ("QRG6", ui->sbQRG6->value ());
- m_settings->setValue ("QRG7", ui->sbQRG7->value ());
- m_settings->setValue ("QRG8", ui->sbQRG8->value ());
- m_settings->setValue ("reduceFalseDecodes", ui->actionReduce_false_decodes->isChecked() );
- m_settings->setValue ("FullDuplexMode", ui->actionFull_Duplex_Mode->isChecked() );
- m_settings->setValue ("actionDontSplitALLTXT", ui->actionDon_t_split_ALL_TXT->isChecked() );
- m_settings->setValue ("splitAllTxtYearly", ui->actionSplit_ALL_TXT_yearly->isChecked() );
- m_settings->setValue ("splitAllTxtMonthly", ui->actionSplit_ALL_TXT_monthly->isChecked() );
- m_settings->setValue ("disableWritingOfAllTxt", ui->actionDisable_writing_of_ALL_TXT->isChecked() );
- m_settings->setValue ("DisableEventLogging", ui->actionDisable_event_logging->isChecked() );
- m_settings->setValue ("DarkStyle", ui->actionUse_Dark_Style->isChecked() );
- m_settings->setValue ("BandButtons", ui->actionBand_Buttons->isChecked() );
- m_settings->setValue ("VHFUHFButtons", ui->actionVHF_UHF_Buttons->isChecked() );
- m_settings->setValue ("tx1State", ui->tx1->isEnabled() );
- m_settings->setValue ("HighlightB4", ui->actionHighlightB4->isChecked() );
- m_settings->setValue ("HighlightToday", ui->actionHighlightToday->isChecked() );
- m_settings->setValue ("HighlightIgnored", ui->actionHighlightIgnored->isChecked() );
- m_settings->setValue ("HideB4", ui->actionHideB4->isChecked() );
- m_settings->setValue ("HideToday", ui->actionHideToday->isChecked() );
- m_settings->setValue ("HideIgnored", ui->actionHideIgnored->isChecked() );
- m_settings->setValue ("IgnoreB4", ui->actionIgnoreB4->isChecked() );
- m_settings->setValue ("IgnoreToday", ui->actionIgnoreToday->isChecked() );
- m_settings->setValue ("IgnoreIgnored", ui->actionIgnoreIgnored->isChecked() );
- m_settings->setValue ("HideTerritory1", ui->actionHideTerritory1->isChecked() );
- m_settings->setValue ("HideTerritory2", ui->actionHideTerritory2->isChecked() );
- m_settings->setValue ("HideTerritory3", ui->actionHideTerritory3->isChecked() );
- m_settings->setValue ("HideTerritory4", ui->actionHideTerritory4->isChecked() );
- m_settings->setValue ("HighlightTerritory1", ui->actionHighlightTerritory1->isChecked() );
- m_settings->setValue ("HighlightTerritory2", ui->actionHighlightTerritory2->isChecked() );
- m_settings->setValue ("HighlightTerritory3", ui->actionHighlightTerritory3->isChecked() );
- m_settings->setValue ("HighlightTerritory4", ui->actionHighlightTerritory4->isChecked() );
- m_settings->setValue ("HideEU", ui->actionHideEU->isChecked() );
- m_settings->setValue ("HideNA", ui->actionHideNA->isChecked() );
- m_settings->setValue ("HideSA", ui->actionHideSA->isChecked() );
- m_settings->setValue ("HideAS", ui->actionHideAS->isChecked() );
- m_settings->setValue ("HideAF", ui->actionHideAF->isChecked() );
- m_settings->setValue ("HideOC", ui->actionHideOC->isChecked() );
- m_settings->setValue ("HideAN", ui->actionHideAN->isChecked() );
- m_settings->endGroup();
-}
-
-void MainWindow::update_tx5(const QString &qsy_text)
-{
- if (m_hisCall=="") {
- QMessageBox::warning(this, "WSJT-X","There must be a callsign in the\n DX Call Box to send QSY Request");
- } else {
- QString text = qsy_text;
- ui->tx6->setText(text.replace("$DX",m_hisCall));
- ui->txb6->click();
- stopWRTimer.stop();
- if(!m_auto) {
- ui->autoButton->click();
- stopWRTimer.start(int(1750.0*m_TRperiod));
- }
- }
-}
-
-void MainWindow::reply_tx5(const QString &qsy_reply)
-{
- ui->tx6->setText(qsy_reply);
- ui->txb6->click();
- stopWRTimer.stop();
- if(!m_auto) ui->autoButton->click();
- stopWRTimer.start(int(1750.0*m_TRperiod));
-}
-
-void MainWindow::setQSYMessageCreatorStatus(const bool &QSYMessageCreatorValue)
-{
- m_QSYMessageCreatorValue = QSYMessageCreatorValue;
-}
-
-//---------------------------------------------------------- readSettings()
-void MainWindow::readSettings()
-{
- ui->cbAutoSeq->setVisible(false);
- ui->respondComboBox->setVisible(false);
-
- m_settings->beginGroup("MainWindow");
- std::array<QByteArray, 3> the_geometries;
- the_geometries[0] = m_settings->value ("geometry", saveGeometry ()).toByteArray ();
- the_geometries[1] = m_settings->value ("SWLModeGeometry", saveGeometry ()).toByteArray ();
- the_geometries[2] = m_settings->value ("geometryNoControls", saveGeometry ()).toByteArray ();
- auto SWL_mode = m_settings->value ("SWLView", false).toBool ();
- auto show_menus = m_settings->value ("ShowMenus", true).toBool ();
- ui->actionSWL_Mode->setChecked (SWL_mode);
- ui->cbMenus->setChecked (show_menus);
- auto current_view_mode = SWL_mode ? 1 : show_menus ? 0 : 2;
- change_layout (current_view_mode);
- geometries (current_view_mode, the_geometries);
- restoreState (m_settings->value ("state", saveState ()).toByteArray ());
- ui->dxCallEntry->setText (m_settings->value ("DXcall", QString {}).toString ());
- ui->dxGridEntry->setText (m_settings->value ("DXgrid", QString {}).toString ());
- m_path = m_settings->value("MRUdir", m_config.save_directory ().absolutePath ()).toString ();
- m_txFirst = m_settings->value("TxFirst",false).toBool();
- auto displayAstro = m_settings->value ("AstroDisplayed", false).toBool ();
- auto displayMsgAvg = m_settings->value ("MsgAvgDisplayed", false).toBool ();
- auto displayFoxLog = m_settings->value ("FoxLogDisplayed", false).toBool ();
- auto displayContestLog = m_settings->value ("ContestLogDisplayed", false).toBool ();
- bool displayActiveStations = m_settings->value ("ActiveStationsDisplayed", false).toBool ();
- bool displayQSYMessageCreator = m_settings->value ("QSYMessageCreatorDisplayed", false).toBool ();
- bool displayQSYMonitor = m_settings->value("QSYMonitorDisplayed", false).toBool ();
- bool enableQSYpopups = m_settings->value("ShowQSYMessages", true).toBool ();
- ui->respondComboBox->setCurrentIndex(m_settings->value("RespondCQ",0).toInt());
- ui->comboBoxHoundSort->setCurrentIndex(m_settings->value("HoundSort",3).toInt());
- ui->sbNlist->setValue(m_settings->value("FoxNlist",12).toInt());
- m_Nslots=m_settings->value("FoxNslots",3).toInt();
- m_Nslots0=m_Nslots;
- if(!m_config.superFox()) ui->sbNslots->setValue(m_Nslots);
- ui->sbSerialNumber->setValue (m_settings->value ("SerialNumber", 1).toInt ());
- m_freeTextMsg0=m_settings->value("FoxTextMsg","").toString();
- m_freeTextMsg=m_freeTextMsg0;
- ui->cbWorkDupes->setChecked(m_settings->value("WorkDupes",false).toBool());
- m_settings->endGroup();
-
- m_settings->beginGroup("Common");
- m_mode=m_settings->value("Mode","FT8").toString();
- m_settings->endGroup();
-
- // do this outside of settings group because it uses groups internally
- ui->actionAstronomical_data->setChecked (displayAstro);
- ui->actionEnable_QSY_Popups->setChecked (enableQSYpopups);
-
- // do this in the General group because we save the parameters from various places
- if(m_mode=="JT9") {
- blocked=true;
- m_nSubMode=m_settings->value("SubMode",0).toInt();
- ui->sbSubmode->setValue(m_nSubMode);
- ui->sbFtol->setValue (m_settings->value("Ftol_JT9", 50).toInt());
- ui->sbTR->setValue (m_settings->value ("TRPeriod", 15).toInt());
- QTimer::singleShot (50, [=] {blocked = false;});
- }
- if (m_mode=="FT8") {
- ui->sbFtol->setValue (m_settings->value("Ftol_SF", 50).toInt());
- }
- if (m_mode=="Q65") {
- m_nSubMode=m_settings->value("SubMode_Q65",0).toInt();
- ui->sbSubmode->setValue(m_nSubMode);
- ui->sbFtol->setValue (m_settings->value("Ftol_Q65", 50).toInt());
- ui->sbTR->setValue (m_settings->value ("TRPeriod_Q65", 30).toInt());
- }
- if (m_mode=="JT65") {
- m_nSubMode=m_settings->value("SubMode_JT65",0).toInt();
- ui->sbSubmode->setValue(m_nSubMode);
- ui->sbFtol->setValue (m_settings->value("Ftol_JT65", 50).toInt());
- }
- if (m_mode=="JT4") {
- m_nSubMode=m_settings->value("SubMode_JT4",0).toInt();
- ui->sbSubmode->setValue(m_nSubMode);
- ui->sbFtol->setValue (m_settings->value("Ftol_JT4", 50).toInt());
- ui->sbTR->setValue (m_settings->value ("TRPeriod_FST4", 60).toInt());
- }
- if (m_mode=="MSK144") {
- ui->sbFtol->setValue (m_settings->value("Ftol_MSK144",50).toInt());
- if (!(m_currentBand=="6m" or m_currentBand=="4m" or m_currentBand=="2m")) ui->sbTR->setValue (m_settings->value ("TRPeriod_MSK144", 30).toInt());
- if (m_currentBand=="6m" or m_currentBand=="4m") ui->sbTR->setValue (m_settings->value ("TRPeriod_MSK144_6m", 15).toInt());
- if (m_currentBand=="2m") ui->sbTR->setValue (m_settings->value ("TRPeriod_MSK144_2m", 30).toInt());
- }
- if (m_mode=="MSK144") m_bShMsgs=m_settings->value("ShMsgs_MSK144",false).toBool();
- if (m_mode=="Q65") m_bShMsgs=m_settings->value("ShMsgs_Q65",false).toBool();
- if (m_mode=="JT65") m_bShMsgs=m_settings->value("ShMsgs_JT65",false).toBool();
- if (m_mode=="JT4") m_bShMsgs=m_settings->value("ShMsgs_JT4",false).toBool();
-
- m_settings->beginGroup("Common");
- ui->cb160m->setChecked(m_settings->value("bh_160m", false).toBool());
- ui->cb80m->setChecked(m_settings->value("bh_80m", false).toBool());
- ui->cb60m->setChecked(m_settings->value("bh_60m", false).toBool());
- ui->cb40m->setChecked(m_settings->value("bh_40m", false).toBool());
- ui->cb30m->setChecked(m_settings->value("bh_30m", false).toBool());
- ui->cb20m->setChecked(m_settings->value("bh_20m", false).toBool());
- ui->cb17m->setChecked(m_settings->value("bh_17m", false).toBool());
- ui->cb15m->setChecked(m_settings->value("bh_15m", false).toBool());
- ui->cb12m->setChecked(m_settings->value("bh_12m", false).toBool());
- ui->cb10m->setChecked(m_settings->value("bh_10m", false).toBool());
- ui->cb6m->setChecked(m_settings->value("bh_6m", false).toBool());
- ui->cb4m->setChecked(m_settings->value("bh_4m", false).toBool());
- ui->cb2m->setChecked(m_settings->value("bh_2m", false).toBool());
- ui->cb70cm->setChecked(m_settings->value("bh_70cm", false).toBool());
- ui->cb2mMSK->setChecked(m_settings->value("bh_2mMSK", false).toBool());
- ui->cb80mFT4->setChecked(m_settings->value("bh_80mFT4", false).toBool());
- ui->cb40mFT4->setChecked(m_settings->value("bh_40mFT4", false).toBool());
- ui->cb30mFT4->setChecked(m_settings->value("bh_30mFT4", false).toBool());
- ui->cb20mFT4->setChecked(m_settings->value("bh_20mFT4", false).toBool());
- ui->cb17mFT4->setChecked(m_settings->value("bh_17mFT4", false).toBool());
- ui->cb15mFT4->setChecked(m_settings->value("bh_15mFT4", false).toBool());
- ui->cb12mFT4->setChecked(m_settings->value("bh_12mFT4", false).toBool());
- ui->cb10mFT4->setChecked(m_settings->value("bh_10mFT4", false).toBool());
- ui->cbQRG1->setChecked(m_settings->value("bh_QRG1", false).toBool());
- ui->cbQRG2->setChecked(m_settings->value("bh_QRG2", false).toBool());
- ui->cbQRG3->setChecked(m_settings->value("bh_QRG3", false).toBool());
- ui->cbQRG4->setChecked(m_settings->value("bh_QRG4", false).toBool());
- ui->cbQRG5->setChecked(m_settings->value("bh_QRG5", false).toBool());
- ui->cbQRG6->setChecked(m_settings->value("bh_QRG6", false).toBool());
- ui->cbQRG7->setChecked(m_settings->value("bh_QRG7", false).toBool());
- ui->cbQRG8->setChecked(m_settings->value("bh_QRG8", false).toBool());
- ui->sbQRG1->setValue (m_settings->value ("QRG1", 3567).toInt ());
- ui->sbQRG2->setValue (m_settings->value ("QRG2", 7056).toInt ());
- ui->sbQRG3->setValue (m_settings->value ("QRG3", 10131).toInt ());
- ui->sbQRG4->setValue (m_settings->value ("QRG4", 14090).toInt ());
- ui->sbQRG5->setValue (m_settings->value ("QRG5", 18095).toInt ());
- ui->sbQRG6->setValue (m_settings->value ("QRG6", 21091).toInt ());
- ui->sbQRG7->setValue (m_settings->value ("QRG7", 24911).toInt ());
- ui->sbQRG8->setValue (m_settings->value ("QRG8", 28091).toInt ());
- ui->actionReduce_false_decodes->setChecked(m_settings->value("reduceFalseDecodes", false).toBool());
- ui->actionFull_Duplex_Mode->setChecked(m_settings->value("FullDuplexMode", false).toBool());
- ui->labDXped->setText(m_settings->value("labDXpedText",QString {}).toString ());
- ui->actionDon_t_split_ALL_TXT->setChecked(m_settings->value("actionDontSplitALLTXT", true).toBool());
- ui->actionSplit_ALL_TXT_yearly->setChecked(m_settings->value("splitAllTxtYearly", false).toBool());
- ui->actionSplit_ALL_TXT_monthly->setChecked(m_settings->value("splitAllTxtMonthly", false).toBool());
- ui->actionDisable_writing_of_ALL_TXT->setChecked(m_settings->value("disableWritingOfAllTxt", false).toBool());
- ui->actionDisable_event_logging->setChecked(m_settings->value("DisableEventLogging", false).toBool());
- ui->actionUse_Dark_Style->setChecked(m_settings->value("DarkStyle", false).toBool());
- ui->actionBand_Buttons->setChecked(m_settings->value("BandButtons", true).toBool());
- ui->actionVHF_UHF_Buttons->setChecked(m_settings->value("VHFUHFButtons", false).toBool());
- ui->tx1->setEnabled(m_settings->value("tx1State", true).toBool());
- ui->actionHighlightB4->setChecked(m_settings->value("HighlightB4", false).toBool());
- ui->actionHighlightToday->setChecked(m_settings->value("HighlightToday", false).toBool());
- ui->actionHighlightIgnored->setChecked(m_settings->value("HighlightIgnored", false).toBool());
- ui->actionHideB4->setChecked(m_settings->value("HideB4", false).toBool());
- ui->actionHideToday->setChecked(m_settings->value("HideToday", false).toBool());
- ui->actionHideIgnored->setChecked(m_settings->value("HideIgnored", false).toBool());
- ui->actionIgnoreB4->setChecked(m_settings->value("IgnoreB4", false).toBool());
- ui->actionIgnoreToday->setChecked(m_settings->value("IgnoreToday", false).toBool());
- ui->actionIgnoreIgnored->setChecked(m_settings->value("IgnoreIgnored", false).toBool());
- ui->actionHideTerritory1->setChecked(m_settings->value("HideTerritory1", false).toBool());
- ui->actionHideTerritory2->setChecked(m_settings->value("HideTerritory2", false).toBool());
- ui->actionHideTerritory3->setChecked(m_settings->value("HideTerritory3", false).toBool());
- ui->actionHideTerritory4->setChecked(m_settings->value("HideTerritory4", false).toBool());
- ui->actionHighlightTerritory1->setChecked(m_settings->value("HighlightTerritory1", false).toBool());
- ui->actionHighlightTerritory2->setChecked(m_settings->value("HighlightTerritory2", false).toBool());
- ui->actionHighlightTerritory3->setChecked(m_settings->value("HighlightTerritory3", false).toBool());
- ui->actionHighlightTerritory4->setChecked(m_settings->value("HighlightTerritory4", false).toBool());
- ui->actionHideEU->setChecked(m_settings->value("HideEU", false).toBool());
- ui->actionHideNA->setChecked(m_settings->value("HideNA", false).toBool());
- ui->actionHideSA->setChecked(m_settings->value("HideSA", false).toBool());
- ui->actionHideAS->setChecked(m_settings->value("HideAS", false).toBool());
- ui->actionHideAF->setChecked(m_settings->value("HideAF", false).toBool());
- ui->actionHideOC->setChecked(m_settings->value("HideOC", false).toBool());
- ui->actionHideAN->setChecked(m_settings->value("HideAN", false).toBool());
-// m_mode=m_settings->value("Mode","FT8").toString();
- ui->actionNone->setChecked(m_settings->value("SaveNone",true).toBool());
- ui->actionSave_decoded->setChecked(m_settings->value("SaveDecoded",false).toBool());
- ui->actionSave_all->setChecked(m_settings->value("SaveAll",false).toBool());
- ui->actionRemove_after_30days->setChecked(m_settings->value("RemoveAudioFiles",false).toBool());
- ui->RxFreqSpinBox->setValue(0); // ensure a change is signaled
- ui->RxFreqSpinBox->setValue(m_settings->value("RxFreq",1500).toInt());
- ui->sbFST4W_RxFreq->setValue(0);
- ui->sbFST4W_RxFreq->setValue(m_settings->value("FST4W_RxFreq",1500).toInt());
- ui->sbF_Low->setValue(m_settings->value("FST4_FLow",600).toInt());
- ui->sbF_High->setValue(m_settings->value("FST4_FHigh",1400).toInt());
- ui->sbFST4W_FTol->setValue(m_settings->value("FST4W_FTol",100).toInt());
- ui->sbToneSpacing->setValue(m_settings->value("EchoToneSpacing",10).toInt());
- ui->rbFixedTone->setChecked(m_settings->value("EchoFixedTone",true).toBool());
- ui->rbEchoMessage->setChecked(m_settings->value("EchoMessageRB",true).toBool());
- ui->rbEchoCW->setChecked(m_settings->value("EchoCW",true).toBool());
- ui->leEchoMessage->setText(m_settings->value("EchoMessage",QString {}).toString());
- m_minSync=m_settings->value("MinSync",0).toInt();
- ui->syncSpinBox->setValue(m_minSync);
- ui->cbAutoSeq->setChecked (m_settings->value ("AutoSeq", false).toBool());
- ui->cbRxAll->setChecked (m_settings->value ("RxAll", false).toBool());
-// m_bShMsgs=m_settings->value("ShMsgs",false).toBool();
- m_bSWL=m_settings->value("SWL",false).toBool();
- m_bFast9=m_settings->value("Fast9",false).toBool();
- m_bFastMode=m_settings->value("FastMode",false).toBool();
- ui->sbMaxDrift->setValue (m_settings->value ("MaxDrift",0).toInt());
- ui->sbTR_FST4W->setValue (m_settings->value ("TRPeriod_FST4W", 15).toInt());
- m_lastMonitoredFrequency = m_settings->value ("DialFreq",
- QVariant::fromValue<Frequency> (default_frequency)).value<Frequency> ();
- if(m_mode=="MSK144") m_msk144basefreq = m_lastMonitoredFrequency; // MSK144 QSY
- ui->WSPRfreqSpinBox->setValue(0); // ensure a change is signaled
- ui->WSPRfreqSpinBox->setValue(m_settings->value("WSPRfreq",1500).toInt());
- ui->TxFreqSpinBox->setValue(0); // ensure a change is signaled
- if(m_specOp!=SpecOp::FOX) ui->TxFreqSpinBox->setValue(m_settings->value("TxFreq",1500).toInt());
- m_TxFreqFox=m_settings->value("TxFreqFox",300).toInt();
- if(m_specOp==SpecOp::FOX && !m_config.superFox()) ui->TxFreqSpinBox->setValue(m_TxFreqFox);
- m_ndepth=m_settings->value("NDepth",3).toInt();
-
- //ft8md
- ui->actionUse_multithreaded_FT8_decoder->setChecked(m_settings->value("MultithreadedFT8decoder", false).toBool());
- m_multithreadFT8 = ui->actionUse_multithreaded_FT8_decoder->isChecked();
- dec_data.params.lmultift8 = m_multithreadFT8;
-
- m_nFT8Cycles=m_settings->value("NFT8Cycles",3).toInt(); if(!(m_nFT8Cycles>=1 && m_nFT8Cycles<=3)) m_nFT8Cycles=3;
- if(m_nFT8Cycles==1) ui->actionDecFT8cycles1->setChecked(true);
- else if(m_nFT8Cycles==2) ui->actionDecFT8cycles2->setChecked(true);
- else if(m_nFT8Cycles==3) ui->actionDecFT8cycles3->setChecked(true);
-
- m_nFT8RXfSens=m_settings->value("NFT8QSORXfreqSensitivity",3).toInt(); if(!(m_nFT8RXfSens>=1 && m_nFT8RXfSens<=3)) m_nFT8RXfSens=3;
- if(m_nFT8RXfSens==1) ui->actionRXfLow->setChecked(true);
- else if(m_nFT8RXfSens==2) ui->actionRXfMedium->setChecked(true);
- else if(m_nFT8RXfSens==3) ui->actionRXfHigh->setChecked(true);
-
- m_ft8threads=m_settings->value("FT8threads",0).toInt();
- if(!(m_ft8threads>=0 && m_ft8threads<25)) m_ft8threads=0;
- if(m_ft8threads==0) ui->actionMTAuto->setChecked(true);
- else if(m_ft8threads==1) ui->actionMT1->setChecked(true);
- else if(m_ft8threads==2) ui->actionMT2->setChecked(true);
- else if(m_ft8threads==3) ui->actionMT3->setChecked(true);
- else if(m_ft8threads==4) ui->actionMT4->setChecked(true);
- else if(m_ft8threads==5) ui->actionMT5->setChecked(true);
- else if(m_ft8threads==6) ui->actionMT6->setChecked(true);
- else if(m_ft8threads==7) ui->actionMT7->setChecked(true);
- else if(m_ft8threads==8) ui->actionMT8->setChecked(true);
- else if(m_ft8threads==9) ui->actionMT9->setChecked(true);
- else if(m_ft8threads==10) ui->actionMT10->setChecked(true);
- else if(m_ft8threads==11) ui->actionMT11->setChecked(true);
- else if(m_ft8threads==12) ui->actionMT12->setChecked(true);
- qDebug() << "m_ft8threads is " << m_ft8threads;
- dec_data.params.nmt = m_ft8threads;
-
- ui->actionHide_FT8_dupe_messages->setChecked(m_settings->value("HideFT8Dupes",true).toBool());
-
- m_ft8Sensitivity=m_settings->value("FT8Sensitivity",3).toInt();
- if(!(m_ft8Sensitivity>0 && m_ft8Sensitivity<=3)) m_ft8Sensitivity=3;
- if(m_ft8Sensitivity==1) ui->actionFT8SensMin->setChecked(true);
- else if(m_ft8Sensitivity==2) ui->actionlowFT8thresholds->setChecked(true);
- else if(m_ft8Sensitivity==3) ui->actionFT8subpass->setChecked(true);
-
- m_ft8DecoderStart=m_settings->value("FT8DecoderStart",3).toInt();
- if(!(m_ft8DecoderStart>=0 && m_ft8DecoderStart<=4)) m_ft8DecoderStart=3;
- if(m_ft8DecoderStart==0) ui->actionStartTwoStage->setChecked(true);
- else if(m_ft8DecoderStart==1) ui->actionStartThreeStage->setChecked(true);
- else if(m_ft8DecoderStart==2) ui->actionStartEarly->setChecked(true);
- else if(m_ft8DecoderStart==3) ui->actionStartNormal->setChecked(true);
- else if(m_ft8DecoderStart==4) ui->actionStartLate->setChecked(true);
-
- m_FT8WideDxCallSearch=m_settings->value("FT8WideDXCallSearch",true).toBool();
- ui->actionFT8WidebandDXCallSearch->setChecked(m_FT8WideDxCallSearch);
- //ft8md
-
- ui->sbTxPercent->setValue (m_settings->value ("PctTx", 20).toInt ());
- on_sbTxPercent_valueChanged (ui->sbTxPercent->value ());
- ui->RoundRobin->setCurrentText(m_settings->value("RoundRobin",tr("Random")).toString());
- m_dBm=m_settings->value("dBm",37).toInt();
- m_send_RR73=m_settings->value("RR73",false).toBool();
- m_score=m_settings->value("Score",0).toInt();
- if(m_send_RR73) {
- m_send_RR73=false;
- on_txrb4_doubleClicked();
- }
- ui->WSPR_prefer_type_1_check_box->setChecked (m_settings->value ("WSPRPreferType1", true).toBool ());
- m_uploadWSPRSpots=m_settings->value("UploadSpots",false).toBool();
- ui->cbNoOwnCall->setChecked(m_settings->value("NoOwnCall",false).toBool());
- ui->band_hopping_group_box->setChecked (m_settings->value ("BandHopping", false).toBool());
- // setup initial value of tx attenuator
- m_block_pwr_tooltip = true;
- ui->outAttenuation->setValue (m_settings->value ("OutAttenuation", 0).toInt ());
- m_block_pwr_tooltip = false;
- ui->sbCQTxFreq->setValue (m_settings->value ("CQTxFreq", 260).toInt());
- m_noSuffix=m_settings->value("NoSuffix",false).toBool();
- int n=m_settings->value("GUItab",0).toInt();
- if (SpecOp::FOX==m_specOp) {
- ui->tabWidget->setCurrentIndex(n);
- } else {
- // We need this to initialize the height of tab 1 correctly
- ui->pbFreeText->setVisible(false);
- ui->cbSendMsg->setVisible(false);
- ui->tabWidget->setCurrentIndex(1);
- ui->tabWidget->setCurrentIndex(n);
- }
- outBufSize=m_settings->value("OutBufSize",4096).toInt();
- ui->cbHoldTxFreq->setChecked (m_settings->value ("HoldTxFreq", false).toBool ());
- HoldTxFreqStatus = m_settings->value ("HoldTxFreq", false).toBool ();
- ui->cbCQonly->setChecked (m_settings->value ("CQonly", false).toBool ());
- ui->cbBypass->setChecked (m_settings->value ("BypassFilters", false).toBool ());
- m_pwrBandTxMemory=m_settings->value("pwrBandTxMemory").toHash();
- m_pwrBandTuneMemory=m_settings->value("pwrBandTuneMemory").toHash();
- ui->actionEnable_AP_FT8->setChecked (m_settings->value ("FT8AP", false).toBool());
- ui->actionEnable_AP_JT65->setChecked (m_settings->value ("JT65AP", false).toBool());
- ui->actionAuto_Clear_Avg->setChecked (m_settings->value ("AutoClearAvg", false).toBool());
- ui->actionDisable_clicks_on_waterfall->setChecked (m_settings->value ("DisableClicksOnWaterfall", false).toBool());
- ui->decodes_splitter->restoreState(m_settings->value("SplitterState").toByteArray());
- ui->sbNB->setValue(m_settings->value("Blanker",0).toInt());
- ui->sbEchoAvg->setValue(m_settings->value("EchoAvg",10).toInt());
- {
- auto const& coeffs = m_settings->value ("PhaseEqualizationCoefficients"
- , QList<QVariant> {0., 0., 0., 0., 0.}).toList ();
- m_phaseEqCoefficients.clear ();
- for (auto const& coeff : coeffs)
- {
- m_phaseEqCoefficients.append (coeff.value<double> ());
- }
- }
- m_settings->endGroup();
-
- // use these initialisation settings to tune the audio o/p buffer
- // size and audio thread priority
- m_settings->beginGroup ("Tune");
- m_audioThreadPriority = static_cast<QThread::Priority> (m_settings->value ("Audio/ThreadPriority", QThread::TimeCriticalPriority).toInt () % 8);
- m_settings->endGroup ();
-
- m_specOp=m_config.special_op_id();
- checkMSK144ContestType();
- if (displayMsgAvg) on_actionMessage_averaging_triggered();
- if (displayFoxLog) on_fox_log_action_triggered ();
- if (displayContestLog) on_contest_log_action_triggered ();
- if (displayActiveStations) on_actionActiveStations_triggered();
- if (displayQSYMessageCreator) on_actionQSYMessage_Creator_triggered();
- if (displayQSYMonitor) on_actionQSY_Monitor_triggered();
-
-#ifdef WIN32
- if (m_config.alert_Enabled()) { // testing and initializing the default audio device for playing audible alerts
- QAudioOutput info(QAudioDeviceInfo::defaultOutputDevice());
- QString binPath = QCoreApplication::applicationDirPath();
- QAudioFormat format;
- format.setCodec("audio/pcm");
- format.setSampleRate (48000);
- format.setChannelCount (1);
- format.setSampleSize (16);
- format.setSampleType(QAudioFormat::SignedInt);
- QAudioOutput* audio;
- audio = new QAudioOutput(format, this);
- QFile *effect = new QFile(this);
- effect->setFileName(QString("%1/%2").arg(binPath, "/sounds/Testing.wav"));
- effect->open(QIODevice::ReadOnly);
- audio->start(effect);
- }
-#endif
-}
-
-void MainWindow::checkMSK144ContestType()
-{
- if(SpecOp::NONE != m_specOp)
- {
- if(m_mode=="MSK144" && SpecOp::EU_VHF < m_specOp)
- {
- MessageBox::warning_message (this, tr ("Improper mode"),
- "Mode will be changed to FT8. MSK144 not available if Fox, Hound, Field Day, FT Roundup, WW Digi. or ARRL Digi contest is selected.");
- on_actionFT8_triggered();
- }
- }
-}
-
-void MainWindow::set_application_font (QFont const& font)
-{
- // check if dark style is enabled, this check is also effective during the program start
- if (ui->actionUse_Dark_Style->isChecked()) {
- QFile f(":qdarkstyle/style.qss");
- if (!f.exists()) {
- printf("Unable to set stylesheet, file not found\n");
- } else {
- qApp->setFont (font);
- QString ss;
- f.open(QFile::ReadOnly | QFile::Text);
- QTextStream ts(&f);
- qApp->setStyleSheet(ts.readAll() + "* {" + font_as_stylesheet (font) + '}');
- m_useDarkStyle = true;
- m_wideGraph->setDarkStyle(m_useDarkStyle);
- check_button_color();
- ui->tabWidget->setTabShape(QTabWidget::Rounded);
- }
- } else {
- m_useDarkStyle = false;
- m_wideGraph->setDarkStyle(m_useDarkStyle);
- check_button_color();
- ui->tabWidget->setTabShape(QTabWidget::Triangular);
- qApp->setFont (font);
- // set font in the application style sheet as well in case it has
- // been modified in the style sheet which has priority
- QString ss;
- if (qApp->styleSheet ().size ()) {
- auto sheet = qApp->styleSheet ();
- sheet.remove ("file:///");
- QFile sf {sheet};
- if (sf.open (QFile::ReadOnly | QFile::Text))
- {
- QString tmp = sf.readAll();
- if (tmp != NULL) ss = sf.readAll () + tmp;
- else qDebug() << "tmp==NULL at sf.readAll";
- }
- }
- qApp->setStyleSheet (ss + "* {" + font_as_stylesheet (font) + '}');
- }
-
- // ensure a balanced layout
- qreal pointSize = m_config.text_font().pointSizeF();
- if (m_config.PWR_and_SWR()) {
- ui->label->setMinimumWidth (2.8*pointSize + 8);
- ui->label->setAlignment(Qt::AlignCenter);
- ui->outAttenuation->setMinimumWidth (2.8*pointSize + 8);
- }
- if (pointSize < 11) {
-// ui->tabWidget->setMaximumHeight(210); // UR for AL
- if (ui->actionUse_Dark_Style->isChecked()) {
-// ui->tabWidget->setMaximumHeight(225); // UR for normal + widescreen
- ui->houndButton->setMinimumWidth(50); // UR for normal + widescreen
- ui->ft8Button->setMinimumWidth(50); // UR for normal + widescreen
- ui->ft4Button->setMinimumWidth(50); // UR for normal + widescreen
- ui->msk144Button->setMinimumWidth(50); // UR for normal + widescreen
- ui->q65Button->setMinimumWidth(50); // UR for normal + widescreen
- ui->jt65Button->setMinimumWidth(50); // UR for normal + widescreen
- } else {
-// ui->tabWidget->setMaximumHeight(225); // UR for normal + widescreen
- ui->houndButton->setMaximumWidth(40); // UR for normal + widescreen
- ui->ft8Button->setMaximumWidth(40); // UR for normal + widescreen
- ui->ft4Button->setMaximumWidth(40); // UR for normal + widescreen
- ui->msk144Button->setMaximumWidth(40); // UR for normal + widescreen
- ui->q65Button->setMaximumWidth(40); // UR for normal + widescreen
- ui->jt65Button->setMaximumWidth(40); // UR for normal + widescreen
- ui->houndButton->setMinimumWidth(0); // UR for normal + widescreen
- ui->ft8Button->setMinimumWidth(0); // UR for normal + widescreen
- ui->ft4Button->setMinimumWidth(0); // UR for normal + widescreen
- ui->msk144Button->setMinimumWidth(0); // UR for normal + widescreen
- ui->q65Button->setMinimumWidth(0); // UR for normal + widescreen
- ui->jt65Button->setMinimumWidth(0); // UR for normal + widescreen
- }
- } else {
-// ui->tabWidget->setMaximumHeight(255); // UR for AL
-// ui->tabWidget->setMaximumHeight(500); // UR for normal + widescreen
- ui->houndButton->setMinimumWidth(50); // UR for normal + widescreen
- ui->ft8Button->setMinimumWidth(50); // UR for normal + widescreen
- ui->ft4Button->setMinimumWidth(50); // UR for normal + widescreen
- ui->msk144Button->setMinimumWidth(50); // UR for normal + widescreen
- ui->q65Button->setMinimumWidth(50); // UR for normal + widescreen
- ui->jt65Button->setMinimumWidth(50); // UR for normal + widescreen
- }
- if (m_config.largerTabWidget()) ui->tabWidget->setMaximumHeight(1000);
- for (auto& widget : qApp->topLevelWidgets ())
- {
- widget->updateGeometry ();
- }
-}
-
-void MainWindow::setDecodedTextFont (QFont const& font)
-{
- ui->decodedTextBrowser->setContentFont (font);
- ui->decodedTextBrowser2->setContentFont (font);
- ui->houndQueueTextBrowser->setContentFont(font);
- ui->houndQueueTextBrowser->displayHoundToBeCalled(" ");
- ui->houndQueueTextBrowser->setText("");
-
- ui->foxTxListTextBrowser->setContentFont(font);
- ui->foxTxListTextBrowser->displayHoundToBeCalled(" ");
- ui->foxTxListTextBrowser->setText("");
-
- auto style_sheet = "QLabel {" + font_as_stylesheet (font) + '}';
- ui->lh_decodes_headings_label->setStyleSheet (ui->lh_decodes_headings_label->styleSheet () + style_sheet);
- ui->rh_decodes_headings_label->setStyleSheet (ui->rh_decodes_headings_label->styleSheet () + style_sheet);
- if (m_msgAvgWidget) {
- m_msgAvgWidget->changeFont (font);
- }
- if (m_foxLogWindow) {
- m_foxLogWindow->set_log_view_font (font);
- }
- if (m_contestLogWindow) {
- m_contestLogWindow->set_log_view_font (font);
- m_contestLogWindow->set_nQSO(m_logBook.contest_log()->n_qso());
- }
- if(m_ActiveStationsWidget != NULL) {
- m_ActiveStationsWidget->changeFont(font);
- }
- updateGeometry ();
-}
-
-void MainWindow::fixStop()
-{
- m_hsymStop=179;
- if(m_mode=="WSPR") {
- m_hsymStop=396;
- } else if(m_mode=="Echo") {
- m_hsymStop=9;
- } else if (m_mode=="JT4"){
- m_hsymStop=176;
- if(m_config.decode_at_52s()) m_hsymStop=179;
- } else if (m_mode=="JT9"){
- m_hsymStop=173;
- if(m_config.decode_at_52s()) m_hsymStop=179;
- } else if (m_mode=="JT65"){
- m_hsymStop=174;
- if(m_config.decode_at_52s()) m_hsymStop=179;
- } else if (m_mode=="Q65"){
- m_hsymStop=48; // 13.8 s
-// if(m_TRperiod==15 && m_config.decode_at_52s()) m_hsymStop=50; // 14.1 s for Q65-15 EME
- if(m_TRperiod==30) {
- m_hsymStop=96; // 27.6 s
- if(m_config.decode_at_52s()) m_hsymStop=100; // 28.8 s
- }
- if(m_TRperiod==60) m_hsymStop=196; // 56.4 s
- if(m_TRperiod==120) m_hsymStop=408; // 117.5 s
- if(m_TRperiod==300) m_hsymStop=1030; // 296.6 s
- } else if (m_mode=="FreqCal"){
- m_hsymStop=((int(m_TRperiod/0.288))/8)*8;
- } else if (m_mode=="FT8") {
- if (m_multithreadFT8 && !(m_specOp==SpecOp::HOUND && m_config.superFox())) {
- if (m_ft8DecoderStart==0) m_hsymStop=49;
- else if (m_ft8DecoderStart==1) {
- m_hsymStop=50;
- m_earlyDecode2=46;
- }
- else if (m_ft8DecoderStart==2) m_hsymStop=48;
- else if (m_ft8DecoderStart==3) m_hsymStop=49;
- else if (m_ft8DecoderStart==4) m_hsymStop=50;
- } else {
- m_hsymStop=50;
- m_earlyDecode2=47;
- }
- } else if (m_mode=="FT4") {
- m_hsymStop=21;
- } else if(m_mode=="FST4" or m_mode=="FST4W") {
- int stop[] = {39,85,187,387,1003,3107,6232};
- int stop_EME[] = {48,95,197,396,1012,3107,6232};
- int i=0;
- if(m_TRperiod==30) i=1;
- if(m_TRperiod==60) i=2;
- if(m_TRperiod==120) i=3;
- if(m_TRperiod==300) i=4;
- if(m_TRperiod==900) i=5;
- if(m_TRperiod==1800) i=6;
- if(m_config.decode_at_52s()) {
- m_hsymStop=stop_EME[i];
- } else {
- m_hsymStop=stop[i];
- }
- }
-}
-
-//-------------------------------------------------------------- dataSink()
-void MainWindow::dataSink(qint64 frames)
-{
- static float s[NSMAX];
- char line[80];
- int k(frames);
- auto fname {QDir::toNativeSeparators(m_config.writeable_data_dir ().absoluteFilePath ("refspec.dat")).toLocal8Bit ()};
-
- if(m_diskData) {
- dec_data.params.ndiskdat=1;
- } else {
- dec_data.params.ndiskdat=0;
- m_wideGraph->setDiskUTC(-1);
- }
-
- m_bUseRef=m_wideGraph->useRef();
- if(!m_diskData) {
- refspectrum_(&dec_data.d2[k-m_nsps/2],&m_bClearRefSpec,&m_bRefSpec,
- &m_bUseRef, fname.constData (), (FCL)fname.size ());
- }
- m_bClearRefSpec=false;
-
- if(m_mode=="MSK144" or m_bFast9) {
- fastSink(frames);
- if(m_bFastMode) return;
- }
-
-// Get power, spectrum, and ihsym
- dec_data.params.nfa=m_wideGraph->nStartFreq();
- dec_data.params.nfb=m_wideGraph->Fmax();
- if(m_mode=="FST4") {
- dec_data.params.nfa=ui->sbF_Low->value();
- dec_data.params.nfb=ui->sbF_High->value();
- }
- int nsps=m_nsps;
- if(m_bFastMode) nsps=6912;
- int nsmo=m_wideGraph->smoothYellow()-1;
- bool bLowSidelobes=m_config.lowSidelobes();
- int npct=0;
- if(m_mode.startsWith("FST4")) npct=ui->sbNB->value();
- symspec_(&dec_data,&k,&m_TRperiod,&nsps,&m_inGain,&bLowSidelobes,&nsmo,&m_px,s,
- &m_df3,&m_ihsym,&m_npts8,&m_pxmax,&npct);
- if(m_mode=="WSPR" or m_mode=="FST4W") wspr_downsample_(dec_data.d2,&k);
- if(m_ihsym <=0) return;
- if(ui) ui->signal_meter_widget->setValue(m_px,m_pxmax); // Update thermometer
- if(m_monitoring || m_diskData) {
- m_wideGraph->dataSink2(s,m_df3,m_ihsym,m_diskData,m_px);
- }
- if(m_mode=="MSK144") return;
-
- fixStop();
- if (m_mode == "FreqCal"
- // only calculate after 1st chunk, also skip chunk where rig
- // changed frequency
- && !(m_ihsym % 8) && m_ihsym > 8 && m_ihsym <= m_hsymStop) {
- int RxFreq=ui->RxFreqSpinBox->value ();
- int nkhz=(m_freqNominal+RxFreq)/1000;
- int ftol = ui->sbFtol->value ();
- freqcal_(&dec_data.d2[0], &k, &nkhz, &RxFreq, &ftol, &line[0], (FCL)80);
- QString t=QString::fromLatin1(line);
- DecodedText decodedtext {t};
- ui->decodedTextBrowser->displayDecodedText (decodedtext, m_config.my_callsign(),
- m_mode, m_config.DXCC(), m_logBook, m_currentBand, m_config.ppfx());
- if (ui->measure_check_box->isChecked ()) {
- // Append results text to file "fmt.all".
- QFile f {m_config.writeable_data_dir ().absoluteFilePath ("fmt.all")};
- if (f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append)) {
- QTextStream out(&f);
- out << t
-#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0)
- << Qt::endl
-#else
- << endl
-#endif
- ;
- f.close();
- } else {
- MessageBox::warning_message (this, tr ("File Open Error")
- , tr ("Cannot open \"%1\" for append: %2")
- .arg (f.fileName ()).arg (f.errorString ()));
- }
- }
- if(m_ihsym==m_hsymStop && ui->actionFrequency_calibration->isChecked()) {
- freqCalStep();
- }
- if(m_position != 0) ui->decodedTextBrowser->horizontalScrollBar()->setValue(m_position);
- }
-
- if(m_ihsym==3*m_hsymStop/4) {
- m_dialFreqRxWSPR=m_freqNominal;
- }
-
- if(m_mode=="FT8") {
- to_jt9(m_ihsym,-1,-1); //Allow jt9 to bail out early, if necessary
- if(m_ihsym==40 and m_decoderBusy) {
- qDebug() << "Clearing hung decoder status";
- decodeDone(); //Clear a hung decoder status
- }
- }
-
- // ft8md
- static QDateTime last {QDateTime::currentDateTimeUtc().addSecs(-300)}; // ft8md
- static bool lastdelayed {false}; // ft8md
-
- if (m_mode=="FT8" && m_multithreadFT8) {
- if(m_diskData) m_delay=0;
-
- int ihsymdelay=0;
- if(m_delay > 0) {
- float fdelta=float(m_delay)*0.345; // 1/(0.29*10)
- if(fmod(fdelta,1.0)>0.49) ihsymdelay=qCeil(fdelta)+m_ihsym;
- else ihsymdelay=qFloor(fdelta)+m_ihsym;
- }
- //cycling approximately once per 269..301 milliseconds
- if((m_delay==0 && m_ihsym == m_hsymStop)
- || (m_delay > 0 && ihsymdelay >= m_hsymStop)) {
- QDateTime now = QDateTime::currentDateTimeUtc();
- //prevent dupe decoding
- if(lastdelayed && !m_modeChanged) {
- if(last.secsTo(now)<12) {
- lastdelayed=false;
- return;
- }
- lastdelayed=false;
- }
- if(m_delay>0) lastdelayed=true;
- }
- }
- // end of ft8md
-
- bool bCallDecoder=false;
-
- if(m_multithreadFT8 && m_ft8DecoderStart==1) m_earlyDecode2 = 46; // ft8md
-
- if(m_ihsym==m_hsymStop) bCallDecoder=true;
- if(m_mode=="FT8" && !m_diskData && !(m_multithreadFT8 && m_ft8DecoderStart>1)) { //ft8md Try to call MTD two times when "Very early" has been selected
- if(m_ihsym==m_earlyDecode) bCallDecoder=true;
- if(m_ihsym==m_earlyDecode2 && !(m_multithreadFT8 && m_ft8DecoderStart!=1)) bCallDecoder=true;
- }
-
- if(bCallDecoder) {
- if(m_mode=="Echo") {
- float dBerr=0.0;
- int nfrit=0;
- if(m_astroWidget) nfrit=m_astroWidget->nfRIT();
- int nauto=0;
- if(m_auto) nauto=1;
- int nqual=0;
- float f1=1500.0 + m_fDither;
- float xlevel=0.0;
- float sigdb=0.0;
- float dfreq=0.0;
- float width=m_fSpread;
- echocom_.nclearave=m_nclearave;
- int nDop=m_fAudioShift;
- if(m_astroWidget && m_astroWidget->DopplerMethod()==2) nDop=0; //Using CFOM
- int nDopTotal=m_fDop;
- int navg=ui->sbEchoAvg->value();
- int ndf=0;
- int idir=1;
- if(!ui->rbFixedTone->isChecked() and !m_diskData) {
- ndf=ui->sbToneSpacing->value();
- save_echo_params_(&nDopTotal,&nDop,&nfrit,&f1,&width,&ndf,&itone[0],dec_data.d2,&idir);
- }
- if(m_diskData) {
- idir=-1;
- save_echo_params_(&nDopTotal,&nDop,&nfrit,&f1,&width,&ndf,&itone[0],dec_data.d2,&idir);
- if(ndf==0 and ui->rbEchoMessage->isChecked()) ui->rbFixedTone->setChecked(true);
- }
-
- bool bEchoCall=ui->rbEchoMessage->isChecked();
- QString txcall=ui->leEchoMessage->text();
- static char crxcall[7];
- float xdt=0.0;
- avecho_(dec_data.d2,&nDop,&nfrit,&nauto,&ndf,&navg,&nqual,&f1,&xlevel,&sigdb,
- &dBerr,&dfreq,&width,&m_diskData,&bEchoCall,txcall.toLatin1().constData(),
- &crxcall[0],&xdt,(FCL)6,(FCL)6);
- crxcall[6]=0;
- QString rxcall {QString::fromLatin1(crxcall)};
-
- //Don't restart Monitor after an Echo transmission
- if(m_bEchoTxed and !m_auto) {
- monitor(false);
- m_bEchoTxed=false;
- }
-
- if(m_monitoring or m_auto or m_diskData) {
- QString t0,t1;
- if(m_diskData) {
- t0=t0.asprintf("%06d ",m_UTCdisk);
- } else {
- QDateTime now=QDateTime::currentDateTimeUtc();
- int ihr=now.toString("hh").toInt();
- int imin=now.toString("mm").toInt();
- int isec=now.toString("ss").toInt();
- if(m_auto) isec=isec - isec%6;
- if(!m_auto) isec=isec - isec%3;
- t0=t0.asprintf("%02d%02d%02d ",ihr,imin,isec);
- t1=now.toString("yyMMdd_");
- }
- int n=t0.toInt();
- int nsec=((n/10000)*3600) + (((n/100)%100)*60) + (n%100);
- if(!m_echoRunning or echocom_.nsum<2) m_echoSec0=nsec;
- float hour=n/10000 + ((n/100)%100)/60.0 + (n%100)/3600.0;
- m_echoRunning=true;
- if(ndf<0 or ndf>30) ndf=0;
- QString t;
- t = t.asprintf("%7.4f %5.2f %7d %7.1f %5d %5d %6d %6.1f %7.1f %5.2f %3d",hour,xlevel,
- nDopTotal,width,echocom_.nsum,nqual,qRound(dfreq),sigdb,dBerr,xdt,ndf);
- t = t0 + t + " " + rxcall;
- if(!bEchoCall) t=t.left(78);
- if(ui) ui->decodedTextBrowser->insertText(t);
- t=t1 + t;
- write_all("Rx",t);
- if(m_position != 0) ui->decodedTextBrowser->horizontalScrollBar()->setValue(m_position);
- }
-
- if(m_echoGraph->isVisible()) m_echoGraph->plotSpec();
- if(m_saveAll and !m_diskData) {
- if(ui->rbEchoMessage->isChecked()) ndf=ui->sbToneSpacing->value();
- int idir=1;
- save_echo_params_(&m_fDop,&nDop,&nfrit,&f1,&width,&ndf,&itone[0],dec_data.d2,&idir);
- m_fSpread=width;
- }
- m_nclearave=0;
- }
-
- if(m_mode=="FreqCal") return;
-
- if(m_dialFreqRxWSPR==0) m_dialFreqRxWSPR=m_freqNominal;
- m_dataAvailable=true;
- dec_data.params.npts8=(m_ihsym*m_nsps)/16;
- dec_data.params.newdat=1;
- dec_data.params.nagain=0;
- dec_data.params.nagainfil=0;
- dec_data.params.nzhsym=m_hsymStop;
- if(m_mode=="FT8" and m_ihsym==m_earlyDecode and !m_diskData && !(m_multithreadFT8 && m_ft8DecoderStart>1)) dec_data.params.nzhsym=m_earlyDecode;
- if(m_mode=="FT8" and m_ihsym==m_earlyDecode2 and !m_diskData && !(m_multithreadFT8 && m_ft8DecoderStart!=1)) dec_data.params.nzhsym=m_earlyDecode2;
- QDateTime now {QDateTime::currentDateTimeUtc ()};
- m_dateTime = now.toString ("yyyy-MMM-dd hh:mm");
- if(m_mode!="WSPR") {
- if (m_mode=="FT8" && m_multithreadFT8 && m_ihsym>47) last=now; // ft8md
- decode(); //Start decoder
- }
-
- if(m_mode=="FT8" and !(m_diskData or (m_multithreadFT8 && m_ft8DecoderStart<2)) and (m_ihsym==m_earlyDecode or m_ihsym==m_earlyDecode2)) return;
- if (!m_diskData)
- {
- if (!(m_mode=="FT8" && m_multithreadFT8)) Q_EMIT reset_audio_input_stream (true); // reports dropped samples
- }
- if(!m_diskData and (m_saveAll or m_saveDecoded or m_mode=="WSPR")) {
- //Always save unless "Save None"; may delete later
- if(m_TRperiod < 60) {
- int n=fmod(double(now.time().second()),m_TRperiod);
- if(n<(m_TRperiod/2)) n=n+m_TRperiod;
- if(m_mode=="Echo") n+=3;
- auto const& period_start=now.addSecs(-n);
- m_fnameWE=m_config.save_directory().absoluteFilePath (period_start.toString("yyMMdd_hhmmss"));
- } else {
- auto const& period_start = now.addSecs (-(now.time ().minute () % (int(m_TRperiod) / 60)) * 60);
- m_fnameWE=m_config.save_directory ().absoluteFilePath (period_start.toString ("yyMMdd_hhmm"));
- }
- int samples=m_TRperiod*12000;
- if(m_mode=="FT4") samples=21*3456;
- // the following is potential a threading hazard - not a good
- // idea to pass pointer to be processed in another thread
- m_saveWAVWatcher.setFuture (QtConcurrent::run (std::bind (&MainWindow::save_wave_file,
- this, m_fnameWE, &dec_data.d2[0], samples, m_config.my_callsign(),
- m_config.my_grid(), m_mode, m_nSubMode, m_freqNominalPeriod, m_hisCall, m_hisGrid)));
- if (m_mode=="WSPR") {
- auto c2name {(m_fnameWE + ".c2").toLocal8Bit ()};
- int nsec=120;
- int nbfo=1500;
- double f0m1500=m_freqNominal/1000000.0 + nbfo - 1500;
- int err = savec2_(c2name.constData (),&nsec,&f0m1500, (FCL)c2name.size());
- if (err!=0) MessageBox::warning_message (this, tr ("Error saving c2 file"), c2name);
- }
- }
- if(m_mode=="WSPR") {
- QStringList t2;
- QStringList depth_args;
- t2 << "-f" << QString {"%1"}.arg (m_dialFreqRxWSPR / 1e6, 0, 'f', 6);
- if((m_ndepth&7)==1) depth_args << "-qB"; //2 pass w subtract, no Block detection, no shift jittering
- if((m_ndepth&7)==2) depth_args << "-C" << "500" << "-o" << "4"; //3 pass, subtract, Block detection, OSD
- if((m_ndepth&7)==3) depth_args << "-C" << "500" << "-o" << "4" << "-d"; //3 pass, subtract, Block detect, OSD, more candidates
- QStringList degrade;
- degrade << "-d" << QString {"%1"}.arg (m_config.degrade(), 4, 'f', 1);
- m_cmndP1.clear ();
- if(m_diskData) {
- m_cmndP1 << depth_args << "-a"
- << QDir::toNativeSeparators (m_config.writeable_data_dir ().absolutePath()) << m_path;
- } else {
- m_cmndP1 << depth_args << "-a"
- << QDir::toNativeSeparators (m_config.writeable_data_dir ().absolutePath())
- << t2 << m_fnameWE + ".wav";
- }
- if (ui) ui->DecodeButton->setChecked (true);
- p1Timer.start(1000);
- m_decoderBusy = true;
- statusUpdate ();
- }
- m_rxDone=true;
- }
-}
-
-void MainWindow::startP1()
-{
- p1.start (QDir::toNativeSeparators (QDir {QApplication::applicationDirPath ()}.absoluteFilePath ("wsprd")), m_cmndP1);
-}
-
-QString MainWindow::save_wave_file (QString const& name, short const * data, int samples,
- QString const& my_callsign, QString const& my_grid, QString const& mode, qint32 sub_mode,
- Frequency frequency, QString const& his_call, QString const& his_grid) const
-{
- //
- // This member function runs in a thread and should not access
- // members that may be changed in the GUI thread or any other thread
- // without suitable synchronization.
- //
- QAudioFormat format;
- format.setCodec ("audio/pcm");
- format.setSampleRate (12000);
- format.setChannelCount (1);
- format.setSampleSize (16);
- format.setSampleType (QAudioFormat::SignedInt);
- auto source = QString {"%1; %2"}.arg (my_callsign).arg (my_grid);
- auto comment = QString {"Mode=%1%2; Freq=%3%4"}
- .arg (mode)
- .arg (QString {(mode.contains ('J') && !mode.contains ('+'))
- || mode.startsWith ("FST4") || mode.startsWith ('Q')
- ? QString {"; Sub Mode="} + QString::number (int (samples / 12000)) + QChar {'A' + sub_mode}
- : QString {}})
- .arg (Radio::frequency_MHz_string (frequency))
- .arg (QString {mode!="WSPR" ? QString {"; DXCall=%1; DXGrid=%2"}
- .arg (his_call)
- .arg (his_grid).toLocal8Bit () : ""});
- BWFFile::InfoDictionary list_info {
- {{{'I','S','R','C'}}, source.toLocal8Bit ()},
- {{{'I','S','F','T'}}, program_title (revision ()).simplified ().toLocal8Bit ()},
- {{{'I','C','R','D'}}, QDateTime::currentDateTimeUtc ()
- .toString ("yyyy-MM-ddTHH:mm:ss.zzzZ").toLocal8Bit ()},
- {{{'I','C','M','T'}}, comment.toLocal8Bit ()},
- };
- auto file_name = name + ".wav";
- BWFFile wav {format, file_name, list_info};
- if (!wav.open (BWFFile::WriteOnly)
- || 0 > wav.write (reinterpret_cast<char const *> (data)
- , sizeof (short) * samples))
- {
- return file_name + ": " + wav.errorString ();
- }
- return QString {};
-}
-
-//-------------------------------------------------------------- fastSink()
-void MainWindow::fastSink(qint64 frames)
-{
- int k (frames);
- bool decodeNow=false;
- filtered = false;
- ignored = false;
- m_muted = false;
- if(k < m_k0) { //New sequence ?
- memcpy(fast_green2,fast_green,4*703); //Copy fast_green[] to fast_green2[]
- memcpy(fast_s2,fast_s,4*703*64); //Copy fast_s[] into fast_s2[]
- fast_jh2=fast_jh;
- if(!m_diskData) memset(dec_data.d2,0,2*30*12000); //Zero the d2[] array
- m_bFastDecodeCalled=false;
- m_bDecoded=false;
- }
-
- QDateTime tnow=QDateTime::currentDateTimeUtc();
- int ihr=tnow.toString("hh").toInt();
- int imin=tnow.toString("mm").toInt();
- int isec=tnow.toString("ss").toInt();
- isec=isec - fmod(double(isec),m_TRperiod);
- int nutc0=10000*ihr + 100*imin + isec;
- if(m_diskData) nutc0=m_UTCdisk;
- char line[80];
- bool bmsk144=((m_mode=="MSK144") and (m_monitoring or m_diskData));
- line[0]=0;
-
- int RxFreq=ui->RxFreqSpinBox->value ();
- int nTRpDepth=m_TRperiod + 1000*(m_ndepth & 3);
- qint64 ms0 = QDateTime::currentMSecsSinceEpoch();
-// ::memcpy(dec_data.params.mycall, (m_baseCall+" ").toLatin1(),sizeof dec_data.params.mycall);
- ::memcpy(dec_data.params.mycall,(m_config.my_callsign () + " ").toLatin1(),sizeof dec_data.params.mycall);
- QString hisCall {ui->dxCallEntry->text ()};
- bool bshmsg=ui->cbShMsgs->isChecked();
- bool bswl=ui->cbSWL->isChecked();
-// ::memcpy(dec_data.params.hiscall,(Radio::base_callsign (hisCall) + " ").toLatin1 ().constData (), sizeof dec_data.params.hiscall);
- ::memcpy(dec_data.params.hiscall,(hisCall + " ").toLatin1 ().constData (), sizeof dec_data.params.hiscall);
- ::memcpy(dec_data.params.mygrid, (m_config.my_grid()+" ").toLatin1(), sizeof dec_data.params.mygrid);
- auto data_dir {m_config.writeable_data_dir ().absolutePath ().toLocal8Bit ()};
- float pxmax = 0;
- float rmsNoGain = 0;
- int ftol = ui->sbFtol->value ();
- hspec_(dec_data.d2,&k,&nutc0,&nTRpDepth,&RxFreq,&ftol,&bmsk144,
- &m_bTrain,m_phaseEqCoefficients.constData(),&m_inGain,&dec_data.params.mycall[0],
- &dec_data.params.hiscall[0],&bshmsg,&bswl,
- data_dir.constData (),fast_green,fast_s,&fast_jh,&pxmax,&rmsNoGain,&line[0],(FCL)12,
- (FCL)12,(FCL)data_dir.size (),(FCL)80);
- float px = fast_green[fast_jh];
- QString t;
- t = t.asprintf(" Rx noise: %5.1f ",px);
- ui->signal_meter_widget->setValue(rmsNoGain,pxmax); // Update thermometer
- m_fastGraph->plotSpec(m_diskData,m_UTCdisk);
-
- if(bmsk144 and (line[0]!=0)) {
- QString message {QString::fromLatin1 (line)};
- DecodedText decodedtext {message.replace (QChar::LineFeed, "")};
-
- QString text = decodedtext.string().replace("<","").replace(">",""); // for Wait features
-
- // Filtering for MSK144
- QString text2 = "";
- QStringList tw=text.mid(24).split(" ",SkipEmptyParts);
- if (m_config.filters_for_word2()) {
- if (tw.size () < 2) {
- text2 = "___"; // prevent segfault errors with free text messages
- } else if (tw[1].length() == 2 && tw[1].contains(QRegularExpression{"\\w\\w"})) { // directional calls
- if (tw.size () > 2) {
- text2 = tw[2]; // for directional calls analyze word 3 for filtering
- } else {
- text2 = "___"; // prevent segfault errors with free text messages
- }
- } else {
- text2 = tw[1]; // otherwise analyze word 2 for filtering
- }
- if (!(SpecOp::NONE==m_specOp && m_config.AlwaysPass () // Always pass messages with keywords from Always Pass list
- && (
- (text2.startsWith(m_config.Pass1()) && (m_config.Pass1()!=""))
- || (text2.startsWith(m_config.Pass2()) && (m_config.Pass2()!=""))
- || (text2.startsWith(m_config.Pass3()) && (m_config.Pass3()!=""))
- || (text2.startsWith(m_config.Pass4()) && (m_config.Pass4()!=""))
- || (text2.startsWith(m_config.Pass5()) && (m_config.Pass5()!=""))
- || (text2.startsWith(m_config.Pass6()) && (m_config.Pass6()!=""))
- || (text2.startsWith(m_config.Pass7()) && (m_config.Pass7()!=""))
- || (text2.startsWith(m_config.Pass8()) && (m_config.Pass8()!=""))
- || (text2.startsWith(m_config.Pass9()) && (m_config.Pass9()!=""))
- || (text2.startsWith(m_config.Pass10()) && (m_config.Pass10()!=""))
- || (text2.startsWith(m_config.Pass11()) && (m_config.Pass11()!=""))
- || (text2.startsWith(m_config.Pass12()) && (m_config.Pass12()!=""))
- ))) {
-
- // Filtering out messages with keywords from Blacklist
- if (SpecOp::NONE==m_specOp && m_config.Blacklisted ()
- && (
- (text2.startsWith(m_config.Blacklist1()) && (m_config.Blacklist1()!=""))
- || (text2.startsWith(m_config.Blacklist2()) && (m_config.Blacklist2()!=""))
- || (text2.startsWith(m_config.Blacklist3()) && (m_config.Blacklist3()!=""))
- || (text2.startsWith(m_config.Blacklist4()) && (m_config.Blacklist4()!=""))
- || (text2.startsWith(m_config.Blacklist5()) && (m_config.Blacklist5()!=""))
- || (text2.startsWith(m_config.Blacklist6()) && (m_config.Blacklist6()!=""))
- || (text2.startsWith(m_config.Blacklist7()) && (m_config.Blacklist7()!=""))
- || (text2.startsWith(m_config.Blacklist8()) && (m_config.Blacklist8()!=""))
- || (text2.startsWith(m_config.Blacklist9()) && (m_config.Blacklist9()!=""))
- || (text2.startsWith(m_config.Blacklist10()) && (m_config.Blacklist10()!=""))
- || (text2.startsWith(m_config.Blacklist11()) && (m_config.Blacklist11()!=""))
- || (text2.startsWith(m_config.Blacklist12()) && (m_config.Blacklist12()!=""))
- )) {
- if (!ui->cbBypass->isChecked()) filtered = true;
- if (!(m_config.filters_for_Wait_and_Pounce_only() or ui->cbBypass->isChecked())) return;
- // reset dB score when filtered
- if (pounce && (ui->respondComboBox->currentText()=="CQ: Max Dist"
- or ui->respondComboBox->currentText()=="CQ: Max dB"
- or ui->respondComboBox->currentText()=="CQ: Min dB")) {
- Dpoints=0;
- maxDPoints=0;
- dBpoints=-28;
- dBpoints2=99;
- maxdBPoints=-28;
- mindBPoints=99;
- }
-
- // Filtering out everything but messages with keywords from Whitelist
- } else if (SpecOp::NONE==m_specOp && m_config.Whitelisted ()
- && !(text2.startsWith(m_config.Whitelist1()) && (m_config.Whitelist1()!=""))
- && !(text2.startsWith(m_config.Whitelist2()) && (m_config.Whitelist2()!=""))
- && !(text2.startsWith(m_config.Whitelist3()) && (m_config.Whitelist3()!=""))
- && !(text2.startsWith(m_config.Whitelist4()) && (m_config.Whitelist4()!=""))
- && !(text2.startsWith(m_config.Whitelist5()) && (m_config.Whitelist5()!=""))
- && !(text2.startsWith(m_config.Whitelist6()) && (m_config.Whitelist6()!=""))
- && !(text2.startsWith(m_config.Whitelist7()) && (m_config.Whitelist7()!=""))
- && !(text2.startsWith(m_config.Whitelist8()) && (m_config.Whitelist8()!=""))
- && !(text2.startsWith(m_config.Whitelist9()) && (m_config.Whitelist9()!=""))
- && !(text2.startsWith(m_config.Whitelist10()) && (m_config.Whitelist10()!=""))
- && !(text2.startsWith(m_config.Whitelist11()) && (m_config.Whitelist11()!=""))
- && !(text2.startsWith(m_config.Whitelist12()) && (m_config.Whitelist12()!=""))
- ) {
- if (!ui->cbBypass->isChecked()) filtered = true;
- if (!(m_config.filters_for_Wait_and_Pounce_only() or ui->cbBypass->isChecked())) return;
- // reset dB score when filtered
- if (pounce && (ui->respondComboBox->currentText()=="CQ: Max Dist"
- or ui->respondComboBox->currentText()=="CQ: Max dB"
- or ui->respondComboBox->currentText()=="CQ: Min dB")) {
- Dpoints=0;
- maxDPoints=0;
- dBpoints=-28;
- dBpoints2=99;
- maxdBPoints=-28;
- mindBPoints=99;
- }
- }
-
- // search logbook for filtering
- if (ui->actionHideTerritory1->isChecked() or ui->actionHideTerritory2->isChecked() or
- ui->actionHideTerritory3->isChecked() or ui->actionHideTerritory4->isChecked() or
- ui->actionHideB4->isChecked() or ui->actionHideEU->isChecked() or ui->actionHideAS->isChecked() or
- ui->actionHideNA->isChecked() or ui->actionHideSA->isChecked() or ui->actionHideAF->isChecked() or
- ui->actionHideOC->isChecked() or ui->actionHideAN->isChecked()) {
- QString deCall;
- QString deGrid;
- decodedtext.deCallAndGrid(/*out*/deCall,deGrid);
- // search for country names
- if (ui->actionHideTerritory1->isChecked() or ui->actionHideTerritory2->isChecked() or
- ui->actionHideTerritory3->isChecked() or ui->actionHideTerritory4->isChecked()) {
- auto const& looked_up = m_logBook.countries ()->lookup (deCall);
- auto countryName = looked_up.entity_name;
- // do some obvious abbreviations
- countryName.replace ("Islands", "Is.");
- countryName.replace ("Island", "Is.");
- countryName.replace ("North ", "N. ");
- countryName.replace ("Northern ", "N. ");
- countryName.replace ("South ", "S. ");
- countryName.replace ("East ", "E. ");
- countryName.replace ("Eastern ", "E. ");
- countryName.replace ("West ", "W. ");
- countryName.replace ("Western ", "W. ");
- countryName.replace ("Central ", "C. ");
- countryName.replace (" and ", " & ");
- countryName.replace ("Republic", "Rep.");
- countryName.replace ("United States of America", "U.S.A.");
- countryName.replace ("United States", "U.S.A.");
- countryName.replace ("Fed. Rep. of ", "");
- countryName.replace ("French ", "Fr.");
- countryName.replace ("Asiatic", "AS");
- countryName.replace ("European", "EU");
- countryName.replace ("African", "AF");
- if (ui->actionHideTerritory1->isChecked() && countryName.contains(m_config.Territory1())
- && (m_config.Territory1()!="") && !ui->cbBypass->isChecked()) filtered = true;
- if (ui->actionHideTerritory2->isChecked() && countryName.contains(m_config.Territory2())
- && (m_config.Territory2()!="") && !ui->cbBypass->isChecked()) filtered = true;
- if (ui->actionHideTerritory3->isChecked() && countryName.contains(m_config.Territory3())
- && (m_config.Territory3()!="") && !ui->cbBypass->isChecked()) filtered = true;
- if (ui->actionHideTerritory4->isChecked() && countryName.contains(m_config.Territory4())
- && (m_config.Territory4()!="") && !ui->cbBypass->isChecked()) filtered = true;
- }
- // search for callsigns worked B4 on band
- if (ui->actionHideB4->isChecked()) {
- bool callB4onBand;
- bool countryB4onBand;
- bool gridB4onBand;
- bool continentB4onBand;
- bool CQZoneB4onBand;
- bool ITUZoneB4onBand;
- auto const& looked_up = m_logBook.countries ()->lookup (deCall);
- m_logBook.match (deCall, m_mode, deGrid, looked_up, callB4onBand, countryB4onBand, gridB4onBand,
- continentB4onBand, CQZoneB4onBand, ITUZoneB4onBand, m_currentBand);
- if (callB4onBand && ui->actionHideB4->isChecked() && !ui->cbBypass->isChecked()) filtered = true;
- }
- // search for continents
- if (ui->actionHideEU->isChecked() or ui->actionHideAS->isChecked() or ui->actionHideNA->isChecked()
- or ui->actionHideSA->isChecked() or ui->actionHideAF->isChecked() or ui->actionHideOC->isChecked()
- or ui->actionHideAN->isChecked()) {
- auto const& looked_up = m_logBook.countries ()->lookup (deCall);
- QString continent = AD1CCty::continent (looked_up.continent);
- if (ui->actionHideEU->isChecked() && continent == "EU" && !ui->cbBypass->isChecked()) filtered = true;
- if (ui->actionHideAS->isChecked() && continent == "AS" && !ui->cbBypass->isChecked()) filtered = true;
- if (ui->actionHideNA->isChecked() && continent == "NA" && !ui->cbBypass->isChecked()) filtered = true;
- if (ui->actionHideSA->isChecked() && continent == "SA" && !ui->cbBypass->isChecked()) filtered = true;
- if (ui->actionHideAF->isChecked() && continent == "AF" && !ui->cbBypass->isChecked()) filtered = true;
- if (ui->actionHideOC->isChecked() && continent == "OC" && !ui->cbBypass->isChecked()) filtered = true;
- if (ui->actionHideAN->isChecked() && continent == "AN" && !ui->cbBypass->isChecked()) filtered = true;
- }
- }
- }
- } else {
- if (!(SpecOp::NONE==m_specOp && m_config.AlwaysPass () // Always pass messages with keywords from Always Pass list
- && (
- (text.contains(m_config.Pass1()) && (m_config.Pass1()!=""))
- || (text.contains(m_config.Pass2()) && (m_config.Pass2()!=""))
- || (text.contains(m_config.Pass3()) && (m_config.Pass3()!=""))
- || (text.contains(m_config.Pass4()) && (m_config.Pass4()!=""))
- || (text.contains(m_config.Pass5()) && (m_config.Pass5()!=""))
- || (text.contains(m_config.Pass6()) && (m_config.Pass6()!=""))
- || (text.contains(m_config.Pass7()) && (m_config.Pass7()!=""))
- || (text.contains(m_config.Pass8()) && (m_config.Pass8()!=""))
- || (text.contains(m_config.Pass9()) && (m_config.Pass9()!=""))
- || (text.contains(m_config.Pass10()) && (m_config.Pass10()!=""))
- || (text.contains(m_config.Pass11()) && (m_config.Pass11()!=""))
- || (text.contains(m_config.Pass12()) && (m_config.Pass12()!=""))
- ))) {
-
- // Filtering out messages with keywords from Blacklist
- if (SpecOp::NONE==m_specOp && m_config.Blacklisted ()
- && (
- (text.contains(m_config.Blacklist1()) && (m_config.Blacklist1()!=""))
- || (text.contains(m_config.Blacklist2()) && (m_config.Blacklist2()!=""))
- || (text.contains(m_config.Blacklist3()) && (m_config.Blacklist3()!=""))
- || (text.contains(m_config.Blacklist4()) && (m_config.Blacklist4()!=""))
- || (text.contains(m_config.Blacklist5()) && (m_config.Blacklist5()!=""))
- || (text.contains(m_config.Blacklist6()) && (m_config.Blacklist6()!=""))
- || (text.contains(m_config.Blacklist7()) && (m_config.Blacklist7()!=""))
- || (text.contains(m_config.Blacklist8()) && (m_config.Blacklist8()!=""))
- || (text.contains(m_config.Blacklist9()) && (m_config.Blacklist9()!=""))
- || (text.contains(m_config.Blacklist10()) && (m_config.Blacklist10()!=""))
- || (text.contains(m_config.Blacklist11()) && (m_config.Blacklist11()!=""))
- || (text.contains(m_config.Blacklist12()) && (m_config.Blacklist12()!=""))
- )) {
- if (!ui->cbBypass->isChecked()) filtered = true;
- if (!(m_config.filters_for_Wait_and_Pounce_only() or ui->cbBypass->isChecked())) return;
- // reset dB score when filtered
- if (pounce && (ui->respondComboBox->currentText()=="CQ: Max Dist"
- or ui->respondComboBox->currentText()=="CQ: Max dB"
- or ui->respondComboBox->currentText()=="CQ: Min dB")) {
- Dpoints=0;
- maxDPoints=0;
- dBpoints=-28;
- dBpoints2=99;
- maxdBPoints=-28;
- mindBPoints=99;
- }
-
- // Filtering out everything but messages with keywords from Whitelist
- } else if (SpecOp::NONE==m_specOp && m_config.Whitelisted ()
- && !(text.contains(m_config.Whitelist1()) && (m_config.Whitelist1()!=""))
- && !(text.contains(m_config.Whitelist2()) && (m_config.Whitelist2()!=""))
- && !(text.contains(m_config.Whitelist3()) && (m_config.Whitelist3()!=""))
- && !(text.contains(m_config.Whitelist4()) && (m_config.Whitelist4()!=""))
- && !(text.contains(m_config.Whitelist5()) && (m_config.Whitelist5()!=""))
- && !(text.contains(m_config.Whitelist6()) && (m_config.Whitelist6()!=""))
- && !(text.contains(m_config.Whitelist7()) && (m_config.Whitelist7()!=""))
- && !(text.contains(m_config.Whitelist8()) && (m_config.Whitelist8()!=""))
- && !(text.contains(m_config.Whitelist9()) && (m_config.Whitelist9()!=""))
- && !(text.contains(m_config.Whitelist10()) && (m_config.Whitelist10()!=""))
- && !(text.contains(m_config.Whitelist11()) && (m_config.Whitelist11()!=""))
- && !(text.contains(m_config.Whitelist12()) && (m_config.Whitelist12()!=""))
- ) {
- if (!ui->cbBypass->isChecked()) filtered = true;
- if (!(m_config.filters_for_Wait_and_Pounce_only() or ui->cbBypass->isChecked())) return;
- // reset dB score when filtered
- if (pounce && (ui->respondComboBox->currentText()=="CQ: Max Dist"
- or ui->respondComboBox->currentText()=="CQ: Max dB"
- or ui->respondComboBox->currentText()=="CQ: Min dB")) {
- Dpoints=0;
- maxDPoints=0;
- dBpoints=-28;
- dBpoints2=99;
- maxdBPoints=-28;
- mindBPoints=99;
- }
- }
-
- // search logbook for filtering
- if (ui->actionHideTerritory1->isChecked() or ui->actionHideTerritory2->isChecked() or
- ui->actionHideTerritory3->isChecked() or ui->actionHideTerritory4->isChecked() or
- ui->actionHideB4->isChecked() or ui->actionHideEU->isChecked() or ui->actionHideAS->isChecked() or
- ui->actionHideNA->isChecked() or ui->actionHideSA->isChecked() or ui->actionHideAF->isChecked() or
- ui->actionHideOC->isChecked() or ui->actionHideAN->isChecked()) {
- QString deCall;
- QString deGrid;
- decodedtext.deCallAndGrid(/*out*/deCall,deGrid);
- // search for country names
- if (ui->actionHideTerritory1->isChecked() or ui->actionHideTerritory2->isChecked() or
- ui->actionHideTerritory3->isChecked() or ui->actionHideTerritory4->isChecked()) {
- auto const& looked_up = m_logBook.countries ()->lookup (deCall);
- auto countryName = looked_up.entity_name;
- // do some obvious abbreviations
- countryName.replace ("Islands", "Is.");
- countryName.replace ("Island", "Is.");
- countryName.replace ("North ", "N. ");
- countryName.replace ("Northern ", "N. ");
- countryName.replace ("South ", "S. ");
- countryName.replace ("East ", "E. ");
- countryName.replace ("Eastern ", "E. ");
- countryName.replace ("West ", "W. ");
- countryName.replace ("Western ", "W. ");
- countryName.replace ("Central ", "C. ");
- countryName.replace (" and ", " & ");
- countryName.replace ("Republic", "Rep.");
- countryName.replace ("United States of America", "U.S.A.");
- countryName.replace ("United States", "U.S.A.");
- countryName.replace ("Fed. Rep. of ", "");
- countryName.replace ("French ", "Fr.");
- countryName.replace ("Asiatic", "AS");
- countryName.replace ("European", "EU");
- countryName.replace ("African", "AF");
- if (ui->actionHideTerritory1->isChecked() && countryName.contains(m_config.Territory1())
- && (m_config.Territory1()!="") && !ui->cbBypass->isChecked()) filtered = true;
- if (ui->actionHideTerritory2->isChecked() && countryName.contains(m_config.Territory2())
- && (m_config.Territory2()!="") && !ui->cbBypass->isChecked()) filtered = true;
- if (ui->actionHideTerritory3->isChecked() && countryName.contains(m_config.Territory3())
- && (m_config.Territory3()!="") && !ui->cbBypass->isChecked()) filtered = true;
- if (ui->actionHideTerritory4->isChecked() && countryName.contains(m_config.Territory4())
- && (m_config.Territory4()!="") && !ui->cbBypass->isChecked()) filtered = true;
- }
- // search for callsigns worked B4 on band
- if (ui->actionHideB4->isChecked()) {
- bool callB4onBand;
- bool countryB4onBand;
- bool gridB4onBand;
- bool continentB4onBand;
- bool CQZoneB4onBand;
- bool ITUZoneB4onBand;
- auto const& looked_up = m_logBook.countries ()->lookup (deCall);
- m_logBook.match (deCall, m_mode, deGrid, looked_up, callB4onBand, countryB4onBand, gridB4onBand,
- continentB4onBand, CQZoneB4onBand, ITUZoneB4onBand, m_currentBand);
- if (callB4onBand && ui->actionHideB4->isChecked() && !ui->cbBypass->isChecked()) filtered = true;
- }
- // search for continents
- if (ui->actionHideEU->isChecked() or ui->actionHideAS->isChecked() or ui->actionHideNA->isChecked()
- or ui->actionHideSA->isChecked() or ui->actionHideAF->isChecked() or ui->actionHideOC->isChecked()
- or ui->actionHideAN->isChecked()) {
- auto const& looked_up = m_logBook.countries ()->lookup (deCall);
- QString continent = AD1CCty::continent (looked_up.continent);
- if (ui->actionHideEU->isChecked() && continent == "EU" && !ui->cbBypass->isChecked()) filtered = true;
- if (ui->actionHideAS->isChecked() && continent == "AS" && !ui->cbBypass->isChecked()) filtered = true;
- if (ui->actionHideNA->isChecked() && continent == "NA" && !ui->cbBypass->isChecked()) filtered = true;
- if (ui->actionHideSA->isChecked() && continent == "SA" && !ui->cbBypass->isChecked()) filtered = true;
- if (ui->actionHideAF->isChecked() && continent == "AF" && !ui->cbBypass->isChecked()) filtered = true;
- if (ui->actionHideOC->isChecked() && continent == "OC" && !ui->cbBypass->isChecked()) filtered = true;
- if (ui->actionHideAN->isChecked() && continent == "AN" && !ui->cbBypass->isChecked()) filtered = true;
- }
- }
- }
- }
-
- // hide or ignore callsigns for MSK144
- if (ui->actionHideIgnored->isChecked() or ui->actionHideToday->isChecked() or ui->actionIgnoreIgnored->isChecked() or ui->actionIgnoreToday->isChecked()) {
- QString today = QDateTime::currentDateTimeUtc().toString ("yyyy-MM-dd");
- QString yesterday = QDateTime::currentDateTimeUtc().addDays(-1).toString ("yyyy-MM-dd");
- QString deCall;
- QString deGrid;
- decodedtext.deCallAndGrid(/*out*/deCall,deGrid);
- if (ui->actionHideIgnored->isChecked() && !ui->cbBypass->isChecked() && ignoreList.contains(deCall + ",")) filtered = true;
- if (ui->actionHideToday->isChecked() && !ui->cbBypass->isChecked() && (
- txLog.contains(QRegularExpression{today + ",[0-9][0-9]:[0-9][0-9]:[0-9][0-9]," + (deCall + ",")})
- or (m_config.twoDays() && txLog.contains(QRegularExpression{yesterday + ",[0-9][0-9]:[0-9][0-9]:[0-9][0-9]," + (deCall + ",")})))) {
- filtered = true;
- }
- if (ui->actionIgnoreIgnored->isChecked() && ignoreList.contains(deCall + ",")) {
- ignored = true;
- m_muted = true;
- }
- if (ui->actionIgnoreToday->isChecked() && (txLog.contains(QRegularExpression{today + ",[0-9][0-9]:[0-9][0-9]:[0-9][0-9]," + (deCall + ",")})
- or (m_config.twoDays() && txLog.contains(QRegularExpression{yesterday + ",[0-9][0-9]:[0-9][0-9]:[0-9][0-9]," + (deCall + ",")})))) {
- ignored = true;
- m_muted = true;
- }
- }
- if (ui->actionIgnoreB4->isChecked() && (pounce or m_auto)) {
- QString deCall;
- QString deGrid;
- decodedtext.deCallAndGrid(/*out*/deCall,deGrid);
- bool callB4onBand;
- bool countryB4onBand;
- bool gridB4onBand;
- bool continentB4onBand;
- bool CQZoneB4onBand;
- bool ITUZoneB4onBand;
- auto const& looked_up = m_logBook.countries ()->lookup (deCall);
- m_logBook.match (deCall, m_mode, deGrid, looked_up, callB4onBand, countryB4onBand, gridB4onBand,
- continentB4onBand, CQZoneB4onBand, ITUZoneB4onBand, m_currentBand);
- if (callB4onBand && ui->actionIgnoreB4->isChecked() && !ui->cbBypass->isChecked()) {
- ignored = true;
- m_muted = true;
- }
- }
-
- // Stop Wait & Call timeout when in QSO with this station for MSK144
- if (ui->DX_Call_Button->isChecked() && m_hisCall!="" && text.contains(" " + m_config.my_callsign() + " " + m_hisCall)) {
- stopWCTimer.stop(); // stop any Wait & Call timeout
- if (ui->DX_Call_Button->isChecked()) ui->DX_Call_Button->click (); // disable Wait & Call
- no_wait_and_call = false; // reset Wait & Call
- }
-
- // Wait & Reply for MSK144
- if (text.contains(" " + m_config.my_callsign() + " " + m_hisCall) && m_hisCall!="" &&
- !text.contains("73 ") && m_mode=="MSK144" && m_config.Wait_features_enabled()
- && !ui->autoButton->isChecked()
- && (!(ui->actionFull_Duplex_Mode->isChecked() && m_txing))) {
- tx_watchdog (false);
- m_bDoubleClicked = true;
- processMessage(decodedtext);
- auto_tx_mode(true);
- stopWRTimer.start(int(12000.0*m_TRperiod)); // Wait & Reply Tx max 12*TRperiod
- }
-
- // Wait & Call for MSK144
- if (m_mode=="MSK144" && wait_and_call && m_specOp!=SpecOp::FOX && ui->cbAutoSeq->isChecked() &&
- m_hisCall!="" && (text.contains("CQ " + m_hisCall) or text.contains("CQ DX " + m_hisCall) or text.contains(m_hisCall + " RR73")
- or text.contains(m_hisCall + " RRR") or text.contains(m_hisCall + " 73")) && m_config.Wait_features_enabled()
- && (!(ui->actionFull_Duplex_Mode->isChecked() && m_txing))) {
- m_bDoubleClicked = true;
- processMessage(decodedtext);
- auto_tx_mode(true);
- no_wait_and_call = true;
- stopWCTimer.start(int(6200.0*m_TRperiod)); // Wait & Call Tx max 6*TRperiod
- }
-
- // CQ: First for MSK144
- if(((pounce && text.contains(" CQ ") && m_config.Wait_features_enabled())
- or (m_auto && m_bCallingCQ && text.contains(" " + m_config.my_callsign() + " "))) && !ignored
- && !filtered && !selected && ui->respondComboBox->isVisible() && ui->respondComboBox->currentText()=="CQ: First"
- && (!(ui->actionFull_Duplex_Mode->isChecked() && m_txing))) {
- m_bDoubleClicked=true;
- selected = true;
- auto_tx_mode(true);
- processMessage(decodedtext);
- auto now = QDateTime::currentDateTimeUtc();
- m_dateTimeQSOOn = now.addSecs (-(m_ntx - 1) * int(m_TRperiod) - int(fmod(double(now.time().second()),m_TRperiod)));
- QTimer::singleShot (6000, [=] {selected = false;});
- if (pounce) stopWCTimer.start(int(6200.0*m_TRperiod)); // Tx max 6*TRperiod
- }
-
- // CQ: Max Dist for MSK144
- if((pounce or m_auto) && ui->respondComboBox->isVisible() && ui->respondComboBox->currentText()=="CQ: Max Dist"
- && (!(ui->actionFull_Duplex_Mode->isChecked() && m_txing))) {
- QString deCall;
- QString deGrid;
- decodedtext.deCallAndGrid(/*out*/deCall,deGrid);
- if (!filtered && !ignored && (deGrid.contains(grid_regexp) or m_bCallingCQ) && (
- (pounce && text.contains(" CQ ") && !txLog.contains(deCall) && m_config.Wait_features_enabled()) or
- (m_bCallingCQ && text.contains(" " + m_config.my_callsign() + " ") && !text.contains("73 "))
- )) {
- double utch=0.0;
- int nAz,nEl,nDmiles,nDkm,nHotAz,nHotABetter;
- azdist_(const_cast <char *> ((m_config.my_grid () + " ").left (6).toLatin1().constData()),
- const_cast <char *> ((deGrid + " ").left (6).toLatin1().constData()),&utch,
- &nAz,&nEl,&nDmiles,&nDkm,&nHotAz,&nHotABetter,6,6);
- Dpoints=nDkm;
- if (!deGrid.contains(grid_regexp)) Dpoints=1;
- if(Dpoints>maxDPoints) {
- maxDPoints=Dpoints;
- m_deCall=deCall;
- m_bDoubleClicked=true;
- if ((pounce && text.contains(" CQ ") && m_config.Wait_features_enabled()) or m_auto) {
- auto_tx_mode(true);
- processMessage(decodedtext);
- if (pounce) stopWCTimer.start(int(6200.0*m_TRperiod)); // Tx max 6*TRperiod
- }
- ui->dxCallEntry->setText(deCall);
- genStdMsgs(QString::number(decodedtext.snr()));
- ui->RxFreqSpinBox->setValue(decodedtext.frequencyOffset());
- setTxMsg(m_ntx);
- m_currentMessageType=m_ntx;
- auto now = QDateTime::currentDateTimeUtc();
- m_dateTimeQSOOn = now.addSecs (-(m_ntx - 1) * int(m_TRperiod) - int(fmod(double(now.time().second()),m_TRperiod)));
- }
- }
- }
-
- // CQ: Max dB for MSK144
- if((pounce or m_auto) && ui->respondComboBox->isVisible() && ui->respondComboBox->currentText()=="CQ: Max dB"
- && (!(ui->actionFull_Duplex_Mode->isChecked() && m_txing))) {
- QString deCall;
- QString deGrid;
- decodedtext.deCallAndGrid(/*out*/deCall,deGrid);
- if (!filtered && !ignored && (
- (pounce && text.contains(" CQ ") && !txLog.contains(deCall) && m_config.Wait_features_enabled()) or
- (m_bCallingCQ && text.contains(" " + m_config.my_callsign() + " ") && !text.contains("73 "))
- )) {
- dBpoints=decodedtext.string().mid(7,3).toInt();
- if(dBpoints>maxdBPoints) {
- maxdBPoints=dBpoints;
- m_deCall=deCall;
- m_bDoubleClicked=true;
- if ((pounce && text.contains(" CQ ") && m_config.Wait_features_enabled()) or m_auto) {
- auto_tx_mode(true);
- processMessage(decodedtext);
- if (pounce) stopWCTimer.start(int(6200.0*m_TRperiod)); // Tx max 6*TRperiod
- }
- ui->dxCallEntry->setText(deCall);
- genStdMsgs(QString::number(decodedtext.snr()));
- ui->RxFreqSpinBox->setValue(decodedtext.frequencyOffset());
- setTxMsg(m_ntx);
- m_currentMessageType=m_ntx;
- auto now = QDateTime::currentDateTimeUtc();
- m_dateTimeQSOOn = now.addSecs (-(m_ntx - 1) * int(m_TRperiod) - int(fmod(double(now.time().second()),m_TRperiod)));
- }
- }
- }
-
- // CQ: Min dB for MSK144
- if((pounce or m_auto) && ui->respondComboBox->isVisible() && ui->respondComboBox->currentText()=="CQ: Min dB"
- && (!(ui->actionFull_Duplex_Mode->isChecked() && m_txing))) {
- QString deCall;
- QString deGrid;
- decodedtext.deCallAndGrid(/*out*/deCall,deGrid);
- if (!filtered && !ignored && (
- (pounce && text.contains(" CQ ") && !txLog.contains(deCall) && m_config.Wait_features_enabled()) or
- (m_bCallingCQ && text.contains(" " + m_config.my_callsign() + " ") && !text.contains("73 "))
- )) {
- dBpoints2=decodedtext.string().mid(7,3).toInt();
- if(dBpoints2<mindBPoints) {
- mindBPoints=dBpoints2;
- m_deCall=deCall;
- m_bDoubleClicked=true;
- if ((pounce && text.contains(" CQ ") && m_config.Wait_features_enabled()) or m_auto) {
- auto_tx_mode(true);
- processMessage(decodedtext);
- if (pounce) stopWCTimer.start(int(6200.0*m_TRperiod)); // Tx max 6*TRperiod
- }
- ui->dxCallEntry->setText(deCall);
- genStdMsgs(QString::number(decodedtext.snr()));
- ui->RxFreqSpinBox->setValue(decodedtext.frequencyOffset());
- setTxMsg(m_ntx);
- m_currentMessageType=m_ntx;
- auto now = QDateTime::currentDateTimeUtc();
- m_dateTimeQSOOn = now.addSecs (-(m_ntx - 1) * int(m_TRperiod) - int(fmod(double(now.time().second()),m_TRperiod)));
- }
- }
- }
- // show distance and bearing for MSK144
- if (!filtered or m_config.filters_for_Wait_and_Pounce_only()) {
- QString distance;
- QString deCall;
- QString deGrid;
- decodedtext.deCallAndGrid(deCall,deGrid);
- if ((m_config.showDistance() || m_config.showAzimuth()) && deGrid.contains(grid_regexp)) {
- double utch=0.0;
- int nAz,nEl,nDmiles,nDkm,nHotAz,nHotABetter;
- QString my_Grid = m_config.my_grid();
- if (my_Grid.length() < 5) my_Grid = m_config.my_grid().left(4)+"mm";
- QString de_Grid= deGrid.left(4)+"mm";
- azdist_(const_cast <char *> (my_Grid.toLatin1().constData()),
- const_cast <char *> (de_Grid.toLatin1().constData()),&utch,
- &nAz,&nEl,&nDmiles,&nDkm,&nHotAz,&nHotABetter,(FCL)6,(FCL)6);
- if (m_config.showDistance()) {
- int nd=nDkm;
- if(m_config.miles()) nd=nDmiles;
- distance = QString::number(nd);
- if(m_config.miles()) distance += " mi";
- if(!m_config.miles()) distance += " km";
- }
- if (m_config.showAzimuth()) {
- if (distance.length()) distance += " / ";
- distance += QString::number(nAz) + "°";
- }
- }
-
- // mute audible alerts when callsign is on the Ignored List for MSK144
- if (m_config.alert_Enabled() && !ui->cbBypass->isChecked() && deCall!="" && ignoreList.contains(deCall + ",")) m_muted = true;
-
- // insert blank line for MSK144
- int ntime=6;
- if ((m_config.insert_blank() or m_config.alert_Enabled()) && !BlankLineInserted && (text.left(ntime) != m_tBlankLine) && text.left(4).contains(QRegularExpression {"\\d\\d\\d\\d"}) && !m_diskData) {
- ui->decodedTextBrowser->new_period ();
- if (m_config.insert_blank () && (!filtered or m_config.filters_for_Wait_and_Pounce_only())) {
- QString band;
- if(((QDateTime::currentMSecsSinceEpoch() / 1000 - m_secBandChanged) > 4*int(m_TRperiod)/4) or m_displayBand) {
- band = ' ' + m_config.bands ()->find (m_freqNominal);
- }
- if (m_config.insert_blank ()) {
- if (ui->actionUse_Dark_Style->isChecked()) {
- if (m_config.detailed_blank()) {
- if (m_config.DXCC()) {
- ui->decodedTextBrowser->insertText(("------ " + m_dateTimeSeqStart.toString("yyyy-MM-dd - hh:mm:ss' UTC - '") + m_currentBandPeriod + " - " + m_mode + " ------"), "#a2a2a2", "#000000");
- } else {
- ui->decodedTextBrowser->insertText(("------ " + m_dateTimeSeqStart.toString("yyyy-MM-dd - hh:mm:ss' UTC - '") + m_currentBandPeriod + " - " + m_mode), "#a2a2a2", "#000000");
- }
- } else {
- ui->decodedTextBrowser->insertText(band.rightJustified(40, '-'), "#a2a2a2", "#000000");
- }
- } else {
- if (m_config.detailed_blank()) {
- if (m_config.DXCC()) {
- ui->decodedTextBrowser->insertLineSpacer ("------ " + m_dateTimeSeqStart.toString("yyyy-MM-dd - hh:mm:ss' UTC - '") + m_currentBandPeriod + " - " + m_mode + " ------");
- } else {
- ui->decodedTextBrowser->insertLineSpacer ("------ " + m_dateTimeSeqStart.toString("yyyy-MM-dd - hh:mm:ss' UTC - '") + m_currentBandPeriod + " - " + m_mode);
- }
- } else {
- ui->decodedTextBrowser->insertLineSpacer (band.rightJustified (40, '-'));
- }
- }
- }
- BlankLineInserted = true;
- m_tBlankLine = text.left(ntime);
- }
- }
-
- // display decodes for the fast modes must be done before highlighting any call or grid for MSK144
- bool haveFSpread {false};
- float fSpread {0.};
- bool bDisplayPoints {false};
- m_points = 0;
-
- ui->decodedTextBrowser->displayDecodedText (decodedtext, m_config.my_callsign (), m_mode, m_config.DXCC (),
- m_logBook, m_currentBandPeriod, m_config.ppfx (),
- ui->cbCQonly->isVisible() && ui->cbCQonly->isChecked(),
- haveFSpread, fSpread, bDisplayPoints, m_points, distance, m_muted);
- if(m_position != 0) ui->decodedTextBrowser->horizontalScrollBar()->setValue(m_position);
-
- // display "73" messages for us also in the right pane
- if (m_mode=="MSK144" && text.mid(22).contains(m_baseCall + " " + m_hisCall + " 73")) {
- ui->decodedTextBrowser2->displayDecodedText (decodedtext, m_config.my_callsign (), m_mode, m_config.DXCC (),
- m_logBook, m_currentBand, m_config.ppfx (), false, false, 0.0, false, -99, "", m_muted);
- }
- }
-
- // Ensure that Tx stops when "RR73" or "73" is received and repeat_Tx is enabled for MSK144
- if (m_config.repeat_Tx() && m_mode=="MSK144" && m_hisCall!="" && text.contains(m_baseCall)
- && text.contains(m_hisCall + " 73")) cease_auto_Tx_after_QSO();
-
- // highlight orange and blue callsigns for MSK144
- if(m_config.highlight_orange() or (m_config.highlight_blue())) {
- QString deCall;
- QString deGrid;
- decodedtext.deCallAndGrid(/*out*/deCall,deGrid);
- QStringList tw;
- tw=text.mid(22).split(" ",SkipEmptyParts);
- if (m_config.highlight_orange() && m_config.highlight_orange_callsigns().contains(deCall + ","))
- ui->decodedTextBrowser->highlight_callsign(deCall, QColor(225,75,0), QColor(255,255,255), true);
- if (m_config.highlight_orange() && m_config.highlight_orange_callsigns().contains(deGrid))
- ui->decodedTextBrowser->highlight_callsign(deGrid, QColor(225,75,0), QColor(255,255,255), true);
- if (m_config.highlight_blue() && m_config.highlight_blue_callsigns().contains(deCall + ","))
- ui->decodedTextBrowser->highlight_callsign(deCall, QColor(0,100,255), QColor(255,255,255), true);
- if (m_config.highlight_blue() && m_config.highlight_blue_callsigns().contains(deGrid))
- ui->decodedTextBrowser->highlight_callsign(deGrid, QColor(0,100,255), QColor(255,255,255), true);
- // highlight directional calls
- if (tw.size () > 2) {
- if (m_config.highlight_orange() && tw[0]=="CQ" && m_config.highlight_orange_callsigns().contains(tw[1] + ","))
- ui->decodedTextBrowser->highlight_callsign(tw[1], QColor(225,75,0), QColor(255,255,255), true);
- if (m_config.highlight_blue() && tw[0]=="CQ" && m_config.highlight_blue_callsigns().contains(tw[1] + ","))
- ui->decodedTextBrowser->highlight_callsign(tw[1], QColor(0,100,255), QColor(255,255,255), true);
- }
- }
-
- // highlight callsigns worked B4 on band or worked today or from the Ignore List for MSK144
- if(ui->actionHighlightB4->isChecked() or ui->actionHighlightToday->isChecked() or ui->actionHighlightIgnored->isChecked()
- or ui->actionHighlightTerritory1->isChecked() or ui->actionHighlightTerritory2->isChecked()
- or ui->actionHighlightTerritory3->isChecked() or ui->actionHighlightTerritory4->isChecked()) {
- QString today = QDateTime::currentDateTimeUtc().toString ("yyyy-MM-dd");
- QString yesterday = QDateTime::currentDateTimeUtc().addDays(-1).toString ("yyyy-MM-dd");
- QString deCall;
- QString deGrid;
- decodedtext.deCallAndGrid(/*out*/deCall,deGrid);
- bool callB4onBand;
- bool countryB4onBand;
- bool gridB4onBand;
- bool continentB4onBand;
- bool CQZoneB4onBand;
- bool ITUZoneB4onBand;
- if (ui->actionHighlightB4->isChecked()) {
- auto const& looked_up = m_logBook.countries ()->lookup (deCall);
- m_logBook.match (deCall, m_mode, deGrid, looked_up, callB4onBand, countryB4onBand, gridB4onBand,
- continentB4onBand, CQZoneB4onBand, ITUZoneB4onBand, m_currentBand);
- if (callB4onBand) ui->decodedTextBrowser->highlight_callsign(deCall, QColor(195,195,195), QColor(0,0,0), true);
- }
- if (ui->actionHighlightToday->isChecked() && (
- txLog.contains(QRegularExpression{today + ",[0-9][0-9]:[0-9][0-9]:[0-9][0-9]," + (deCall + ",")})
- or (m_config.twoDays() && txLog.contains(QRegularExpression{yesterday + ",[0-9][0-9]:[0-9][0-9]:[0-9][0-9]," + (deCall + ",")})))) {
- ui->decodedTextBrowser->highlight_callsign(deCall, QColor(100,100,100), QColor(255,255,0), true);
- }
- if (ui->actionHighlightIgnored->isChecked() && ignoreList.contains(deCall + ",")) {
- ui->decodedTextBrowser->highlight_callsign(deCall, QColor(85,0,0), QColor(255,255,0), true);
- }
- // search for country names
- if (ui->actionHighlightTerritory1->isChecked() or ui->actionHighlightTerritory2->isChecked() or
- ui->actionHighlightTerritory3->isChecked() or ui->actionHighlightTerritory4->isChecked()) {
- auto const& looked_up = m_logBook.countries ()->lookup (deCall);
- auto countryName = looked_up.entity_name;
- // do some obvious abbreviations
- countryName.replace ("Islands", "Is.");
- countryName.replace ("Island", "Is.");
- countryName.replace ("North ", "N. ");
- countryName.replace ("Northern ", "N. ");
- countryName.replace ("South ", "S. ");
- countryName.replace ("East ", "E. ");
- countryName.replace ("Eastern ", "E. ");
- countryName.replace ("West ", "W. ");
- countryName.replace ("Western ", "W. ");
- countryName.replace ("Central ", "C. ");
- countryName.replace (" and ", " & ");
- countryName.replace ("Republic", "Rep.");
- countryName.replace ("United States of America", "U.S.A.");
- countryName.replace ("United States", "U.S.A.");
- countryName.replace ("Fed. Rep. of ", "");
- countryName.replace ("French ", "Fr.");
- countryName.replace ("Asiatic", "AS");
- countryName.replace ("European", "EU");
- countryName.replace ("African", "AF");
- if (ui->actionHighlightTerritory1->isChecked() && countryName.contains(m_config.Territory1())
- && (m_config.Territory1()!="") && !ui->cbBypass->isChecked()) ui->decodedTextBrowser->highlight_callsign(deCall, QColor(115,43,245), QColor(255,255,255), true);
- if (ui->actionHighlightTerritory2->isChecked() && countryName.contains(m_config.Territory2())
- && (m_config.Territory2()!="") && !ui->cbBypass->isChecked()) ui->decodedTextBrowser->highlight_callsign(deCall, QColor(115,43,245), QColor(255,255,255), true);
- if (ui->actionHighlightTerritory3->isChecked() && countryName.contains(m_config.Territory3())
- && (m_config.Territory3()!="") && !ui->cbBypass->isChecked()) ui->decodedTextBrowser->highlight_callsign(deCall, QColor(115,43,245), QColor(255,255,255), true);
- if (ui->actionHighlightTerritory4->isChecked() && countryName.contains(m_config.Territory4())
- && (m_config.Territory4()!="") && !ui->cbBypass->isChecked()) ui->decodedTextBrowser->highlight_callsign(deCall, QColor(115,43,245), QColor(255,255,255), true);
- }
- }
-
- // Highlight DX Call/Grid for MSK144
- if (!pounce && (m_config.highlight_DXcall () or m_config.alert_Enabled()) && (m_hisCall!="") && ((text.contains(QRegularExpression {"(\\w+) " + m_hisCall}))
- || (decodedtext.string().contains("<...> " + m_hisCall)))) {
- if (m_config.alert_Enabled() && m_config.alert_DXcall() && !m_muted) play_DXcall = true; // UR disable for versions without alerts
- if (m_config.highlight_DXcall()) {
- // repeated highlighting to override JTAlert
- ui->decodedTextBrowser->highlight_callsign(m_hisCall, QColor(255,0,0), QColor(255,255,255), true);
- QTimer::singleShot (500, [=] {ui->decodedTextBrowser->highlight_callsign(m_hisCall, QColor(255,0,0), QColor(255,255,255), true);});
- QTimer::singleShot (1000, [=] {ui->decodedTextBrowser->highlight_callsign(m_hisCall, QColor(255,0,0), QColor(255,255,255), true);});
- QTimer::singleShot (2500, [=] {ui->decodedTextBrowser->highlight_callsign(m_hisCall, QColor(255,0,0), QColor(255,255,255), true);});
- }
- }
- if (!pounce && (m_config.highlight_DXgrid () or m_config.alert_Enabled()) && (m_hisGrid!="") && (decodedtext.string().contains(m_hisGrid.left(4)))) {
- if (m_config.highlight_DXgrid()) ui->decodedTextBrowser->highlight_callsign(m_hisGrid.left(4), QColor(0,0,200), QColor(255,255,255), true);
- if (m_config.alert_Enabled() && m_config.alert_DXcall() && !m_muted) play_DXcall = true; // UR disable for versions without alerts
- }
- QTimer::singleShot (100, [=] { // UR delete for versions without alerts
- if ((m_config.alert_Enabled()) && (m_config.alert_DXcall()) && (play_DXcall) && (m_hisCall!="")) {
-#ifdef WIN32
- QAudioOutput info(QAudioDeviceInfo::defaultOutputDevice());
- QString binPath = QCoreApplication::applicationDirPath();
- QAudioFormat format;
- format.setCodec("audio/pcm");
- format.setSampleRate (48000);
- format.setChannelCount (1);
- format.setSampleSize (16);
- format.setSampleType(QAudioFormat::SignedInt);
- QAudioOutput* audio;
- audio = new QAudioOutput(format, this);
- connect(audio, SIGNAL(stateChanged(QAudio::State)), this, SLOT(handleStateChanged(QAudio::State)));
- QFile *effect1 = new QFile(this);
- effect1->setFileName(QString("%1/%2").arg(binPath, "/sounds/DXcall.wav"));
- effect1->open(QIODevice::ReadOnly);
- audio->start(effect1);
-#else
- QString binPath = QCoreApplication::applicationDirPath();
- QSound::play(binPath + "/sounds/DXcall.wav"); // for Linux and macOS
-#endif
- play_DXcall = false;
- }
- }); // UR delete for versions without alerts
-
- m_bDecoded=true;
- auto_sequence (decodedtext, ui->sbFtol->value (), std::numeric_limits<unsigned>::max ());
- postDecode (true, decodedtext.string ());
-// writeAllTxt(message);
- write_all("Rx",message);
- bool stdMsg = decodedtext.report(m_baseCall,
- Radio::base_callsign(ui->dxCallEntry->text()),m_rptRcvd);
- if (stdMsg) pskPost (decodedtext);
- if(ui->actionEnable_QSY_Popups->isChecked() || m_qsymonitorWidget) showQSYMessage(message);
- }
-
- float fracTR=float(k)/(12000.0*m_TRperiod);
- decodeNow=false;
- if(fracTR>0.92) {
- m_dataAvailable=true;
- fast_decode_done();
- m_bFastDone=true;
- }
-
- m_k0=k;
- if(m_diskData and m_k0 >= dec_data.params.kin - 7 * 512) decodeNow=true;
- if(!m_diskData and m_tRemaining<0.35 and !m_bFastDecodeCalled) decodeNow=true;
- if(m_mode=="MSK144") decodeNow=false;
-
- if(decodeNow) {
- m_dataAvailable=true;
- m_t0=0.0;
- m_t1=k/12000.0;
- m_kdone=k;
- dec_data.params.newdat=1;
- if(!m_decoderBusy) {
- m_bFastDecodeCalled=true;
- decode();
- }
- }
-
- if(decodeNow or m_bFastDone) {
- if(!m_diskData and (m_saveAll or m_saveDecoded)) {
- QDateTime now {QDateTime::currentDateTimeUtc()};
- int n=fmod(double(now.time().second()),m_TRperiod);
- if(n<(m_TRperiod/2)) n=n+m_TRperiod;
- auto const& period_start = now.addSecs (-n);
- m_fnameWE = m_config.save_directory ().absoluteFilePath (period_start.toString ("yyMMdd_hhmmss"));
- if(m_saveAll or m_bAltV or (m_bDecoded and m_saveDecoded) or (m_mode!="MSK144")) {
- m_bAltV=false;
- // the following is potential a threading hazard - not a good
- // idea to pass pointer to be processed in another thread
- m_saveWAVWatcher.setFuture (QtConcurrent::run (std::bind (&MainWindow::save_wave_file,
- this, m_fnameWE, &dec_data.d2[0], int(m_TRperiod*12000.0), m_config.my_callsign(),
- m_config.my_grid(), m_mode, m_nSubMode, m_freqNominal, m_hisCall, m_hisGrid)));
- }
- if(m_mode!="MSK144") {
- killFileTimer.start (int(750.0*m_TRperiod)); //Kill 3/4 period from now
- }
- }
- m_bFastDone=false;
- }
- float tsec=0.001*(QDateTime::currentMSecsSinceEpoch() - ms0);
- m_fCPUmskrtd=0.9*m_fCPUmskrtd + 0.1*tsec;
-}
-
-void MainWindow::showSoundInError(const QString& errorMsg)
-{
- if (m_splash && m_splash->isVisible ()) m_splash->hide ();
- MessageBox::critical_message (this, tr ("Error in Sound Input"), errorMsg);
-}
-
-void MainWindow::showSoundOutError(const QString& errorMsg)
-{
- if (m_splash && m_splash->isVisible ()) m_splash->hide ();
- MessageBox::critical_message (this, tr ("Error in Sound Output"), errorMsg);
-}
-
-void MainWindow::showStatusMessage(const QString& statusMsg)
-{
- statusBar()->showMessage(statusMsg, 5000);
-}
-
-void MainWindow::showQSYMessage(QString message)
-{
- QString the_line = message;
- QString qCall = QString(Radio::base_callsign(m_config.my_callsign ()));
- QString qDXCall = QString(Radio::base_callsign(ui->dxCallEntry->text()));
- if(the_line.mid(22).contains(QString("."))) {
- if(!(the_line.contains("OKQSY") || the_line.contains("NOQSY"))) {
- QStringList bhList = the_line.split(" ",SkipEmptyParts);
- QString the_message = "";
- QString the_call = "";
- for (const QString &element : bhList) {
- if(element.contains(QString("."))) {
- the_message = element.mid(element.indexOf("." ) + 1);
- the_call = element.mid(0,element.indexOf("." ));
- if(the_message.length() > 0) {
- QString finalMatch = "";
- QRegularExpression re1("[A-Z479][V0123456789ABCDEFGHIJKLRW][0-9]{3}");
- QRegularExpressionMatch match = re1.match(the_message);
- if(match.hasMatch()) {
- finalMatch = match.captured();
- if(the_call == qCall && ui->actionEnable_QSY_Popups->isChecked()) {
- if(m_QSYMessageWidget) m_QSYMessageWidget->write_settings();
- m_QSYMessageWidget.reset (new QSYMessage(finalMatch, qCall, m_settings, &m_config));
-
- //connect to signal finish
- connect (this, &MainWindow::finished, &QSYMessage::close);
-
- //connect to signal from QSYMessage
- connect (m_QSYMessageWidget.data (), &QSYMessage::sendReply, this, &MainWindow::reply_tx5,static_cast<Qt::ConnectionType>(Qt::UniqueConnection));
- m_QSYMessageWidget->setWindowFlags(m_QSYMessageWidget->windowFlags() | Qt::WindowStaysOnTopHint);
- m_QSYMessageWidget->show();
- m_QSYMessageWidget->raise();
- m_QSYMessageWidget->activateWindow();
- }
- if(m_qsymonitorWidget && finalMatch.mid(0,1) !='Z') m_qsymonitorWidget->getQSYData(QString(bhList[0]) + " " + the_call + " " + finalMatch);
- if (m_config.alert_Enabled() && m_config.alert_QSYmessage() && (the_line.contains(qCall) or the_line.contains(qDXCall))) alertQSYmessage();
- }
- }
- }
- }
- }
- else if (((the_line.mid(22).contains(qDXCall + QString(".") + "OKQSY") || the_line.mid(22).contains(qDXCall +QString(".") + "NOQSY"))) && ui->actionEnable_QSY_Popups->isChecked()) {
- QString yesOrNo = " ";
- if (the_line.contains("OKQSY")) {
- yesOrNo = QString(" OKQSY");
- } else {
- yesOrNo = QString(" NOQSY");
- }
- on_stopTxButton_clicked();
- QString qNewMessage = QString("$ ") + qDXCall + yesOrNo;
- if(m_QSYMessageWidget) m_QSYMessageWidget->write_settings();
- m_QSYMessageWidget.reset (new QSYMessage(qNewMessage, qDXCall, m_settings, &m_config));
-
- //connect to signal finish
- connect (this, &MainWindow::finished, &QSYMessage::close);
- m_QSYMessageWidget->show();
- m_QSYMessageWidget->raise();
- m_QSYMessageWidget->activateWindow();
- if (m_config.alert_Enabled() && m_config.alert_QSYmessage() && (the_line.contains(qCall) or the_line.contains(qDXCall))) alertQSYmessage();
- }
- }
-}
-
-void MainWindow::on_actionSettings_triggered() // Setup Dialog (Settings dialog)
-{
- inSettings = true;
- keep_frequency = true;
- m_config.read_CALL3_version();
- // things that might change that we need know about
- auto callsign = m_config.my_callsign ();
- auto my_grid = m_config.my_grid ();
- SpecOp nContest0=m_specOp;
- auto psk_on = m_config.spot_to_psk_reporter ();
- if (QDialog::Accepted == m_config.exec ()) {
- checkMSK144ContestType();
- if (m_config.my_callsign () != callsign) {
- m_baseCall = Radio::base_callsign (m_config.my_callsign ());
- ui->tx1->setEnabled (elide_tx1_not_allowed () || ui->tx1->isEnabled ());
- morse_(const_cast<char *> (m_config.my_callsign ().toLatin1().constData()),
- const_cast<int *> (icw), &m_ncw, (FCL)m_config.my_callsign().length());
- }
- if (m_config.my_callsign () != callsign || m_config.my_grid () != my_grid) {
- statusUpdate ();
- }
- on_dxGridEntry_textChanged (m_hisGrid); // recalculate distances in case of units change
- enable_DXCC_entity (m_config.DXCC ()); // sets text window proportions and (re)inits the logbook
-
- pskSetLocal ();
- // this will close the connection to PSKReporter if it has been
- // disabled
- if (psk_on && !m_config.spot_to_psk_reporter ())
- {
- m_psk_Reporter.sendReport (true);
- }
-
- m_tci_audio = (m_config.tci_audio() && m_config.is_tci()); // update m_tci_audio
- bool was_monitoring = m_monitoring;
- if (m_monitoring && (m_config.restart_tci () or !m_tci_audio)) on_monitorButton_clicked (false);
- if (!m_tci_audio) {
- if(m_config.restart_audio_input () && !m_config.audio_input_device ().isNull ()) {
- Q_EMIT startAudioInputStream (m_config.audio_input_device ()
- , m_rx_audio_buffer_frames
- , m_detector, m_downSampleFactor
- , m_config.audio_input_channel ());
- }
-
- if(m_config.restart_audio_output () && !m_config.audio_output_device ().isNull ()) {
- Q_EMIT initializeAudioOutputStream (m_config.audio_output_device ()
- , AudioDevice::Mono == m_config.audio_output_channel () ? 1 : 2
- , m_tx_audio_buffer_frames);
- }
- }
- if (was_monitoring && (m_config.restart_tci () or !m_tci_audio) && !m_monitoring && !m_transmitting && g_iptt!=1) {
- if(m_mode=="MSK144") {
- if (m_tci_audio) {
- if (ui->bandComboBox->currentText()!="OOB") {
- Q_EMIT m_config.transceiver_trfrequency(1000.0);
- } else {
- rigFailure("TCI audio cannot be started as frequency is OOB");
- }
- } else {
- Q_EMIT transmitFrequency (1000.0);
- }
- } else {
- if (m_tci_audio) {
- if (ui->bandComboBox->currentText()!="OOB") {
- Q_EMIT m_config.transceiver_trfrequency(ui->TxFreqSpinBox->value () - m_XIT);
- } else {
- rigFailure("TCI audio cannot be started as frequency is OOB");
- }
- } else {
- Q_EMIT transmitFrequency (ui->TxFreqSpinBox->value() - m_XIT);
- }
- }
- on_monitorButton_clicked (true); // reset audio streams
- }
-
- if (rigFailed or ui->bandComboBox->currentText()=="OOB") displayDialFrequency (); // reset frequency only when needed
- bool vhf {m_config.enable_VHF_features()};
- m_wideGraph->setVHF(vhf);
- if (!vhf) ui->sbSubmode->setValue (0);
-
- setup_status_bar (vhf);
- bool b = vhf && (m_mode=="JT4" or m_mode=="JT65" or
- m_mode=="JT9" or m_mode=="MSK144" or m_mode=="Q65");
- if (b) {
- VHF_features_enabled(b);
- set_mode (m_mode);
- VHF_features_enabled(b);
- }
-
- m_config.transceiver_online ();
- if(!m_bFastMode) setXIT (ui->TxFreqSpinBox->value ());
- if ((m_config.single_decode () && !m_mode.startsWith ("FST4")) || m_mode=="JT4") {
- ui->lh_decodes_title_label->setText(tr ("Single-Period Decodes"));
- ui->rh_decodes_title_label->setText(tr ("Average Decodes"));
- }
-
- update_watchdog_label ();
- if(!m_splitMode) ui->cbCQTx->setChecked(false);
- if(!m_config.enable_VHF_features()) {
- ui->actionInclude_averaging->setVisible(false);
- ui->actionInclude_correlation->setVisible (false);
- ui->actionInclude_averaging->setChecked(false);
- ui->actionInclude_correlation->setChecked(false);
- ui->actionEnable_AP_JT65->setVisible(false);
- ui->actionAuto_Clear_Avg->setVisible(false);
- }
- if(!(m_config.enable_VHF_features() && m_mode=="Q65")) {
- ui->actionDisable_clicks_on_waterfall->setVisible(false);
- }
- m_specOp=m_config.special_op_id();
- if(m_specOp!=nContest0) {
- ui->tx1->setEnabled(true);
- ui->txb1->setEnabled(true);
- set_mode(m_mode);
- }
- chkFT4();
- if(SpecOp::EU_VHF==m_specOp and m_config.my_grid().size()<6) {
- MessageBox::information_message (this,
- "EU VHF Contest messages require a 6-character locator.");
- }
- if((m_specOp==SpecOp::FOX or m_specOp==SpecOp::HOUND) and
- m_mode!="FT8") {
- MessageBox::information_message (this,
- "Fox-and-Hound operation is available only in FT8 mode.\nGo back and change your selection.");
- }
- ui->labDXped->setVisible(SpecOp::NONE != m_specOp);
- set_mode(m_mode);
-
- // ensure a balanced layout
- qreal pointSize = m_config.text_font().pointSizeF();
- if (m_config.PWR_and_SWR()) {
- ui->label->setMinimumWidth (2.8*pointSize + 8);
- ui->label->setAlignment(Qt::AlignCenter);
- ui->outAttenuation->setMinimumWidth (2.8*pointSize + 8);
- }
-
- configActiveStations();
- check_button_color();
- rigFailed = false;
- keep_frequency = false;
- inSettings = false;
- } else {
- keep_frequency = false;
- inSettings = false;
- }
-}
-
-void MainWindow::on_monitorButton_clicked (bool checked)
-{
- if (!m_transmitting) {
- auto prior = m_monitoring;
- monitor (checked);
- if (checked && !prior) {
- if (m_config.monitor_last_used () && m_mode!="Echo") {
- // put rig back where it was when last in control
- setRig (m_lastMonitoredFrequency);
- setXIT (ui->TxFreqSpinBox->value ());
- }
- // ensure FreqCal triggers
- if(m_mode=="FST4W") {
- on_sbFST4W_RxFreq_valueChanged(ui->sbFST4W_RxFreq->value());
- } else {
- on_RxFreqSpinBox_valueChanged (ui->RxFreqSpinBox->value ());
- }
- }
- //Get Configuration in/out of strict split and mode checking
- m_config.sync_transceiver (true, checked);
- } else {
- ui->monitorButton->setChecked (false); // disallow
- }
- if(m_mode=="Echo") m_echoRunning=false;
- check_button_color();
-}
-
-void MainWindow::monitor (bool state)
-{
- ui->monitorButton->setChecked (state);
- if (state) {
- m_diskData = false; // no longer reading WAV files
- if (!m_monitoring) {
- float t_rxdelay=0.001*(QDateTime::currentMSecsSinceEpoch() - m_msEchoTxStart);
- int ms=int(1000*(m_tEcho-t_rxdelay));
- if (m_tci_audio) {
- if (ui->bandComboBox->currentText()!="OOB") {
- if(ms>=10) {
- QTimer::singleShot (ms, [=] {Q_EMIT m_config.transceiver_audio(true);});
- } else {
- Q_EMIT m_config.transceiver_audio(true);
- }
- } else {
- rigFailure("TCI audio cannot be started as frequency is OOB");
- }
- } else {
- if(ms>=10) {
- QTimer::singleShot (ms, [=] {resumeAudioInputStream();});
- } else {
- Q_EMIT resumeAudioInputStream ();
- }
- }
- }
- } else {
- if (m_tci_audio) {
- if (ui->bandComboBox->currentText()!="OOB") {
- Q_EMIT m_config.transceiver_audio(false);
- } else {
- rigFailure("TCI audio cannot be stopped as frequency is OOB");
- }
- } else {
- Q_EMIT suspendAudioInputStream ();
- }
- }
- m_monitoring = state;
- check_button_color();
-}
-
-void MainWindow::on_actionAbout_triggered() //Display "About"
-{
- CAboutDlg {this}.exec ();
-}
-
-void MainWindow::on_autoButton_clicked (bool checked)
-{
- if (ui->DX_Call_Button->isChecked() && m_specOp==SpecOp::HOUND && m_config.superFox() && !m_bDoubleClicked) return; // for Wait & Call
- m_config.transceiver_tune (false); // reset rig tuning
- if (checked && ui->tuneButton->isChecked() && !(m_mode=="WSPR" || m_mode=="FST4W")) return; // not allowed while tuning
- stopWRTimer.stop(); // stop any Wait & Reply timeout
- if (!checked && ui->DX_Call_Button->isChecked()) {
- stopWCTimer.stop(); // stop any Wait & Call timeout
- ui->DX_Call_Button->click (); // disable Wait & Call
- no_wait_and_call = false; // reset Wait & Call
- }
- m_specOp=m_config.special_op_id();
- ui->pbBandHopping->setChecked(false); // disable band hopping when Tx is enabled
- if (checked) {
- m_auto = checked;
- QTimer::singleShot (3000, [=] {pounce = false;}); // ensure to select only CQ messages
- } else {
- pounce = false;
- m_auto = false;
- m_bCallingCQ = false;
- ui->autoButton->setChecked(false); // ensure autoButton is unchecked
- filtered = false;
- ignored = false;
- m_muted = false;
- Dpoints=0; // reset points
- maxDPoints=0; // reset points
- dBpoints=-28; // reset points
- dBpoints2=99; // reset points
- maxdBPoints=-28; // reset points
- mindBPoints=99; // reset points
- }
- m_maxPoints=-1;
- if (checked && ui->respondComboBox->isVisible() && ui->respondComboBox->currentText() != "CQ: None"
- && CALLING == m_QSOProgress) {
- m_bAutoReply = false; // ready for next
- m_bCallingCQ = true; // allows tail-enders to be picked up
- }
- statusUpdate ();
- m_bEchoTxOK=false;
- if(m_mode=="Echo" and m_auto) {
- m_nclearave=1;
- echocom_.nsum=0;
- }
- m_tAutoOn=QDateTime::currentMSecsSinceEpoch()/1000;
- if(m_mode=="Echo") m_echoRunning=false;
- check_button_color();
-}
-
-void MainWindow::on_sbTxPercent_valueChanged (int n)
-{
- update_dynamic_property (ui->sbTxPercent, "notx", !n);
-}
-
-void MainWindow::auto_tx_mode (bool state)
-{
- ui->autoButton->setChecked (state);
- on_autoButton_clicked (state);
-}
-
-void MainWindow::keyPressEvent (QKeyEvent * e)
-{
- if(SpecOp::FOX == m_specOp) {
- switch (e->key()) {
- case Qt::Key_Return:
- doubleClickOnCall2(Qt::KeyboardModifier(Qt::ShiftModifier + Qt::ControlModifier + Qt::AltModifier));
- return;
- case Qt::Key_Enter:
- doubleClickOnCall2(Qt::KeyboardModifier(Qt::ShiftModifier + Qt::ControlModifier + Qt::AltModifier));
- return;
- case Qt::Key_Backspace:
- qDebug() << "Key Backspace";
- return;
- case Qt::Key_X:
- if(e->modifiers() & Qt::AltModifier) {
- foxTest();
- return;
- }
- }
- QMainWindow::keyPressEvent (e);
- }
-
- // Why shall RETURN switch Tx on when in Hound mode? Makes little sense and confuses many OMs!
-// if(SpecOp::HOUND == m_specOp) {
-// switch (e->key()) {
-// case Qt::Key_Return:
-// auto_tx_mode(true);
-// return;
-// case Qt::Key_Enter:
-// auto_tx_mode(true);
-// return;
-// }
-// QMainWindow::keyPressEvent (e);
-// }
-
- int n;
- bool bAltF1F6=m_config.alternate_bindings();
- switch(e->key())
- {
- case Qt::Key_A:
- if(m_mode=="Q65" && e->modifiers() & Qt::AltModifier) {
- m_EMECall.clear();
- qmapcom.ndecodes=0;
- readWidebandDecodes();
- }
- return;
- case Qt::Key_B:
- if(m_mode=="FT4" && e->modifiers() & Qt::AltModifier) {
- on_pbBestSP_clicked();
- }
- return;
- case Qt::Key_C:
- if(e->modifiers() & Qt::AltModifier) {
- int n=ui->respondComboBox->currentIndex()+1;
- if(n>2) n=0;
- ui->respondComboBox->setCurrentIndex(n);
- }
- return;
- case Qt::Key_D:
- if(m_mode != "WSPR" && e->modifiers() & Qt::ShiftModifier) {
- if(!m_decoderBusy) {
- dec_data.params.newdat=0;
- dec_data.params.nagain=0;
- decode();
- return;
- }
- }
- break;
- case Qt::Key_F1:
- if(bAltF1F6) {
- auto_tx_mode(true);
- on_txb6_clicked();
- return;
- } else {
- on_actionOnline_User_Guide_triggered();
- return;
- }
- case Qt::Key_F2:
- if(bAltF1F6) {
- auto_tx_mode(true);
- on_txb2_clicked();
- return;
- } else {
- on_actionSettings_triggered();
- return;
- }
- case Qt::Key_F3:
- if(bAltF1F6) {
- auto_tx_mode(true);
- on_txb3_clicked();
- return;
- } else {
- on_actionKeyboard_shortcuts_triggered();
- return;
- }
- case Qt::Key_F4:
- if(bAltF1F6) {
- auto_tx_mode(true);
- on_txb4_clicked();
- return;
- } else {
- clearDX ();
- ui->dxCallEntry->setFocus();
- return;
- }
- case Qt::Key_F5:
- if(bAltF1F6) {
- auto_tx_mode(true);
- on_txb5_clicked();
- return;
- } else {
- on_actionSpecial_mouse_commands_triggered();
- return;
- }
- case Qt::Key_F6:
- if(bAltF1F6) {
- int n=ui->respondComboBox->currentIndex()+1;
- if(n>2) n=0;
- ui->respondComboBox->setCurrentIndex(n);
- } else {
- if(e->modifiers() & Qt::ShiftModifier) {
- on_actionDecode_remaining_files_in_directory_triggered();
- } else {
- on_actionOpen_next_in_directory_triggered();
- }
- }
- return;
- case Qt::Key_F11:
- if((e->modifiers() & Qt::ControlModifier) and (e->modifiers() & Qt::ShiftModifier)) {
- m_bandEdited = true;
- band_changed(m_freqNominal-1000);
- } else {
- n=11;
- if(e->modifiers() & Qt::ControlModifier) n+=100;
- if(e->modifiers() & Qt::ShiftModifier) {
- int offset=60;
- if(m_mode=="FT4") offset=90;
- ui->TxFreqSpinBox->setValue(ui->TxFreqSpinBox->value()-offset);
- } else{
- bumpFqso(n);
- }
- }
- return;
- case Qt::Key_F12:
- if((e->modifiers() & Qt::ControlModifier) and (e->modifiers() & Qt::ShiftModifier)) {
- m_bandEdited = true;
- band_changed(m_freqNominal+1000);
- } else {
- n=12;
- if(e->modifiers() & Qt::ControlModifier) n+=100;
- if(e->modifiers() & Qt::ShiftModifier) {
- int offset=60;
- if(m_mode=="FT4") offset=90;
- ui->TxFreqSpinBox->setValue(ui->TxFreqSpinBox->value()+offset);
- } else {
- bumpFqso(n);
- }
- }
- return;
- case Qt::Key_Escape:
- m_nextCall="";
- on_stopTxButton_clicked();
- abortQSO();
- return;
- case Qt::Key_E:
- if((e->modifiers() & Qt::ShiftModifier) and m_specOp!=SpecOp::FOX and m_specOp!=SpecOp::HOUND) {
- ui->txFirstCheckBox->setChecked(false);
- return;
- }
- else if((e->modifiers() & Qt::ControlModifier) and m_specOp!=SpecOp::FOX and m_specOp!=SpecOp::HOUND) {
- ui->txFirstCheckBox->setChecked(true);
- return;
- }
- break;
- case Qt::Key_F:
- if(e->modifiers() & Qt::ControlModifier) {
- if(ui->tabWidget->currentIndex()==0) {
- ui->tx5->clearEditText();
- ui->tx5->setFocus();
- }
- return;
- }
- break;
- case Qt::Key_G:
- if(e->modifiers() & Qt::AltModifier) {
- genStdMsgs (m_rpt, true);
- return;
- }
- break;
- case Qt::Key_H:
- if(e->modifiers() & Qt::AltModifier) {
- on_stopTxButton_clicked();
- return;
- }
- break;
- case Qt::Key_I:
- if(e->modifiers() & Qt::ControlModifier) {
- addCallsignToignoreList();
- return;
- }
- break;
- case Qt::Key_L:
- if(e->modifiers() & Qt::ControlModifier) {
- lookup();
- genStdMsgs(m_rpt);
- return;
- }
- break;
- case Qt::Key_O:
- if(e->modifiers() & Qt::ControlModifier) {
- on_actionOpen_triggered();
- return;
- }
- else if(e->modifiers() & Qt::AltModifier) {
- bool ok;
- auto call = QInputDialog::getText (this, tr ("Change Operator"), tr ("New operator:"),
- QLineEdit::Normal, m_config.opCall (), &ok);
- if (ok) {
- m_config.opCall (call);
- }
- return;
- }
- break;
- case Qt::Key_R:
- if(m_mode=="Q65" and e->modifiers() & Qt::ShiftModifier and
- e->modifiers() & Qt::ControlModifier) {
- if(m_specOp==SpecOp::Q65_PILEUP) {
- refreshPileupList();
- } else {
- m_fetched=0;
- readWidebandDecodes();
- }
- return;
- }
- if(e->modifiers() & Qt::AltModifier) {
- if(!m_send_RR73) on_txrb4_doubleClicked();
- return;
- }
- if(e->modifiers() & Qt::ControlModifier) {
- if(m_send_RR73) on_txrb4_doubleClicked();
- return;
- }
- break;
- case Qt::Key_X:
-
- if(e->modifiers() & Qt::AltModifier) {
- //foxTest();
- return;
- }
- }
-
- QMainWindow::keyPressEvent (e);
-}
-
-void MainWindow::handleVerifyMsg(int status, QDateTime ts, QString callsign, QString code, unsigned int hz, QString const &response)
-{
- (void)status;
- (void)code;
- if (response.length() > 0) {
- QString msg = FoxVerifier::formatDecodeMessage(ts, callsign, hz, response);
- if (msg.length() > 0) {
- // Hound label
- if ((ui->labDXped->text().contains("Hound") && msg.contains(" verified"))) {
- verified = true;
- ui->labDXped->setStyleSheet("QLabel {background-color: #00ff00; color: black;}");
- }
- ui->decodedTextBrowser->displayDecodedText(DecodedText{msg}, m_config.my_callsign(), m_mode, m_config.DXCC(),
- m_logBook, m_currentBand, m_config.ppfx(), false, false, 0.0, false, -99, "", true);
- write_all("Ck",msg);
- }
- }
- LOG_INFO(QString("FoxVerifier response for [%1]: - [%2]").arg(callsign).arg(response).toStdString());
-}
-
-QString MainWindow::userAgent() {
- // see User-Agent format definition https://www.rfc-editor.org/rfc/rfc9110#name-user-agent
- //
- QString platform = "(" + QSysInfo::prettyProductName()+"; "+QSysInfo::productType() + " " + QSysInfo::productVersion() + "; " +
- QSysInfo::currentCpuArchitecture() + "; " +
- QString("rv:%1").arg(QSysInfo::kernelVersion()) + ")";
- QString userAgent = QString{"WSJT-X/" + version() + "_" + m_revision}.simplified() + " " +platform;
- return userAgent;
- }
-
-void MainWindow::bumpFqso(int n) //bumpFqso()
-{
- int i;
- bool ctrl = (n>=100);
- n=n%100;
- i=ui->RxFreqSpinBox->value();
- bool bTrackTx=ui->TxFreqSpinBox->value() == i;
- if(n==11) i--;
- if(n==12) i++;
- if (ui->RxFreqSpinBox->isEnabled ()) {
- ui->RxFreqSpinBox->setValue (i);
- }
- if(ctrl and m_mode=="WSPR") {
- ui->WSPRfreqSpinBox->setValue(i);
- } else {
- if(ctrl and bTrackTx) {
- ui->TxFreqSpinBox->setValue (i);
- }
- }
-}
-
-void MainWindow::displayDialFrequency ()
-{
- if (ui->actionUse_Dark_Style->isChecked()) ui->bandComboBox->setStyleSheet("QLineEdit {background-color: #31363b}"); // initialize dark style at startup
- Frequency dial_frequency {m_rigState.ptt () && m_rigState.split () ?
- m_rigState.tx_frequency () : m_rigState.frequency ()};
-
- // lookup band
- auto const& band_name = m_config.bands ()->find (dial_frequency);
- if (m_lastBand != band_name or m_freqNominalPeriod != m_freqNominal)
- {
- // only change this when necessary as we get called a lot and it
- // would trash any user input to the band combo box line edit
- if (m_lastBand != band_name) {
- ui->bandComboBox->setCurrentText (band_name.size () ? band_name : m_config.bands ()->oob ());
- m_wideGraph->setRxBand (band_name);
- m_lastBand = band_name;
- band_changed(dial_frequency);
- }
- // prevent wrong frequencies for all.txt, PSK Reporter and highlighting for late decodes after band changes
- m_displayBand = false;
- no_decodes_to_UDP = true; // prevent wrong frequencies for devices connected via UDP
- QTimer::singleShot ((int(600.0*m_TRperiod)), [=] {
- m_freqNominalPeriod = m_freqNominal;
- m_currentBandPeriod = m_currentBand;
- m_displayBand = true;
- no_decodes_to_UDP = false; // prevent wrong frequencies for devices connected via UDP
- pskSetLocal (); // prevent wrong frequencies for PSK Reporter antenna description
- });
- }
-
- // search working frequencies for one we are within 10kHz of (1 Mhz
- // of on VHF and up)
- bool valid {false};
- quint64 min_offset {99999999};
- for (auto const& item : *m_config.frequencies ())
- {
- // we need to do specific checks for above and below here to
- // ensure that we can use unsigned Radio::Frequency since we
- // potentially use the full 64-bit unsigned range.
- auto const& working_frequency = item.frequency_;
- auto const& offset = dial_frequency > working_frequency ?
- dial_frequency - working_frequency :
- working_frequency - dial_frequency;
- if (offset < min_offset) {
- min_offset = offset;
- }
- }
- if (min_offset < 10000u || (m_config.enable_VHF_features() && min_offset < 1000000u)) {
- valid = true;
- }
-
- update_dynamic_property (ui->labDialFreq, "OOB", !valid);
- ui->labDialFreq->setText (Radio::pretty_frequency_MHz_string (dial_frequency));
- if(m_mode=="MSK144" && !msk144qsy) m_msk144basefreq = dial_frequency; // MSK144 QSY
-
- if (ui->actionBand_Buttons->isChecked()) check_button_color(); // update band buttons when dialling the VFO
-}
-
-void MainWindow::stopWRTimeout()
-{
- auto_tx_mode(false);
-}
-
-void MainWindow::stopWCTimeout()
-{
- if (ui->DX_Call_Button->isChecked()) {
- ui->DX_Call_Button->click ();
- auto_tx_mode(false);
- }
- no_wait_and_call = false;
-}
-
-void MainWindow::statusChanged()
-{
- m_specOp=m_config.special_op_id(); // update m_specOp
- if (m_specOp==SpecOp::Q65_PILEUP && m_mode != "Q65") on_actionQ65_triggered();
- QTimer::singleShot (50, [=] { // only allow Wait & Call where it is appropriate
- if((m_mode.startsWith("JT") or m_mode=="WSPR" or m_mode=="Echo" or m_mode=="FST4W"
- or (m_specOp!=SpecOp::NONE and m_specOp!=SpecOp::HOUND)
- or !ui->cbAutoSeq->isChecked() or m_hisCall=="") && ui->DX_Call_Button->isChecked())
- ui->DX_Call_Button->click ();
- });
- statusUpdate ();
- QFile f {m_config.temp_dir ().absoluteFilePath ("wsjtx_status.txt")};
- if(f.open(QFile::WriteOnly | QIODevice::Text)) {
- QTextStream out(&f);
- QString tmpGrid = m_hisGrid;
- if (!tmpGrid.size ()) tmpGrid="n/a"; // Not Available
- out << qSetRealNumberPrecision (12) << (m_freqNominal / 1.e6)
- << ";" << m_mode << ";" << m_hisCall << ";"
- << ui->rptSpinBox->value() << ";" << m_mode << ";" << tmpGrid
-#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0)
- << Qt::endl
-#else
- << endl
-#endif
- ;
- f.close();
- } else {
- if (m_splash && m_splash->isVisible ()) m_splash->hide ();
- MessageBox::warning_message (this, tr ("Status File Error")
- , tr ("Cannot open \"%1\" for writing: %2")
- .arg (f.fileName ()).arg (f.errorString ()));
- }
- on_dxGridEntry_textChanged(m_hisGrid);
- if (m_specOp!=SpecOp::HOUND) {
- ui->txb2->setEnabled(true);
- ui->txrb2->setEnabled(true);
- ui->txb4->setEnabled(true);
- ui->txrb4->setEnabled(true);
- ui->txb5->setEnabled(true);
- ui->txrb5->setEnabled(true);
- ui->txb6->setEnabled(true);
- ui->txrb6->setEnabled(true);
- ui->houndButton->setChecked(false);
- }
- if (m_specOp==SpecOp::FOX) {
- if (m_config.superFox()) ui->comboBoxCQ->setCurrentIndex(0); // No directional calls supported yet for SuperFox mode
- }
- if (m_config.enable_VHF_features() && (m_mode=="JT4" or m_mode=="Q65" or m_mode=="JT65")) {
- ui->actionInclude_averaging->setVisible(true);
- ui->actionAuto_Clear_Avg->setVisible(true);
- } else {
- ui->actionInclude_averaging->setVisible(false);
- ui->actionAuto_Clear_Avg->setVisible(false);
- }
- if (m_config.enable_VHF_features() && m_mode=="Q65") {
- ui->actionDisable_clicks_on_waterfall->setVisible(true);
- } else {
- ui->actionDisable_clicks_on_waterfall->setVisible(false);
- }
- if (m_mode=="JT4" or m_mode=="Q65" or m_mode=="JT65") {
- if (ui->actionInclude_averaging->isVisible() && ui->actionInclude_averaging->isChecked()) {
- ui->lh_decodes_title_label->setText(tr ("Single-Period Decodes"));
- ui->rh_decodes_title_label->setText(tr ("Average Decodes"));
- } else {
- if (m_config.enable_VHF_features()) {
- ui->lh_decodes_title_label->setText(tr ("Band Activity"));
- ui->rh_decodes_title_label->setText(tr ("Decodes containing My Call"));
- } else {
- ui->lh_decodes_title_label->setText(tr ("Band Activity"));
- ui->rh_decodes_title_label->setText(tr ("Rx Frequency"));
- }
- }
- }
- if (m_mode=="Q65" && m_config.enable_VHF_features()) {
- ui->pb15A->setVisible(true);
- ui->pb15C->setVisible(true);
- ui->pb30B->setVisible(true);
- ui->pb60C->setVisible(true);
- ui->pb60D->setVisible(true);
- ui->pb60E->setVisible(true);
- } else {
- ui->pb15C->setVisible(false);
- ui->pb15A->setVisible(false);
- ui->pb30B->setVisible(false);
- ui->pb60C->setVisible(false);
- ui->pb60D->setVisible(false);
- ui->pb60E->setVisible(false);
- }
- if (SpecOp::FOX==m_specOp) {
- ui->pbFreeText->setVisible(true);
- ui->cbSendMsg->setVisible(true);
- ui->txb6->click();
- if (m_config.superFox()) {
- ui->sbNslots->setVisible(true);
- m_XIT=0;
- if(ui->cbSendMsg->isChecked()) {
- ui->sbNslots->setValue(2);
- m_Nslots=2;
- } else {
- ui->sbNslots->setValue(5);
- m_Nslots=5;
- }
- } else {
- ui->sbNslots->setVisible(true);
- ui->sbNslots->setValue(m_Nslots0);
- }
- } else {
- ui->sbNslots->setVisible(true);
- ui->pbFreeText->setVisible(false);
- ui->cbSendMsg->setVisible(false);
- ui->sbNslots->setValue(m_Nslots0);
- }
- if (SpecOp::HOUND==m_specOp) ui->cbRxAll->setVisible(!m_config.superFox());
- if ((SpecOp::HOUND!=m_specOp && SpecOp::FOX!=m_specOp) or !m_config.superFox()) {
- m_wideGraph->setSuperFox(false);
- m_wideGraph->setSuperHound(false);
- }
- if (ui->tx1->text()=="" && !(m_mode=="FT8" && (SpecOp::HOUND==m_specOp or SpecOp::FOX==m_specOp))
- && !m_bDoubleClicked) ui->txb6->click();
- if (ui->actionBand_Buttons->isChecked()) {
- ui->actionVHF_UHF_Buttons->setVisible(true);
- } else {
- ui->actionVHF_UHF_Buttons->setVisible(false);
- }
- check_button_color();
-}
-
-bool MainWindow::eventFilter (QObject * object, QEvent * event)
-{
- switch (event->type())
- {
- case QEvent::KeyPress:
- // fall through
- case QEvent::MouseButtonPress:
- // reset the Tx watchdog
- tx_watchdog (false);
- break;
-
- case QEvent::ChildAdded:
- // ensure our child widgets get added to our event filter
- add_child_to_event_filter (static_cast<QChildEvent *> (event)->child ());
- break;
-
- case QEvent::ChildRemoved:
- // ensure our child widgets get d=removed from our event filter
- remove_child_from_event_filter (static_cast<QChildEvent *> (event)->child ());
- break;
-
- default: break;
- }
- return QObject::eventFilter(object, event);
-}
-
-void MainWindow::createStatusBar() //createStatusBar
-{
- tx_status_label.setAlignment (Qt::AlignHCenter);
- tx_status_label.setMinimumSize (QSize {100, 18});
- tx_status_label.setStyleSheet ("QLabel{color: #000000; background-color: #00ff00}");
- tx_status_label.setFrameStyle (QFrame::Panel | QFrame::Sunken);
- statusBar()->addWidget (&tx_status_label);
-
- config_label.setAlignment (Qt::AlignHCenter);
- config_label.setMinimumSize (QSize {80, 18});
- config_label.setFrameStyle (QFrame::Panel | QFrame::Sunken);
- statusBar()->addWidget (&config_label);
- config_label.hide (); // only shown for non-default configuration
-
- mode_label.setAlignment (Qt::AlignHCenter);
- mode_label.setMinimumSize (QSize {80, 18});
- mode_label.setFrameStyle (QFrame::Panel | QFrame::Sunken);
- statusBar()->addWidget (&mode_label);
-
- ndecodes_label.setAlignment (Qt::AlignHCenter);
- ndecodes_label.setMinimumSize (QSize {30, 18});
- ndecodes_label.setFrameStyle (QFrame::Panel | QFrame::Sunken);
- statusBar()->addWidget (&ndecodes_label);
-
- last_tx_label.setAlignment (Qt::AlignHCenter);
- last_tx_label.setMinimumSize (QSize {150, 18});
- last_tx_label.setFrameStyle (QFrame::Panel | QFrame::Sunken);
- statusBar()->addWidget (&last_tx_label);
-
- if (m_config.PWR_and_SWR()) statusBar ()->addPermanentWidget (&band_hopping_label);
- band_hopping_label.setAlignment (Qt::AlignHCenter);
- band_hopping_label.setMinimumSize (QSize {80, 18});
- band_hopping_label.setFrameStyle (QFrame::Panel | QFrame::Sunken);
-
- statusBar()->addPermanentWidget(&progressBar);
- progressBar.setMinimumSize (QSize {150, 18});
-
- statusBar ()->addPermanentWidget (&watchdog_label);
- update_watchdog_label ();
-}
-
-void MainWindow::setup_status_bar (bool vhf)
-{
- auto submode = current_submode ();
- if (vhf && submode != QChar::Null) {
- QString t{m_mode + " " + submode};
- if(m_mode=="Q65") t=m_mode + "-" + QString::number(m_TRperiod) + submode;
- mode_label.setText (t);
- } else {
- mode_label.setText (m_mode);
- }
- if ("JT9" == m_mode) {
- mode_label.setStyleSheet ("QLabel{color: #000000; background-color: #ff6ec7}");
- } else if ("JT4" == m_mode) {
- mode_label.setStyleSheet ("QLabel{color: #000000; background-color: #cc99ff}");
- } else if ("Echo" == m_mode) {
- mode_label.setStyleSheet ("QLabel{color: #000000; background-color: #66ffff}");
- } else if ("JT65" == m_mode) {
- mode_label.setStyleSheet ("QLabel{color: #000000; background-color: #66ff66}");
- } else if ("Q65" == m_mode) {
- mode_label.setStyleSheet ("QLabel{color: #000000; background-color: #99ff33}");
- } else if ("MSK144" == m_mode) {
- mode_label.setStyleSheet ("QLabel{color: #000000; background-color: #ff6666}");
- } else if ("FT4" == m_mode) {
- mode_label.setStyleSheet ("QLabel{color: #000000; background-color: #ff0099}");
- } else if ("FT8" == m_mode) {
- mode_label.setStyleSheet ("QLabel{color: #000000; background-color: #ff6699}");
- } else if ("FST4" == m_mode) {
- mode_label.setStyleSheet ("QLabel{color: #000000; background-color: #99ff66}");
- } else if ("FST4W" == m_mode) {
- mode_label.setStyleSheet ("QLabel{color: #000000; background-color: #6699ff}");
- } else if ("FreqCal" == m_mode) {
- mode_label.setStyleSheet ("QLabel{color: #000000; background-color: #ff9933}");
- }
- keep_last_tx_label = true;
- last_tx_label.setText (QString {});
- if (m_mode.contains (QRegularExpression {R"(^(Echo))"})) {
- if (band_hopping_label.isVisible ()) statusBar ()->removeWidget (&band_hopping_label);
- } else if (m_mode=="WSPR") {
- mode_label.setStyleSheet ("QLabel{color: #000000; background-color: #ff66ff}");
- if (!band_hopping_label.isVisible ()) {
- statusBar ()->addWidget (&band_hopping_label);
- band_hopping_label.show ();
- band_hopping_label.setMinimumSize (QSize {80, 18});
- }
- } else {
- if (band_hopping_label.isVisible ()) statusBar ()->removeWidget (&band_hopping_label);
- }
-}
-
-bool MainWindow::subProcessFailed (QProcess * process, int exit_code, QProcess::ExitStatus status)
-{
- if (m_valid && (exit_code || QProcess::NormalExit != status))
- {
- QStringList arguments;
- for (auto argument: process->arguments ())
- {
- if (argument.contains (' ')) argument = '"' + argument + '"';
- arguments << argument;
- }
- if (m_splash && m_splash->isVisible ()) m_splash->hide ();
- MessageBox::critical_message (this, tr ("Subprocess Error")
- , tr ("Subprocess failed with exit code %1")
- .arg (exit_code)
- , tr ("Running: %1\n%2")
- .arg (process->program () + ' ' + arguments.join (' '))
- .arg (QString {process->readAllStandardError()}));
- return true;
- }
- return false;
-}
-
-void MainWindow::subProcessError (QProcess * process, QProcess::ProcessError)
-{
- if (m_valid)
- {
- QStringList arguments;
- for (auto argument: process->arguments ())
- {
- if (argument.contains (' ')) argument = '"' + argument + '"';
- arguments << argument;
- }
- if (m_splash && m_splash->isVisible ()) m_splash->hide ();
- MessageBox::critical_message (this, tr ("Subprocess error")
- , tr ("Running: %1\n%2")
- .arg (process->program () + ' ' + arguments.join (' '))
- .arg (process->errorString ()));
- m_valid = false; // ensures exit if still constructing
- QTimer::singleShot (0, this, SLOT (close ()));
- }
-}
-
-void MainWindow::closeEvent(QCloseEvent * e)
-{
- m_valid = false; // suppresses subprocess errors
- m_config.transceiver_offline ();
- writeSettings ();
- if(m_astroWidget) m_astroWidget.reset ();
- if(m_QSYMessageCreatorWidget) {
- QCloseEvent closeEvent;
- QApplication::sendEvent(m_QSYMessageCreatorWidget.data(), &closeEvent);
- m_QSYMessageCreatorWidget.reset ();
- }
- if(m_QSYMessageWidget) {
- QCloseEvent closeEvent;
- QApplication::sendEvent(m_QSYMessageWidget.data(), &closeEvent);
- m_QSYMessageWidget.reset ();
- }
- if(m_qsymonitorWidget) {
- QCloseEvent closeEvent;
- QApplication::sendEvent(m_qsymonitorWidget.data(), &closeEvent);
- m_qsymonitorWidget.reset ();
- }
- m_guiTimer.stop ();
- m_prefixes.reset ();
- m_shortcuts.reset ();
- m_mouseCmnds.reset ();
- m_colorHighlighting.reset ();
- if(m_mode!="MSK144" and m_mode!="FT8") killFile();
- float sw=0.0;
- int nw=400;
- int nh=100;
- int irow=-99;
- plotsave_(&sw,&nw,&nh,&irow);
- to_jt9(m_ihsym,999,-1); //Tell jt9 to terminate
- if (!proc_jt9.waitForFinished(1000)) proc_jt9.close();
- mem_jt9->detach();
- Q_EMIT finished ();
- QMainWindow::closeEvent (e);
-}
-
-void MainWindow::on_stopButton_clicked() //stopButton
-{
- ui->pbBandHopping->setChecked(false); // disable band hopping
- monitor (false);
- m_loopall=false;
- if(m_bRefSpec) {
- MessageBox::information_message (this, tr ("Reference spectrum saved"));
- m_bRefSpec=false;
- }
- if (ui->DX_Call_Button->isChecked()) ui->DX_Call_Button->click ();
- stopWRTimer.stop(); // Stop any Wait & Reply timeout
- stopWCTimer.stop(); // Stop any Wait & Call timeout
- no_wait_and_call = false;
- m_specOp=m_config.special_op_id();
- if (ui->respondComboBox->isVisible() and ui->respondComboBox->currentIndex()!=0 and !m_diskData) {
- Dpoints=0; // reset points
- maxDPoints=0; // reset points
- dBpoints=-28; // reset points
- dBpoints2=99; // reset points
- maxdBPoints=-28; // reset points
- mindBPoints=99; // reset points
- if (!(m_mode=="Q65" or m_mode=="JT65")) {
- clearDX(); // clear dxCallEntry
- ui->dxGridEntry->clear (); // clear dxGridEntry
- if (!keepTx5) ui->tx5->setCurrentText(""); // clear tx5
- }
- }
- pounce = false;
- ui->autoButton->setChecked(false); // ensure auoButton is unchecked
- filtered = false;
- ignored = false;
- m_muted = false;
- check_button_color();
-}
-
-void MainWindow::on_pbBandHopping_clicked()
-{
- if (m_auto) ui->pbBandHopping->setChecked(false); // don't allow band hopping when in QSO
-}
-
-void MainWindow::on_actionRelease_Notes_triggered ()
-{
-// QDesktopServices::openUrl (QUrl {"https://wsjt-x-improved.sourceforge.io/Release_Notes.txt"});
- QDesktopServices::openUrl (QUrl {"https://wsjt.sourceforge.io/Release_Notes.txt"});
-}
-
-void MainWindow::on_actionFT8_DXpedition_Mode_User_Guide_triggered()
-{
- QDesktopServices::openUrl (QUrl {"https://wsjt.sourceforge.io/FT8_DXpedition_Mode.pdf"});
-}
-
-void MainWindow::on_actionSuperFox_User_Guide_triggered()
-{
- QDesktopServices::openUrl (QUrl {"https://wsjt.sourceforge.io/SuperFox_User_Guide.pdf"});
-}
-
-void MainWindow::on_actionQSG_FST4_triggered()
-{
- QDesktopServices::openUrl (QUrl {"https://wsjt.sourceforge.io/FST4_Quick_Start.pdf"});
-}
-
-void MainWindow::on_actionQSG_Q65_triggered()
-{
- QDesktopServices::openUrl (QUrl {"https://wsjt.sourceforge.io/Q65_Quick_Start.pdf"});
-}
-
-void MainWindow::on_actionQSG_X250_M3_triggered()
-{
- QDesktopServices::openUrl (QUrl {"https://wsjt.sourceforge.io/WSJTX_2.5.0_MAP65_3.0_Quick_Start.pdf"});
-}
-
-void MainWindow::on_actionQuick_Start_Guide_to_WSJT_X_2_7_and_QMAP_triggered()
-{
- QDesktopServices::openUrl (QUrl {"https://wsjt.sourceforge.io/Quick_Start_WSJT-X_2.7_QMAP.pdf"});
-}
-
-void MainWindow::on_actionWSJT_X_improved_Home_Page_triggered()
-{
- QDesktopServices::openUrl (QUrl {"https://wsjt-x-improved.sourceforge.io/"});
-}
-
-void MainWindow::on_actionThe_additional_features_of_wsjt_x_improved_triggered()
-{
- QDesktopServices::openUrl (QUrl {"https://wsjt-x-improved.sourceforge.io/The_additional_features_of_wsjt-x_improved.pdf"});
-}
-
-void MainWindow::on_actionRecommended_Audio_Settings_triggered()
-{
- auto const& message = tr("It is very important to avoid audio harmonics and distorted audio signals.\n"
- "This is usually achieved by the following step-by-step approach:\n\n"
- "1. Select 'Fake it' in the Settings/Radio menu as your 'Split mode'. If your\n"
- " rig does not support this, select 'Rig'. But really try to avoid 'None'!\n\n"
- "2. Set the transmission power of your transceiver to maximum.\n\n"
- "3. Set the Pwr slider to the minimum and click on the 'Tune' button.\n\n"
- "4. Observe the actual transmission power of your rig as well as ALC.\n\n"
- "5. Carefully increase the Pwr slider until you have reached the\n"
- " maximum transmit powe of your transceiver.\n\n"
- "6. VERY IMPORTANT: Now reduce the Pwr slider until you reach approx. \n"
- " 90% of your max. Tx power. ALC should be close to zero.\n\n"
- "7. This is the maximum audio level permitted with your setup.\n"
- " Always stay with the Pwr slider below this max. value.\n\n"
- "If possible, check your transmission from time to time with a webSDR\n"
- "to ensure the signal is clean and not distorted.");
- QTimer::singleShot (0, [=] { // don't block guiUpdate
- MessageBox::warning_message(this, tr ("<b>Recommended Audio Settings</b>"), message); });
-}
-
-void MainWindow::on_actionRig_Control_Errors_triggered()
-{
- QDesktopServices::openUrl (QUrl {"https://wsjt-x-improved.sourceforge.io/How_to_deal_with_rig_control_errors.pdf"});
-}
-
-void MainWindow::on_actionOnline_User_Guide_triggered() //Display manual
-{
-// QDesktopServices::openUrl (QUrl {"https://wsjt-x-improved.sourceforge.io/wsjtx-main_en.html"});
- #if defined (CMAKE_BUILD)
- m_manual.display_html_url (QUrl {PROJECT_MANUAL_DIRECTORY_URL}, PROJECT_MANUAL);
- #endif
-}
-
-//Display local copy of manual
-void MainWindow::on_actionLocal_User_Guide_triggered()
-{
-#if defined (CMAKE_BUILD)
- m_manual.display_html_file (m_config.doc_dir (), PROJECT_MANUAL);
-#endif
-}
-
-void MainWindow::on_actionWide_Waterfall_triggered() //Display Waterfalls
-{
- m_wideGraph->showNormal();
-}
-
-void MainWindow::on_actionEcho_Graph_triggered()
-{
- m_echoGraph->showNormal();
-}
-
-void MainWindow::on_actionFast_Graph_triggered()
-{
- m_fastGraph->showNormal();
-}
-
-void MainWindow::on_actionSolve_FreqCal_triggered()
-{
- auto data_dir {QDir::toNativeSeparators(m_config.writeable_data_dir().absolutePath()).toLocal8Bit ()};
- int iz,irc;
- double a,b,rms,sigmaa,sigmab;
- calibrate_(data_dir.constData(), &iz, &a, &b, &rms, &sigmaa, &sigmab, &irc, (FCL)data_dir.size());
- QString t2;
- if(irc==-1) t2="Cannot open " + data_dir + "/fmt.all";
- if(irc==-2) t2="Cannot open " + data_dir + "/fcal2.out";
- if(irc==-3) t2="Insufficient data in fmt.all";
- if(irc==-4) t2 = tr ("Invalid data in fmt.all at line %1").arg (iz);
- if(irc>0 or rms>1.0) t2="Check fmt.all for possible bad data.";
- if (irc < 0 || irc > 0 || rms > 1.) {
- MessageBox::warning_message (this, "Calibration Error", t2);
- }
- else if (MessageBox::Apply == MessageBox::query_message (this
- , tr ("Good Calibration Solution")
- , tr ("<pre>"
- "%1%L2 ±%L3 ppm\n"
- "%4%L5 ±%L6 Hz\n\n"
- "%7%L8\n"
- "%9%L10 Hz"
- "</pre>")
- .arg ("Slope: ", 12).arg (b, 0, 'f', 3).arg (sigmab, 0, 'f', 3)
- .arg ("Intercept: ", 12).arg (a, 0, 'f', 2).arg (sigmaa, 0, 'f', 2)
- .arg ("N: ", 12).arg (iz)
- .arg ("StdDev: ", 12).arg (rms, 0, 'f', 2)
- , QString {}
- , MessageBox::Cancel | MessageBox::Apply)) {
- m_config.set_calibration (Configuration::CalibrationParams {a, b});
- if (MessageBox::Yes == MessageBox::query_message (this
- , tr ("Delete Calibration Measurements")
- , tr ("The \"fmt.all\" file will be renamed as \"fmt.bak\""))) {
- // rename fmt.all as we have consumed the resulting calibration
- // solution
- auto const& backup_file_name = m_config.writeable_data_dir ().absoluteFilePath ("fmt.bak");
- QFile::remove (backup_file_name);
- QFile::rename (m_config.writeable_data_dir ().absoluteFilePath ("fmt.all"), backup_file_name);
- }
- }
-}
-
-void MainWindow::on_actionCopyright_Notice_triggered()
-{
- auto const& message = tr("If you make fair use of any part of WSJT-X under terms of the GNU "
- "General Public License, you must display the following copyright "
- "notice prominently in your derivative work:\n\n"
- "\"The algorithms, source code, look-and-feel of WSJT-X and related "
- "programs, and protocol specifications for the modes FSK441, FST4, FT8, "
- "JT4, JT6M, JT9, JT65, JTMS, QRA64, Q65, MSK144 are Copyright (C) "
- "2001-2025 by one or more of the following authors: Joseph Taylor, "
- "K1JT; Bill Somerville, G4WJS; Steven Franke, K9AN; Nico Palermo, "
- "IV3NWV; Greg Beam, KI7MT; Michael Black, W9MDB; Edson Pereira, PY2SDR; "
- "Philip Karn, KA9Q; Uwe Risse, DG2YCB; Brian Moran, N9ADG; Roger Rehr, "
- "W3SZ; and other members of the WSJT Development Group.\"");
- MessageBox::warning_message(this, message);
-}
-
-// Implement the MultiGeometryWidget::change_layout() operation.
-void MainWindow::change_layout (std::size_t n)
-{
- switch (n)
- {
- case 1: // SWL view
- ui->menuBar->show ();
- ui->lower_panel_widget->hide ();
- trim_view (false); // ensure we can switch back
- break;
-
- case 2: // hide menus view
- ui->menuBar->hide ();
- ui->lower_panel_widget->show ();
- trim_view (true);
- break;
-
- default: // normal view
- ui->menuBar->setVisible (ui->cbMenus->isChecked ());
- ui->lower_panel_widget->show ();
- trim_view (!ui->cbMenus->isChecked ());
- break;
- }
-}
-
-void MainWindow::on_actionSWL_Mode_triggered (bool checked)
-{
- select_geometry (checked ? 1 : ui->cbMenus->isChecked () ? 0 : 2);
-}
-
-// This allows the window to shrink by removing certain things
-// and reducing space used by controls
-void MainWindow::trim_view (bool checked)
-{
- int spacing = checked ? 1 : 6;
- if (checked) {
- statusBar ()->removeWidget (&auto_tx_label);
- } else {
- statusBar ()->addWidget(&auto_tx_label);
- }
- if (m_mode != "FreqCal" && m_mode != "WSPR" && m_mode != "FST4W") {
- ui->lh_decodes_title_label->setVisible(!checked);
- ui->rh_decodes_title_label->setVisible(!checked);
- }
- ui->lh_decodes_headings_label->setVisible(!checked);
- ui->rh_decodes_headings_label->setVisible(!checked);
- ui->gridLayout_5->layout()->setSpacing(spacing);
- ui->horizontalLayout_2->layout()->setSpacing(spacing);
- ui->horizontalLayout_5->layout()->setSpacing(spacing);
- ui->horizontalLayout_6->layout()->setSpacing(spacing);
- ui->horizontalLayout_7->layout()->setSpacing(spacing);
- ui->horizontalLayout_8->layout()->setSpacing(spacing);
- ui->horizontalLayout_9->layout()->setSpacing(spacing);
- ui->horizontalLayout_10->layout()->setSpacing(spacing);
- ui->horizontalLayout_11->layout()->setSpacing(spacing);
- ui->horizontalLayout_12->layout()->setSpacing(spacing);
- ui->horizontalLayout_13->layout()->setSpacing(spacing);
- ui->horizontalLayout_14->layout()->setSpacing(spacing);
- ui->rh_decodes_widget->layout()->setSpacing(spacing);
- ui->verticalLayout_2->layout()->setSpacing(spacing);
- ui->verticalLayout_3->layout()->setSpacing(spacing);
- ui->verticalLayout_5->layout()->setSpacing(spacing);
- ui->verticalLayout_7->layout()->setSpacing(spacing);
- ui->verticalLayout_8->layout()->setSpacing(spacing);
- ui->tab->layout()->setSpacing(spacing);
-}
-
-void MainWindow::on_actionAstronomical_data_toggled (bool checked)
-{
- if (checked)
- {
- m_astroWidget.reset (new Astro {m_settings, &m_config});
-
- // hook up termination signal
- connect (this, &MainWindow::finished, m_astroWidget.data (), &Astro::close);
- connect (m_astroWidget.data (), &Astro::tracking_update, [this] {
- m_astroCorrection = {};
- setRig ();
- setXIT (ui->TxFreqSpinBox->value ());
- displayDialFrequency ();
- });
- m_astroWidget->showNormal();
- m_astroWidget->raise ();
- m_astroWidget->activateWindow ();
- m_astroWidget->nominal_frequency (m_freqNominal, m_freqTxNominal);
- }
- else
- {
- m_astroWidget.reset ();
- }
-}
-
-void MainWindow::on_actionQSYMessage_Creator_triggered()
-{
- if (!m_QSYMessageCreatorWidget) {
- m_QSYMessageCreatorWidget.reset (new QSYMessageCreator {m_settings, &m_config});
- // hook up termination signal
- connect (this, &MainWindow::finished, &QSYMessageCreator::close);
- //connect to signal from QSYMessageCreator
- connect (m_QSYMessageCreatorWidget.data (), &QSYMessageCreator::sendMessage, this, &MainWindow::update_tx5);
- connect (m_QSYMessageCreatorWidget.data (), &QSYMessageCreator::sendQSYMessageCreatorStatus, this, &MainWindow::setQSYMessageCreatorStatus);
- }
- m_QSYMessageCreatorValue = true;
-// m_QSYMessageCreatorWidget->setWindowFlags(m_QSYMessageCreatorWidget->windowFlags() | Qt::WindowStaysOnTopHint);
- m_QSYMessageCreatorWidget->showNormal();
- m_QSYMessageCreatorWidget->raise();
- m_QSYMessageCreatorWidget->activateWindow();
- m_QSYMessageCreatorWidget->getDxBase(QString(Radio::base_callsign(ui->dxCallEntry->text())));
- ui->actionEnable_QSY_Popups->setChecked(true);
-}
-
-void MainWindow::on_actionQSY_Monitor_triggered()
-{
- if (!m_qsymonitorWidget) {
- m_qsymonitorWidget.reset (new QSYMonitor {m_settings, m_config.decoded_text_font (), &m_config});
- // hook up termination signal
- connect (this, &MainWindow::finished, &QSYMonitor::close);
- }
- m_qsymonitorValue = true;
- m_qsymonitorWidget->showNormal();
- m_qsymonitorWidget->raise();
- m_qsymonitorWidget->activateWindow();
-}
-
-void MainWindow::on_fox_log_action_triggered()
-{
- if (!m_foxLogWindow)
- {
- m_foxLogWindow.reset (new FoxLogWindow {m_settings, &m_config, m_logBook.fox_log ()});
-
- // Connect signals from fox log window
- connect (this, &MainWindow::finished, m_foxLogWindow.data (), &FoxLogWindow::close);
- connect (m_foxLogWindow.data (), &FoxLogWindow::reset_log_model, [this] () {
- m_logBook.fox_log ()->reset ();
- });
- }
- m_foxLogWindow->showNormal ();
- m_foxLogWindow->raise ();
- m_foxLogWindow->activateWindow ();
-}
-
-void MainWindow::on_contest_log_action_triggered()
-{
- if (!m_contestLogWindow)
- {
- m_contestLogWindow.reset (new CabrilloLogWindow {m_settings, &m_config, m_logBook.contest_log ()->model ()});
-
- // Connect signals from contest log window
- connect (this, &MainWindow::finished, m_contestLogWindow.data (), &CabrilloLogWindow::close);
- }
- m_contestLogWindow->showNormal ();
- m_contestLogWindow->raise ();
- m_contestLogWindow->activateWindow ();
- // connect signal from m_logBook.contest_log to m_contestLogWindow
- connect(m_logBook.contest_log(), &CabrilloLog::qso_count_changed, m_contestLogWindow.data (), &CabrilloLogWindow::set_nQSO);
- m_contestLogWindow->set_nQSO(m_logBook.contest_log()->n_qso());
-}
-
-void MainWindow::on_actionColors_triggered()
-{
- if (!m_colorHighlighting)
- {
- m_colorHighlighting.reset (new ColorHighlighting {m_settings, m_config.decode_highlighting ()});
- connect (&m_config, &Configuration::decode_highlighting_changed, m_colorHighlighting.data (), &ColorHighlighting::set_items);
- }
- m_colorHighlighting->showNormal ();
- m_colorHighlighting->raise ();
- m_colorHighlighting->activateWindow ();
-}
-
-void MainWindow::on_actionMessage_averaging_triggered()
-{
- if(m_msgAvgWidget == NULL) {
- m_msgAvgWidget.reset (new MessageAveraging {m_settings, m_config.decoded_text_font ()});
-
- // Connect signals from Message Averaging window
- connect (this, &MainWindow::finished, m_msgAvgWidget.data (), &MessageAveraging::close);
- }
- m_msgAvgWidget->showNormal();
- m_msgAvgWidget->raise();
- m_msgAvgWidget->activateWindow();
-}
-
-void MainWindow::on_actionActiveStations_triggered()
-{
- if(m_ActiveStationsWidget == NULL) {
- m_ActiveStationsWidget.reset (new ActiveStations {m_settings, m_config.decoded_text_font ()});
- // Connect signals from Message Averaging window
- connect (this, &MainWindow::finished, m_ActiveStationsWidget.data (), &ActiveStations::close);
- }
- m_ActiveStationsWidget->showNormal();
- m_ActiveStationsWidget->raise();
- m_ActiveStationsWidget->activateWindow();
- configActiveStations();
- connect(m_ActiveStationsWidget.data(), SIGNAL(callSandP(int)),this,SLOT(callSandP2(int)));
- // connect up another signal to handle clicks in the Activity window when in Fox mode
- connect(m_ActiveStationsWidget.data(), SIGNAL(queueActiveWindowHound(QString)),this,SLOT(queueActiveWindowHound2(QString)),static_cast<Qt::ConnectionType>(Qt::UniqueConnection));
- connect(m_ActiveStationsWidget.data(), SIGNAL(activeStationsDisplay()),this,SLOT(ARRL_Digi_Display()));
- m_ActiveStationsWidget->setScore(m_score);
- if(m_mode=="Q65") m_ActiveStationsWidget->setRate(m_score);
- QString as_mode = m_mode;
- if(m_mode=="FT8" && SpecOp::FOX==m_specOp) as_mode="Fox Mode"; // TODO - active stations for hound mode?
- m_ActiveStationsWidget->setupUi(as_mode);
-}
-
-void MainWindow::on_actionOpen_triggered() //Open File
-{
- monitor (false);
-
- QString fname;
- fname=QFileDialog::getOpenFileName(this, "Open File", m_path,
- "WSJT Files (*.wav)");
- if(!fname.isEmpty ()) {
- m_path=fname;
- int i1=fname.lastIndexOf("/");
- QString baseName=fname.mid(i1+1);
- tx_status_label.setStyleSheet("QLabel{color: #000000; background-color: #99ffff}");
- tx_status_label.setText(" " + baseName + " ");
- m_diskData=true;
- on_stopButton_clicked();
- read_wav_file (fname);
- }
-}
-
-void MainWindow::read_wav_file (QString const& fname)
-{
- if (m_mode=="FT8" && m_multithreadFT8) {
- m_nDecodes=0; // reset the decodes counter
- ndecodes_label.setText("");
- earlyDecodes = ""; // reset dupe check
- }
- // call diskDat() when done
- int i0=fname.lastIndexOf("_");
- int i1=fname.indexOf(".wav");
- int i3=fname.lastIndexOf("/");
- QString baseName=fname.mid(i3+1);
- int i4=baseName.indexOf(".wav");
- m_nutc0=m_UTCdisk;
- if (i1-i3 > 13) {
- m_UTCdisk=baseName.mid(7, 6).toInt();
- if (i4-i3 > 6) {
- m_UTCdiskDateTime = QDateTime::fromString("20" + baseName.mid(0, 13) + "Z", "yyyyMMdd_hhmmsst").toUTC();
- } else {
- m_UTCdiskDateTime = QDateTime{};
- }
- } else {
- m_UTCdisk=fname.mid(i0+1,i1-i0-1).toInt();
- if (i0 > 6) {
- m_UTCdiskDateTime = QDateTime::fromString("20" + fname.mid(i0 - 6, 13) + "Z", "yyyyMMdd_hhmmsst").toUTC();
- } else {
- m_UTCdiskDateTime = QDateTime{};
- }
- }
-
- if (m_config.insert_blank() && !(ui->actionInclude_averaging->isVisible() && ui->actionInclude_averaging->isChecked())) { // insert blank line
- if(!fname.isEmpty ()) {
- if (ui->actionUse_Dark_Style->isChecked()) {
- ui->decodedTextBrowser->insertText(("----- " + baseName + " -----"), "#a2a2a2", "#000000");
- } else {
- ui->decodedTextBrowser->insertLineSpacer("----- " + baseName + " -----");
- }
- }
- }
-
- m_wav_future_watcher.setFuture (QtConcurrent::run ([this, fname] {
- auto basename = fname.mid (fname.lastIndexOf ('/') + 1);
- auto pos = fname.indexOf (".wav", 0, Qt::CaseInsensitive);
- int i1=fname.indexOf(".wav");
- int i3=fname.lastIndexOf("/");
- // global variables and threads do not mix well, this needs changing
- dec_data.params.nutc = 0;
- if (pos > 0) {
- if (i1-i3 > 13) {
- dec_data.params.nutc = basename.mid(7, 6).toInt();
- m_fileDateTime=basename.mid(0, 13);
- } else {
- if (pos == fname.indexOf ('_', -11) + 7) {
- dec_data.params.nutc = fname.mid (pos - 6, 6).toInt ();
- m_fileDateTime=fname.mid(pos-13,13);
- } else {
- dec_data.params.nutc = 100 * fname.mid (pos - 4, 4).toInt ();
- m_fileDateTime=fname.mid(pos-11,11);
- }
- }
- }
- BWFFile file {QAudioFormat {}, fname};
- bool ok=file.open (BWFFile::ReadOnly);
- if(ok) {
- auto bytes_per_frame = file.format ().bytesPerFrame ();
- int nsamples=m_TRperiod * RX_SAMPLE_RATE;
- qint64 max_bytes = std::min (std::size_t (nsamples),
- sizeof (dec_data.d2) / sizeof (dec_data.d2[0]))* bytes_per_frame;
- auto n = file.read (reinterpret_cast<char *> (dec_data.d2),
- std::min (max_bytes, file.size ()));
- int frames_read = n / bytes_per_frame;
- // zero unfilled remaining sample space
- std::memset(&dec_data.d2[frames_read],0,max_bytes - n);
- if (11025 == file.format ().sampleRate ()) {
- short sample_size = file.format ().sampleSize ();
- wav12_ (dec_data.d2, dec_data.d2, &frames_read, &sample_size);
- }
- dec_data.params.kin = frames_read;
- dec_data.params.newdat = 1;
- } else {
- dec_data.params.kin = 0;
- dec_data.params.newdat = 0;
- }
-
- dec_data.params.yymmdd=basename.left(6).toInt();
- }));
-}
-
-void MainWindow::on_actionOpen_next_in_directory_triggered() //Open Next
-{
- if(m_decoderBusy) return;
- monitor (false);
- int i,len;
- QFileInfo fi(m_path);
- QStringList list;
- list= fi.dir().entryList().filter(".wav",Qt::CaseInsensitive);
- for (i = 0; i < list.size()-1; ++i) {
- len=list.at(i).length();
- if(list.at(i)==m_path.right(len)) {
- int n=m_path.length();
- QString fname=m_path.replace(n-len,len,list.at(i+1));
- m_path=fname;
- int i1=fname.lastIndexOf("/");
- QString baseName=fname.mid(i1+1);
- tx_status_label.setStyleSheet("QLabel{color: #000000; background-color: #99ffff}");
- tx_status_label.setText(" " + baseName + " ");
- m_diskData=true;
- read_wav_file (fname);
- if(m_loopall and (i==list.size()-2)) {
- m_loopall=false;
- m_bNoMoreFiles=true;
- }
- return;
- }
- }
-}
-//Open all remaining files
-void MainWindow::on_actionDecode_remaining_files_in_directory_triggered()
-{
- if(m_decoderBusy) return;
- m_loopall=true;
- on_actionOpen_next_in_directory_triggered();
-}
-
-void MainWindow::diskDat() //diskDat()
-{
- m_wideGraph->setDiskUTC(dec_data.params.nutc);
- if(dec_data.params.kin>0) {
- int k;
- int kstep=m_FFTSize;
- m_diskData=true;
- float db=m_config.degrade();
- float bw=m_config.RxBandwidth();
- if(db > 0.0) degrade_snr_(dec_data.d2,&dec_data.params.kin,&db,&bw);
- for(int n=1; n<=m_hsymStop; n++) { // Do the waterfall spectra
-// k=(n+1)*kstep; //### Why was this (n+1) ??? ###
- k=n*kstep;
- if(k > dec_data.params.kin) break;
- dec_data.params.npts8=k/8;
- dataSink(k);
- qApp->processEvents(); //Update the waterfall
- }
- } else {
- MessageBox::information_message(this, tr("No data read from disk. Wrong file format?"));
- }
-}
-
-//Delete ../save/*.wav
-void MainWindow::on_actionDelete_all_wav_files_in_SaveDir_triggered()
-{
- auto button = MessageBox::query_message (this, tr ("Confirm Delete"),
- tr ("Are you sure you want to delete all *.wav and *.c2 files in \"%1\"?")
- .arg (QDir::toNativeSeparators (m_config.save_directory ().absolutePath ())));
- if (MessageBox::Yes == button) {
- Q_FOREACH (auto const& file
- , m_config.save_directory ().entryList ({"*.wav", "*.c2"}, QDir::Files | QDir::Writable)) {
- m_config.save_directory ().remove (file);
- }
- }
-}
-
-void MainWindow::on_actionNone_triggered() //Save None
-{
- m_saveDecoded=false;
- m_saveAll=false;
- ui->actionNone->setChecked(true);
-}
-
-void MainWindow::on_actionSave_decoded_triggered()
-{
- m_saveDecoded=true;
- m_saveAll=false;
- ui->actionSave_decoded->setChecked(true);
-}
-
-void MainWindow::on_actionSave_all_triggered() //Save All
-{
- m_saveDecoded=false;
- m_saveAll=true;
- ui->actionSave_all->setChecked(true);
-}
-
-void MainWindow::on_actionKeyboard_shortcuts_triggered()
-{
- if (!m_shortcuts)
- {
- QFont font;
- font.setPointSize (10);
- m_shortcuts.reset (new HelpTextWindow {tr ("Keyboard Shortcuts"),
- //: Keyboard shortcuts help window contents
- tr (R"(<table cellspacing=1>
- <tr><td><b>Esc </b></td><td>Stop Tx, abort QSO, clear next-call queue</td></tr>
- <tr><td><b>F1 </b></td><td>Online User's Guide (Alt: transmit Tx6)</td></tr>
- <tr><td><b>Shift+F1 </b></td><td>Copyright Notice</td></tr>
- <tr><td><b>Ctrl+F1 </b></td><td>About WSJT-X</td></tr>
- <tr><td><b>F2 </b></td><td>Open settings window (Alt: transmit Tx2)</td></tr>
- <tr><td><b>F3 </b></td><td>Display keyboard shortcuts (Alt: transmit Tx3)</td></tr>
- <tr><td><b>F4 </b></td><td>Clear DX Call, DX Grid, Tx messages 1-4 (Alt: transmit Tx4)</td></tr>
- <tr><td><b>Alt+F4 </b></td><td>Exit program</td></tr>
- <tr><td><b>F5 </b></td><td>Display special mouse commands (Alt: transmit Tx5)</td></tr>
- <tr><td><b>F6 </b></td><td>Open next file in directory (Alt: toggle "Call 1st")</td></tr>
- <tr><td><b>Shift+F6 </b></td><td>Decode all remaining files in directory</td></tr>
- <tr><td><b>F7 </b></td><td>Display Message Averaging window</td></tr>
- <tr><td><b>F11 </b></td><td>Move Rx frequency down 1 Hz</td></tr>
- <tr><td><b>Ctrl+F11 </b></td><td>Move identical Rx and Tx frequencies down 1 Hz</td></tr>
- <tr><td><b>Shift+F11 </b></td><td>Move Tx frequency down 60 Hz (FT8) or 90 Hz (FT4)</td></tr>
- <tr><td><b>Ctrl+Shift+F11 </b></td><td>Move dial frequency down 1000 Hz</td></tr>
- <tr><td><b>F12 </b></td><td>Move Rx frequency up 1 Hz</td></tr>
- <tr><td><b>Ctrl+F12 </b></td><td>Move identical Rx and Tx frequencies up 1 Hz</td></tr>
- <tr><td><b>Shift+F12 </b></td><td>Move Tx frequency up 60 Hz (FT8) or 90 Hz (FT4)</td></tr>
- <tr><td><b>Ctrl+Shift+F12 </b></td><td>Move dial frequency up 1000 Hz</td></tr>
- <tr><td><b>Alt+1-6 </b></td><td>Set now transmission to this number on Tab 1</td></tr>
- <tr><td><b>Ctl+1-6 </b></td><td>Set next transmission to this number on Tab 1</td></tr>
- <tr><td><b>Alt+A </b></td><td>Clear Active Stations for QMAP</td></tr>
- <tr><td><b>Alt+B </b></td><td>Toggle "Best S+P" status</td></tr>
- <tr><td><b>Alt+C </b></td><td>Toggle "Call 1st" checkbox</td></tr>
- <tr><td><b>Alt+D </b></td><td>Decode again at QSO frequency</td></tr>
- <tr><td><b>Shift+D </b></td><td>Full decode (both windows)</td></tr>
- <tr><td><b>Ctrl+E </b></td><td>Turn on TX even/1st</td></tr>
- <tr><td><b>Shift+E </b></td><td>Turn off TX even/1st</td></tr>
- <tr><td><b>Alt+E </b></td><td>Erase</td></tr>
- <tr><td><b>Ctrl+F </b></td><td>Edit the free text message box</td></tr>
- <tr><td><b>Alt+G </b></td><td>Generate standard messages</td></tr>
- <tr><td><b>Alt+H </b></td><td>Halt Tx</td></tr>
- <tr><td><b>Ctrl+I </b></td><td>Add Dx Call to the Ignore List</td></tr>
- <tr><td><b>Ctrl+L </b></td><td>Lookup callsign in database, generate standard messages</td></tr>
- <tr><td><b>Alt+M </b></td><td>Monitor</td></tr>
- <tr><td><b>Alt+N </b></td><td>Toggle "Enable Tx"</td></tr>
- <tr><td><b>Ctrl+O </b></td><td>Open a .wav file</td></tr>
- <tr><td><b>Alt+O </b></td><td>Change operator</td></tr>
- <tr><td><b>Alt+Q </b></td><td>Open "Log QSO" window</td></tr>
- <tr><td><b>Ctrl+R </b></td><td>Set Tx4 message to RRR (not in FT4)</td></tr>
- <tr><td><b>Alt+R </b></td><td>Set Tx4 message to RR73</td></tr>
- <tr><td><b>Ctrl+Shift+R </b></td><td>Refresh Active Stations window</td></tr>
- <tr><td><b>Alt+S </b></td><td>Stop monitoring</td></tr>
- <tr><td><b>Alt+T </b></td><td>Toggle Tune status</td></tr>
- <tr><td><b>Alt+Z </b></td><td>Clear hung decoder status</td></tr>
-
-</table>)"), font});
- }
- m_shortcuts->showNormal ();
- m_shortcuts->raise ();
-}
-
-void MainWindow::on_actionSpecial_mouse_commands_triggered()
-{
- if (!m_mouseCmnds)
- {
- QFont font;
- font.setPointSize (10);
- m_mouseCmnds.reset (new HelpTextWindow {tr ("Special Mouse Commands"),
- //: Mouse commands help window contents
- tr (R"(<table cellpadding=5>
- <tr>
- <th align="right">Click on</th>
- <th align="left">Action</th>
- </tr>
- <tr>
- <td align="right">Waterfall:</td>
- <td><b>Click</b> to set Rx frequency.<br/>
- <b>Right-click</b> to set Tx frequency.<br/>
- <b>Double-right-click</b> to set Rx and Tx frequencies.
- </td>
- </tr>
- <tr>
- <td align="right">Decoded text:</td>
- <td><b>Double-click</b> to copy second callsign to Dx Call, locator to Dx Grid, change Rx<br/>
- and Tx frequency to decoded signal's frequency, and generate standard messages.<br/>
- Hold down <b>Alt</b> to prevent Tx from being enabled on <b>double-click</b>.<br/>
- If <b>Hold Tx Freq</b> is checked or first callsign in message is your<br/>
- own call, Tx frequency is not changed unless <b>Ctrl</b> is held down.
- </td>
- </tr>
- <tr>
- <td align="right">Dial Frequency:</td>
- <td><b>Turn the mouse wheel</b> to change the kHz values, or:<br/>
- <b>Right-click</b> to increase frequency by 1 kHz.<br/>
- <b>Left-click</b> to decrease frequency by 1 kHz.<br/>
- The mouse pointer must be over the Dial Frequency indicator.
- </td>
- </tr>
- <tr>
- <td align="right">H Button:</td>
- <td><b>Click</b> to toggle FT8 Hound Mode On/Off.<br/>
- <b>Right-click</b> to activate or deactivate SuperFox mode.
- </td>
- </tr>
- <tr>
- <td align="right">FT8 Button:</td>
- <td><b>Click</b> to switch to FT8 Hound Mode.<br/>
- <b>Right-click</b> to toggle last used Special Operating Activity On/Off.
- </td>
- </tr>
- <tr>
- <td align="right">Q65 Button:</td>
- <td><b>Click</b> to switch to Q65 Mode.<br/>
- <b>Right-click</b> to switch to Q65 Pileup Mode.
- </td>
- </tr>
- <tr>
- <td align="right">JT65 Button:</td>
- <td><b>Click</b> to switch to JT65 Mode.<br/>
- <b>Right-click</b> to switch to JT9 Mode.
- </td>
- </tr>
- <tr>
- <td align="right">Tx5 Button:</td>
- <td><b>Right-click</b> to retain Tx5 free text.
- </td>
- </tr>
- <tr>
- <td align="right">Tx Even/1st:</td>
- <td><b>Right-click</b> to freeze the state of the checkbox.<br/>
- <b>Right-click on the FT8 Button</b> to unfreeze.
- </td>
- </tr>
- <tr>
- <td align="right">Enable Tx Button:</td>
- <td><b>Click</b> to toggle Auto-Tx mode On/Off.<br/>
- <b>Right-click</b> to toggle Wait & Pounce On/Off.
- </td>
- </tr>
- <tr>
- <td align="right">Erase button:</td>
- <td><b>Click</b> to erase Rx Frequency window.<br/>
- <b>Double-click</b> to erase Rx Frequency and Band Activity windows.<br/>
- If <b>Alternate Erase button behavior</b> is checked:<br/>
- <b>Click</b> to erase Band Activity window.<br/>
- <b>Right-click</b> to erase Rx Frequency window.<br/>
- <b>Double-click</b> to erase Rx Frequency and Band Activity windows.
- </td>
- </tr>
- <tr>
- <td align="right">DX Call Button:</td>
- <td><b>Click</b> to toggle Wait & Call On/Off.<br/>
- <b>Right-click</b> to clear the Dx Call, Dx Grid and Std Msgs.
- </td>
- </tr>
- <tr>
- <td align="right">Lookup Button:</td>
- <td><b>Click</b> to search for callsign in database.<br/>
- <b>Right-click</b> to search for Dx Call on qrz.com.
- </td>
- </tr>
- <tr>
- <td align="right">Add Button:</td>
- <td><b>Click</b> to add callsign and locator to database.<br/>
- <b>Right-click</b> to search for Dx Call on hamqth.com.
- </td>
- </tr>
- <tr>
- <td align="right">Ignore Button:</td>
- <td><b>Click</b> to add callsign to the Ignore List.<br/>
- <b>Right-click</b> to search for Dx Call on qrzcq.com.
- </td>
- </tr>
- <tr>
- <td align="right">Band Buttons:</td>
- <td><b>Click</b> to toggle band / mode default frequencies.<br/>
- <b>Right-click</b> to toggle FT8 DXpedition frequencies.
- </td>
- </tr>
-</table>)"), font});
- }
- m_mouseCmnds->showNormal ();
- m_mouseCmnds->raise ();
-}
-
-void MainWindow::on_DecodeButton_clicked (bool /* checked */) //Decode request
-{
- if(m_mode=="MSK144") {
- ui->DecodeButton->setChecked(false);
- } else {
- if(m_mode!="WSPR" && !m_decoderBusy) {
- m_manualDecode=true;
- dec_data.params.newdat=0;
- dec_data.params.nagain=1;
- decode();
- }
- }
-}
-
-void MainWindow::freezeDecode(int n) //freezeDecode()
-{
- if((n%100)==2) {
- if(m_mode=="FST4" and m_config.single_decode() and ui->sbFtol->value()>10) ui->sbFtol->setValue(10);
- on_DecodeButton_clicked (true);
- }
-}
-
-void MainWindow::on_ClrAvgButton_clicked()
-{
- m_nclearave=1;
- if(m_mode=="Echo") {
- echocom_.nsum=0;
- m_echoGraph->clearAvg();
- m_wideGraph->restartTotalPower();
- } else {
- if(m_msgAvgWidget != NULL) {
- if(m_msgAvgWidget->isVisible()) m_msgAvgWidget->displayAvg("");
- }
- if(m_mode=="Q65") ndecodes_label.setText("0 0");
- }
-}
-
-void MainWindow::msgAvgDecode2()
-{
- on_DecodeButton_clicked (true);
-}
-
-void MainWindow::decode() //decode()
-{
- if(m_decoderBusy) return; //Don't start decoder if it's already busy.
- m_fetched=0;
- QDateTime now = QDateTime::currentDateTimeUtc ();
- if( m_dateTimeLastTX.isValid () ) {
- qint64 isecs_since_tx = m_dateTimeLastTX.secsTo(now);
- dec_data.params.lapcqonly= (isecs_since_tx > 300);
- } else {
- m_dateTimeLastTX = now.addSecs(-900);
- dec_data.params.lapcqonly=true;
- }
- if(m_diskData) {
- dec_data.params.lapcqonly=false;
- } else {
- dec_data.params.yymmdd=-1;
- }
- if(!m_dataAvailable or m_TRperiod==0.0) return;
- ui->DecodeButton->setChecked (true);
- if(!dec_data.params.nagain && m_diskData && m_TRperiod >= 60.) {
- dec_data.params.nutc=dec_data.params.nutc/100;
- }
- if(dec_data.params.nagain==0 && dec_data.params.newdat==1 && (!m_diskData)) {
- m_dateTimeSeqStart = qt_truncate_date_time_to (QDateTime::currentDateTimeUtc (), m_TRperiod * 1.e3);
- auto t = m_dateTimeSeqStart.time ();
- dec_data.params.nutc = t.hour () * 100 + t.minute ();
- if (m_TRperiod < 60.)
- {
- dec_data.params.nutc = dec_data.params.nutc * 100 + t.second ();
- }
- }
-
- if(m_nPick==1 and !m_diskData) {
- QDateTime t=QDateTime::currentDateTimeUtc();
- int ihr=t.toString("hh").toInt();
- int imin=t.toString("mm").toInt();
- int isec=t.toString("ss").toInt();
- isec=isec - fmod(double(isec),m_TRperiod);
- dec_data.params.nutc=10000*ihr + 100*imin + isec;
- }
- if(m_nPick==2) dec_data.params.nutc=m_nutc0;
- dec_data.params.nQSOProgress = m_QSOProgress;
- dec_data.params.nfqso=m_wideGraph->rxFreq();
- dec_data.params.nftx = ui->TxFreqSpinBox->value ();
- qint32 depth {m_ndepth};
- if (!ui->actionInclude_averaging->isVisible ()) depth &= ~16;
- if (!ui->actionInclude_correlation->isVisible ()) depth &= ~32;
- if (!ui->actionEnable_AP_DXcall->isVisible ()) depth &= ~64;
- if (!ui->actionAuto_Clear_Avg->isVisible()) depth &= ~128;
- dec_data.params.ndepth=depth;
- dec_data.params.n2pass=1;
- if(m_config.twoPass()) dec_data.params.n2pass=2;
- dec_data.params.nranera=m_config.ntrials();
- dec_data.params.naggressive=m_config.aggressive();
- dec_data.params.nrobust=0;
- dec_data.params.ndiskdat=0;
- if(m_diskData) dec_data.params.ndiskdat=1;
- dec_data.params.nfa=m_wideGraph->nStartFreq();
- dec_data.params.nfSplit=m_wideGraph->Fmin(); // Not used any more?
- if(dec_data.params.nfSplit==8) dec_data.params.nfSplit=1;
-
- dec_data.params.nfb=m_wideGraph->Fmax();
- if(m_mode=="FT8" and SpecOp::HOUND==m_specOp and !ui->cbRxAll->isChecked() and
- !m_config.superFox()) dec_data.params.nfb=1000;
- if(m_mode=="FT8" and SpecOp::FOX == m_specOp ) dec_data.params.nfqso=200;
- dec_data.params.b_even_seq=(dec_data.params.nutc%10)==0;
- dec_data.params.b_superfox=(m_config.superFox() and (SpecOp::FOX == m_specOp or SpecOp::HOUND == m_specOp));
- if(dec_data.params.b_superfox and dec_data.params.b_even_seq and m_ihsym<50) return;
-
- dec_data.params.ntol=ui->sbFtol->value ();
- if(m_mode=="FST4") {
- dec_data.params.ntol=ui->sbFtol->value();
- if(m_config.single_decode()) {
- dec_data.params.nfa=m_wideGraph->rxFreq() - ui->sbFtol->value();
- dec_data.params.nfb=m_wideGraph->rxFreq() + ui->sbFtol->value();
- } else {
- dec_data.params.nfa=ui->sbF_Low->value();
- dec_data.params.nfb=ui->sbF_High->value();
- }
- }
- if(m_mode=="FST4W") dec_data.params.ntol=ui->sbFST4W_FTol->value();
- if(dec_data.params.nutc < m_nutc0) m_RxLog = 1; //Date and Time to file "ALL.TXT".
- if(dec_data.params.newdat==1 and !m_diskData) m_nutc0=dec_data.params.nutc;
- dec_data.params.ntxmode=9;
- dec_data.params.nmode=9;
- if(m_mode=="JT65") dec_data.params.nmode=65;
- if(m_mode=="JT65") dec_data.params.ljt65apon = ui->actionEnable_AP_JT65->isVisible () &&
- ui->actionEnable_AP_JT65->isChecked ();
- if(m_mode=="Q65") dec_data.params.nmode=66;
- if(m_mode=="Q65") dec_data.params.ntxmode=66;
- if(m_mode=="JT4") {
- dec_data.params.nmode=4;
- dec_data.params.ntxmode=4;
- }
- if(m_mode=="FT8") dec_data.params.nmode=8;
- if(m_mode=="FT8") dec_data.params.lft8apon = ui->actionEnable_AP_FT8->isVisible () &&
- ui->actionEnable_AP_FT8->isChecked ();
- if(m_mode=="FT8") dec_data.params.napwid=50;
- if(m_mode=="FT4") {
- dec_data.params.nmode=5;
- m_BestCQpriority="";
- }
- if(m_mode=="FST4") dec_data.params.nmode=240;
- if(m_mode=="FST4W") dec_data.params.nmode=241;
- dec_data.params.ntxmode=dec_data.params.nmode; // Is this used any more?
- dec_data.params.ntrperiod=m_TRperiod;
- dec_data.params.nsubmode=m_nSubMode;
- dec_data.params.minw=0;
- dec_data.params.nclearave=m_nclearave;
- if(m_nclearave!=0) {
- QFile f(m_config.temp_dir ().absoluteFilePath ("avemsg.txt"));
- f.remove();
- }
- dec_data.params.dttol=m_DTtol;
- dec_data.params.emedelay=0.0;
- if(m_config.decode_at_52s()) dec_data.params.emedelay=2.5;
- dec_data.params.minSync=ui->syncSpinBox->isVisible () ? m_minSync : 0;
- dec_data.params.nexp_decode=int(m_specOp);
- if(dec_data.params.nexp_decode==5) dec_data.params.nexp_decode=1; //NA VHF, WW Digi, ARRL Digi contests
- if(dec_data.params.nexp_decode==8) dec_data.params.nexp_decode=1; //and Q65 Pileup all use 4-character
- if(dec_data.params.nexp_decode==9) dec_data.params.nexp_decode=1; //grid exchange
- if(m_config.single_decode()) dec_data.params.nexp_decode += 32;
- if(m_config.enable_VHF_features()) dec_data.params.nexp_decode += 64;
- if(m_mode.startsWith("FST4")) dec_data.params.nexp_decode += 256*(ui->sbNB->value()+3);
- dec_data.params.max_drift=ui->sbMaxDrift->value();
- QString hisGrid;
- hisGrid=ui->dxGridEntry->text ();
- QString hisCall;
- hisCall=ui->dxCallEntry->text ();
-
- if(m_mode=="FT8" && m_multithreadFT8)
- {
- //FT8 block of parameters for multithreaded FT8 decoder
- dec_data.params.nstophint = 0; // stophint should be false to avoid truncating decode process
- dec_data.params.nQSOProgress = m_QSOProgress;
- dec_data.params.nftx = ui->TxFreqSpinBox->value ();
- if(m_freqNominal < 30000000) dec_data.params.napwid=5; // FT8AP decoding bandwidth for 'mycall hiscall ???' and RRR,RR73,73 messages
- else if(m_freqNominal < 100000000) dec_data.params.napwid=15;
- else dec_data.params.napwid=50;
- dec_data.params.nmt=m_ft8threads;
- dec_data.params.ncandthin=m_ncandthin;
- dec_data.params.ndtcenter=0; // ft8mod was 100 * ui->DTCenterSpinBox->value();
- if (m_ihsym==m_earlyDecode or m_ihsym==m_earlyDecode2) {
- dec_data.params.nft8cycles=2;
- } else {
- dec_data.params.nft8cycles=m_nFT8Cycles;
- }
- if(m_houndMode) { dec_data.params.nft8rxfsens=1; } else { dec_data.params.nft8rxfsens=m_nFT8RXfSens; }
- dec_data.params.nft4depth=m_nFT4depth;
- if(m_ft8Sensitivity==1) dec_data.params.lft8lowth=false;
- else dec_data.params.lft8lowth=true;
- if(m_ft8Sensitivity==3) dec_data.params.lft8subpass=true;
- else dec_data.params.lft8subpass=false;
- dec_data.params.ltxing=(m_auto && (QDateTime::currentMSecsSinceEpoch()-m_mslastTX) < 26000) ? 1 : 0; // ft8mdwas ( m_enableTx and jtdxTime etc.
- dec_data.params.lhideft8dupes=ui->actionHide_FT8_dupe_messages->isChecked() ? 1 : 0; //ft8md ui->actionHide_FT8_dupe_messages->isChecked() ? 1 : 0;
- dec_data.params.lhound=m_houndMode ? 1 : 0;
- dec_data.params.lcommonft8b=m_commonFT8b;
- m_bMyCallStd=stdCall(m_config.my_callsign ()); //ft8md
- m_bHisCallStd=stdCall(m_hisCall); //ft8md
- dec_data.params.lmycallstd=m_bMyCallStd;
- dec_data.params.lhiscallstd=m_bHisCallStd;
- dec_data.params.lapmyc=m_lapmyc;
- dec_data.params.lmodechanged=false; // m_modeChanged ? 1 : 0; m_modeChanged=false;
- dec_data.params.lbandchanged=m_band_changed ? 1 : 0; // m_band_changed=false;
- dec_data.params.lmultinst=m_multInst ? 1 : 0;
- dec_data.params.lskiptx1=m_skipTx1 ? 1 : 0;
- dec_data.params.nlasttx=m_nlasttx;
- //ft8md dec_data.params.lforcesync=ui->syncButton->isChecked() && m_mode=="FT8";
- dec_data.params.ndecoderstart=m_ft8DecoderStart;
- dec_data.params.nsecbandchanged=m_nsecBandChanged; m_nsecBandChanged=0;
- dec_data.params.nhint=m_hint ? 1 : 0;
- dec_data.params.ndelay=m_delay;
- dec_data.params.nfqso=m_wideGraph->rxFreq();
- dec_data.params.ndepth=m_ndepth;
- dec_data.params.nranera=m_config.ntrials();
- dec_data.params.lmultift8=m_multithreadFT8; //ft8md
- dec_data.params.ntrials10=0; //ft8md was =m_config.ntrials10();
- dec_data.params.ntrialsrxf10=0; //ft8md was m_config.ntrialsrxf10();
- dec_data.params.nprepass=4; //ft8md was m_config.npreampass();
- dec_data.params.naggressive=1; //ft8md was m_config.aggressive();
- dec_data.params.nharmonicsdepth=0; //ft8md was m_config.harmonicsdepth();
- dec_data.params.ntopfreq65=3000; //ft8md was m_config.ntopfreq65();
- dec_data.params.nsdecatt=1; //ft8md was m_config.nsingdecatt();
- dec_data.params.fmaskact=true; //ft8md was m_config.fmaskact();
- if (m_ihsym==m_earlyDecode or m_ihsym==m_earlyDecode2 or (m_specOp==SpecOp::HOUND && m_config.superFox())) {
- dec_data.params.lmultift8 = false; // use the standard FT8 decoder for early decoding step
- if (m_ihsym==m_earlyDecode2) dec_data.params.ndepth=2;
- }
- qDebug() << "dec_data.params.lmultift8 is" << dec_data.params.lmultift8; //ft8md
- dec_data.params.ndiskdat=0;
- if(m_diskData) dec_data.params.ndiskdat=1;
- dec_data.params.nfa=m_wideGraph->nStartFreq();
- dec_data.params.nfSplit=m_wideGraph->Fmin();
- dec_data.params.nfb=m_wideGraph->Fmax();
- dec_data.params.ntol=50; // this value is not being used
- dec_data.params.ntrperiod=int(m_TRperiod);
- dec_data.params.lwidedxcsearch=m_FT8WideDxCallSearch ? 1 : 0;
- }
- ::memcpy(dec_data.params.datetime, m_dateTime.toLatin1()+" ", sizeof dec_data.params.datetime);
- ::memcpy(dec_data.params.mycall, (m_config.my_callsign()+" ").toLatin1(),12);
-
- ::memcpy(dec_data.params.mybcall, (Radio::base_callsign(m_config.my_callsign())+" ").toLatin1(),12);
- ::memcpy(dec_data.params.hiscall,(hisCall+" ").toLatin1(),12);
- if(hisCall.length()<3) {
- hisCall.clear();
- ::memcpy(dec_data.params.hisbcall,(hisCall+" ").toLatin1(),12);
- } else {
- ::memcpy(dec_data.params.hisbcall,(Radio::base_callsign(hisCall)+" ").toLatin1(),12);
- }
- ::memcpy(dec_data.params.hisgrid,(hisGrid+" ").toLatin1(),6);
- ::memcpy(dec_data.params.mygrid, (m_config.my_grid()+" ").toLatin1(),6);
-
- if(!hisCall.isEmpty() && !m_auto && hisCall != m_lastloggedcall) dec_data.params.lenabledxcsearch=true; //ft8md was && !m_enableTx
- else dec_data.params.lenabledxcsearch=false;
-
- if (auto * to = reinterpret_cast<char *> (mem_jt9->data()))
- {
- char *from = (char*) dec_data.ipc;
- int size=sizeof(struct dec_data);
- if(dec_data.params.newdat==0) {
- int noffset {offsetof (struct dec_data, params.nutc)};
- to += noffset;
- from += noffset;
- size -= noffset;
- }
- if(m_mode=="MSK144" or m_bFast9) {
- float t0=m_t0;
- float t1=m_t1;
- qApp->processEvents(); //Update the waterfall
- if(m_nPick > 0) {
- t0=m_t0Pick;
- t1=m_t1Pick;
- }
- static short int d2b[360000];
- narg[0]=dec_data.params.nutc;
- if(m_kdone>int(12000.0*m_TRperiod)) {
- m_kdone=int(12000.0*m_TRperiod);
- }
- narg[1]=m_kdone;
- narg[2]=m_nSubMode;
- narg[3]=dec_data.params.newdat;
- narg[4]=dec_data.params.minSync;
- narg[5]=m_nPick;
- narg[6]=1000.0*t0;
- narg[7]=1000.0*t1;
- narg[8]=2; //Max decode lines per decode attempt
- if(dec_data.params.minSync<0) narg[8]=50;
- if(m_mode=="JT9") narg[9]=102; //Fast JT9
- if(m_mode=="MSK144") narg[9]=104; //MSK144
- narg[10]=ui->RxFreqSpinBox->value();
- narg[11]=ui->sbFtol->value ();
- narg[12]=0;
- narg[13]=-1;
- narg[14]=m_config.aggressive();
- memcpy(d2b,dec_data.d2,2*360000);
- watcher3.setFuture (QtConcurrent::run (std::bind (fast_decode_, &d2b[0],
- &narg[0],&m_TRperiod, &m_msg[0][0], dec_data.params.mycall,
- dec_data.params.hiscall, (FCL)8000, (FCL)12, (FCL)12)));
- } else {
- mem_jt9->lock ();
- memcpy(to, from, qMin(mem_jt9->size(), size));
- mem_jt9->unlock ();
- to_jt9(m_ihsym,1,-1); //Send m_ihsym to jt9[.exe] and start decoding
- decodeBusy(true);
- }
- }
- if((m_mode=="FT4" or (m_mode=="FT8" and m_ihsym==41) or m_diskData) and
- m_ActiveStationsWidget != NULL) {
- if(m_mode!="Q65") m_ActiveStationsWidget->erase(); //TEMP
- }
-}
-
-void::MainWindow::fast_decode_done()
-{
- float t,tmax=-99.0;
- dec_data.params.nagain=false;
- dec_data.params.ndiskdat=false;
-// if(m_msg[0][0]==0) m_bDecoded=false;
- for(int i=0; m_msg[i][0] && i<100; i++) {
- QString message=QString::fromLatin1(m_msg[i]);
- m_msg[i][0]=0;
- if(message.length()>80) message=message.left (80);
- if(narg[13]/8==narg[12]) message=message.trimmed().replace("<...>",m_calls);
-
-//Left (Band activity) window
- DecodedText decodedtext {message.replace (QChar::LineFeed, "")};
- if(!m_bFastDone) {
- ui->decodedTextBrowser->displayDecodedText (decodedtext, m_config.my_callsign (), m_mode, m_config.DXCC (),
- m_logBook, m_currentBandPeriod, m_config.ppfx (), false, false, 0.0, false, -99, "", m_muted);
- if(m_position != 0) ui->decodedTextBrowser->horizontalScrollBar()->setValue(m_position);
- }
-
- t=message.mid(10,5).toFloat();
- if(t>tmax) {
- tmax=t;
- m_bDecoded=true;
- }
- postDecode (true, decodedtext.string ());
- write_all("Rx",message);
-
- if(m_mode=="JT9" or m_mode=="MSK144") {
-// find and extract any report for myCall
- bool stdMsg = decodedtext.report(m_baseCall,
- Radio::base_callsign(ui->dxCallEntry->text()), m_rptRcvd);
-
-// extract details and send to PSKreporter
- if (stdMsg) pskPost (decodedtext);
- }
- if (tmax >= 0.0) auto_sequence (decodedtext, ui->sbFtol->value (), ui->sbFtol->value ());
- }
- m_startAnother=m_loopall;
- m_nPick=0;
- ui->DecodeButton->setChecked (false);
- m_bFastDone=false;
-}
-
-void MainWindow::to_jt9(qint32 n, qint32 istart, qint32 idone)
-{
- if (auto * dd = reinterpret_cast<dec_data_t *> (mem_jt9->data()))
- {
- mem_jt9->lock ();
- dd->ipc[0]=n;
- if(istart>=0) dd->ipc[1]=istart;
- if(idone>=0) dd->ipc[2]=idone;
- mem_jt9->unlock ();
- }
-}
-
-void MainWindow::decodeDone ()
-{
- if(m_mode=="Q65") m_wideGraph->drawRed(0,0);
- if ("FST4W" == m_mode)
- {
- if (m_uploadWSPRSpots
- && m_config.is_transceiver_online ()) { // need working rig control
-#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0)
- uploadTimer.start(QRandomGenerator::global ()->bounded (0, 20000)); // Upload delay
-#else
- uploadTimer.start(20000 * qrand()/((double)RAND_MAX + 1.0)); // Upload delay
-#endif
- }
- }
- auto tnow = QDateTime::currentDateTimeUtc ();
- double tdone = fmod(double(tnow.time().second()),m_TRperiod);
- int mswait;
- if( tdone < 0.5*m_TRperiod ) {
- mswait = 1000.0 * ( 0.6 * m_TRperiod - tdone );
- } else {
- mswait = 1000.0 * ( 1.6 * m_TRperiod - tdone );
- }
- m_bDecoded=m_nDecodes>0;
- if(!m_diskData and !m_saveAll) {
- if(m_saveDecoded and (m_nDecodes==0)) {
- killFileTimer.start(mswait); //Kill at 3/4 period
- }
- }
-
- dec_data.params.nagain=0;
- dec_data.params.ndiskdat=0;
- m_nclearave=0;
- ui->DecodeButton->setChecked (false);
- decodeBusy(false);
- m_RxLog=0;
- if(SpecOp::FOX == m_specOp) {
- houndCallers();
- if(ui->cbWorkDupes->isChecked()) QTimer::singleShot (5000, [=] {band_activity_cleared();});
- }
- to_jt9(m_ihsym,-1,1); //Tell jt9 we know it has finished
-
- m_startAnother=m_loopall;
- if(m_bNoMoreFiles) {
- MessageBox::information_message(this, tr("No more files to open."));
- m_bNoMoreFiles=false;
- }
-
- if((m_mode=="FT4" or m_mode=="FT8")
- and m_latestDecodeTime>=0 and m_ActiveStationsWidget!=NULL) {
- if(!m_diskData and (m_nDecodes==0)) {
- m_latestDecodeTime = (QDateTime::currentMSecsSinceEpoch()/1000) % 86400;
- m_latestDecodeTime = int(m_latestDecodeTime/m_TRperiod);
- m_latestDecodeTime = int(m_latestDecodeTime*m_TRperiod);
- }
- ARRL_Digi_Display(); // Update the ARRL_DIGI display
- }
-
- if(m_mode!="FT8" or dec_data.params.nzhsym==50 or (m_mode=="FT8" and m_multithreadFT8 and (m_hsymStop==dec_data.params.nzhsym))) m_nDecodes=0; //ft8md
-
- if(m_mode=="Q65" and (m_specOp==SpecOp::NA_VHF or m_specOp==SpecOp::ARRL_DIGI
- or m_specOp==SpecOp::WW_DIGI or m_specOp==SpecOp::Q65_PILEUP)
- and m_ActiveStationsWidget!=NULL) {
- refreshPileupList();
- }
-}
-
-void MainWindow::refreshPileupList()
-{
- // Update the ActiveStations display for Q65 pileup situation...
- int nlist=0;
- char list[2000];
- char line[36];
- list[0]=0;
- auto fname {QDir::toNativeSeparators(m_config.writeable_data_dir().absoluteFilePath("tsil.3q"))};
- get_q3list_(const_cast<char *> (fname.toLatin1().constData()), &m_diskData, &nlist,
- &list[0], (FCL)fname.length(), (FCL)2000);
- QString t="";
- QString t0="";
- for(int i=0; i<nlist; i++) {
- memcpy(line,&list[36*i],36);
- t0=QString::fromLatin1(line)+"\n";
- m_callers[i]=t0;
- t+=t0;
- }
- m_ActiveStationsWidget->setClickOK(false);
- m_ActiveStationsWidget->displayRecentStations("Q65-pileup",t);
- m_ActiveStationsWidget->setClickOK(true);
-}
-
-void MainWindow::read_log()
-{
- static QFile f {QDir {QStandardPaths::writableLocation (QStandardPaths::DataLocation)}.absoluteFilePath ("wsjtx.log")};
- f.open(QIODevice::ReadOnly);
- if(f.isOpen()) {
- QTextStream in(&f);
- QString line,callsign;
- for(int i=0; i<99999; i++) {
- line=in.readLine();
- if(line.length()<=0) break;
- callsign=line.mid(40,6);
- int n=callsign.indexOf(",");
- if(n>0) callsign=callsign.left(n);
- m_EMEworked[callsign]=true;
- m_score++;
- }
- f.close();
- }
- if(m_ActiveStationsWidget!=NULL) {
- m_ActiveStationsWidget->setScore(m_score);
- if(m_mode=="Q65") m_ActiveStationsWidget->setRate(m_score);
- }
-}
-
-void MainWindow::ARRL_Digi_Update(DecodedText dt)
-{
- if(m_mode=="Q65") {
- m_fetched=0;
- readWidebandDecodes();
- return;
- }
-
- // Extract information relevant for the ARRL Digi contest
- QString deCall;
- QString deGrid;
- dt.deCallAndGrid(/*out*/deCall,deGrid);
- ActiveCall ac;
- RecentCall rc;
-
- if(deGrid.contains(grid_regexp)) {
- if(!m_activeCall.contains(deCall) or deGrid!=m_activeCall.value(deCall).grid4) {
- // Transmitting station's call is not already in QMap "m_activeCall", or grid has changed.
- // Insert the call, grid, and associated fixed data into the list.
-
- double utch=0.0;
- int nAz,nEl,nDmiles,nDkm,nHotAz,nHotABetter;
- QString my_Grid = m_config.my_grid();
- if (my_Grid.length() < 5) my_Grid = m_config.my_grid().left(4)+"mm";
- QString de_Grid= deGrid.left(4)+"mm";
- azdist_(const_cast <char *> (my_Grid.toLatin1().constData()),
- const_cast <char *> (de_Grid.toLatin1().constData()),&utch,
- &nAz,&nEl,&nDmiles,&nDkm,&nHotAz,&nHotABetter,(FCL)6,(FCL)6);
- int points=nDkm/500;
- if(nDkm > 500*points) points += 1;
- points += 1;
- ac.grid4=deGrid;
- ac.bands=".......";
- ac.az=nAz;
- ac.points=points;
- m_activeCall[deCall]=ac;
- }
- }
-
- m_points=-1;
- if(m_activeCall.contains(deCall)) {
-
-// Don't display stations we already worked on this band.
- QString band=m_config.bands()->find(m_freqNominal);
- if(band=="160m" and m_activeCall[deCall].bands.indexOf("a")>=0) {m_recentCall.remove(deCall); return;}
- if(band=="80m" and m_activeCall[deCall].bands.indexOf("b")>=0) {m_recentCall.remove(deCall); return;}
- if(band=="40m" and m_activeCall[deCall].bands.indexOf("c")>=0) {m_recentCall.remove(deCall); return;}
- if(band=="20m" and m_activeCall[deCall].bands.indexOf("d")>=0) {m_recentCall.remove(deCall); return;}
- if(band=="15m" and m_activeCall[deCall].bands.indexOf("e")>=0) {m_recentCall.remove(deCall); return;}
- if(band=="10m" and m_activeCall[deCall].bands.indexOf("f")>=0) {m_recentCall.remove(deCall); return;}
- if(band=="6m" and m_activeCall[deCall].bands.indexOf("g")>=0) {m_recentCall.remove(deCall); return;}
-
- // Update the variable data for this deCall
- rc.dialFreq=m_freqNominal;
- rc.audioFreq=dt.frequencyOffset();
- rc.snr=dt.snr();
- m_latestDecodeTime=dt.timeInSeconds();
- rc.txEven = (m_latestDecodeTime % int(2*m_TRperiod)) > 0;
- rc.ready2call=false;
- bool bCQ=dt.messageWords()[0].left(3)=="CQ ";
- if(bCQ or deGrid=="RR73" or deGrid=="73") rc.ready2call=true;
- rc.decodeTime=m_latestDecodeTime;
- m_recentCall[deCall]=rc;
- m_points=m_activeCall.value(deCall).points;
- }
- updateRate();
-}
-
-void MainWindow::ARRL_Digi_Display()
-{
- if(m_mode=="Q65") {
- m_fetched=0;
- readWidebandDecodes();
- return;
- }
- if (m_mode == "Fox Mode") { // ARRL_Digi_Display can be shown for other modes
- if (m_ActiveStationsWidget != NULL) {
- m_ActiveStationsWidget->setClickOK(true);
- }
- return;
- }
- QMutableMapIterator<QString,RecentCall> icall(m_recentCall);
- QString deCall,deGrid;
- int age=0;
- int i=0;
- int maxAge=m_ActiveStationsWidget->maxAge();
- int points=0;
- int maxPoints=0;
- int indx[1000];
- float pts[1000];
- QStringList list;
-
- while (icall.hasNext()) {
- icall.next();
- deCall=icall.key();
- age=int((m_latestDecodeTime - icall.value().decodeTime)/m_TRperiod + 0.5);
- if(age<0) age=age + int(86400/m_TRperiod);
- int itx=1;
- if(icall.value().txEven) itx=0;
- int snr=icall.value().snr;
- int freq=icall.value().audioFreq;
- if(age>maxAge) {
- icall.remove();
- } else {
- bool bReady=false;
- if(age==0 and m_recentCall.value(deCall).ready2call) bReady=true;
-
- QString bands=m_activeCall[deCall].bands;
- bool bWorkedOnBand=false;
- if(m_currentBand=="160m" and bands.mid(0,1)!=".") bWorkedOnBand=true;
- if(m_currentBand=="80m" and bands.mid(1,1)!=".") bWorkedOnBand=true;
- if(m_currentBand=="40m" and bands.mid(2,1)!=".") bWorkedOnBand=true;
- if(m_currentBand=="20m" and bands.mid(3,1)!=".") bWorkedOnBand=true;
- if(m_currentBand=="15m" and bands.mid(4,1)!=".") bWorkedOnBand=true;
- if(m_currentBand=="10m" and bands.mid(5,1)!=".") bWorkedOnBand=true;
- if(m_currentBand=="6m" and bands.mid(6,1)!=".") bWorkedOnBand=true;
-
- if((bReady or !m_ActiveStationsWidget->readyOnly()) and !bWorkedOnBand) {
- i++;
- int az=m_activeCall[deCall].az;
- deGrid=m_activeCall[deCall].grid4;
- points=m_activeCall[deCall].points;
- if(points>maxPoints) maxPoints=points;
- float x=float(age)/(maxAge+1);
- if(x>1.0) x=0;
- pts[i-1]=points - x;
- QString t1;
- if(!bReady) t1 = t1.asprintf(" %3d %+2.2d %4d %1d %2d %4d",az,snr,freq,itx,age,points);
- if(bReady) t1 = t1.asprintf(" %3d %+2.2d %4d %1d %2d*%4d",az,snr,freq,itx,age,points);
-// t1 = (deCall + " ").left(6) + " " + m_activeCall[deCall].grid4 + t1 + " " + bands;
- t1 = (deCall + " ").left(6) + " " + m_activeCall[deCall].grid4 + t1;
- list.append(t1);
- }
- }
- }
- if(i==0) return;
- int jz=i;
- m_ActiveStationsWidget->setClickOK(false);
- int maxRecent=qMin(i,m_ActiveStationsWidget->maxRecent());
- indexx_(pts,&jz,indx);
- QString t;
- i=0;
- for(int j=jz-1; j>=0; j--) {
- int k=indx[j]-1;
- m_ready2call[i]=list[k];
- i++;
- QString t1=QString::number(i) + ". ";
- if(i<10) t1=" " + t1;
- t += (t1 + list[k] + "\n");
- if(i>=maxRecent) break;
- }
- bool is_fox_mode = (m_mode=="FT8" && m_specOp == SpecOp::FOX);
- if(m_ActiveStationsWidget!=NULL && !is_fox_mode) m_ActiveStationsWidget->displayRecentStations(m_mode,t);
- m_ActiveStationsWidget->setClickOK(true);
-}
-
-void MainWindow::queueActiveWindowHound2(QString line) {
- // Active Window shows what's going on outside of current F/H display rules (calling below 1000Hz e.g.)
- // TODO should we allow calling a station that's calling another station, not us?
- if (m_mode == "FT8" and m_specOp == SpecOp::FOX) {
- // process the line to get the callsign
- QStringList w = line.split(' ', SkipEmptyParts);
- // make sure our call is the first in the list, or the station is CQing (not a directed CQ)
- if ( (w.size() > 7) &&
- (w[5] == m_config.my_callsign() || w[5] == "<"+m_config.my_callsign()+">" || w[5]=="CQ") &&
- ( w[7].contains(grid_regexp) || w[7].contains(non_r_db_regexp) )){
- QString caller = w[6];
- QString grid = "";
- QString db = w[1];
- int db_i = w[1].toInt();
- db = (db_i >=0 ? "+":"") + QStringLiteral("%1").arg(db_i, (db_i >=0 ? 2:3), 10, QLatin1Char('0')); // +00, -01 etc.
- // houndcall rpt grid
- if (w[7].contains(grid_regexp)) grid = w[7];
- if (w[7].contains(non_r_db_regexp)) {
- LOG_INFO(QString("ActiveStations Window click: %1 called with signal report %2").arg(caller).arg(w[7]));
- }
- if (caller.length() > 2) {
- // make sure it's not already in the queue
- for ( QString hs : m_houndQueue) {
- if (hs.startsWith(caller)) {
- //LOG_INFO(QString("ActiveStations Window click: %1 already in queue. Skipping").arg(hs));
- return;
- }
- }
- // make sure caller is not in fox queue either
- if(m_foxQSOinProgress.contains(caller)) {
- //LOG_INFO(QString("ActiveStations Window click: %1 already in progress. Skipping").arg(caller));
- return;
- }
-
- QString caller_rpt = (caller+" ").mid(0,12)+db;
- if (m_houndQueue.count() < MAX_HOUNDS_IN_QUEUE) {
- // add it to the queue
- m_houndQueue.enqueue(caller_rpt + " " + grid);
- refreshHoundQueueDisplay();
- // TODO: remove from active stations window too?
- }
- removeHoundFromCallingList(caller);
- }
- } else {
- LOG_INFO(QString("ActiveStations Window click: skipping %1").arg(line));
- }
- }
-}
-
-void MainWindow::callSandP2(int n)
-{
- m_specOp=m_config.special_op_id();
- bool bCtrl = (n<0);
- n=qAbs(n)-1;
- if(m_mode!="Q65" and m_ready2call[n]=="") return;
- QStringList w=m_ready2call[n].split(' ', SkipEmptyParts);
- if(m_mode=="Q65" and m_specOp==SpecOp::Q65_PILEUP and n < 40) {
- // This code is for 6m EME DXpedition operator
- w=m_callers[n].split(' ', SkipEmptyParts);
- m_deCall=w[2];
- if(bCtrl) {
- // Remove this call from q3list.
- rm_q3list_(const_cast<char *> (m_deCall.toLatin1().constData()), m_deCall.size());
- refreshPileupList();
- return;
- }
- m_deGrid=w[3];
- m_bDoubleClicked=true; //### needed?
- m_txFirst=true;
- ui->dxCallEntry->setText(m_deCall);
- ui->dxGridEntry->setText(m_deGrid);
- ui->txFirstCheckBox->setChecked(m_txFirst);
- genStdMsgs("-22");
- setTxMsg(3);
- if (!ui->autoButton->isChecked()) ui->autoButton->click(); // Enable Tx
- if(m_transmitting) m_restart=true;
- return;
- }
-
- if(m_mode=="Q65") {
- if(!bCtrl) { //Do not reset m_freqNominal if CTRL was down
- double kHz=w[1].toDouble();
- int nMHz=m_freqNominal/1000000;
- m_freqNominal=(nMHz*1000 + kHz)* 1000;
- }
- m_deCall=w[4];
- m_deGrid=w[5];
- m_txFirst=(w[6]=="0");
-// ui->TxFreqSpinBox->setValue(1500);
- } else {
- m_deCall=w[0];
- m_deGrid=w[1];
- ui->RxFreqSpinBox->setValue(w[4].toInt());
- m_txFirst = (w[5]=="0");
- }
-
- if(w[3].left(2)=="30") {
- ui->sbTR->setValue(30);
- } else {
- ui->sbTR->setValue(60);
- }
- if(w[3].right(1)=="A") ui->sbSubmode->setValue(0);
- if(w[3].right(1)=="B") ui->sbSubmode->setValue(1);
- if(w[3].right(1)=="C") ui->sbSubmode->setValue(2);
- if(w[3].right(1)=="D") ui->sbSubmode->setValue(3);
- if(w[3].right(1)=="E") ui->sbSubmode->setValue(4);
- if(w[3].right(1)=="F") ui->sbSubmode->setValue(5);
-
- m_bDoubleClicked=true; //### needed?
- ui->dxCallEntry->setText(m_deCall);
- ui->dxGridEntry->setText(m_deGrid);
- if(m_mode=="Q65") {
- ui->rptSpinBox->setValue(w[2].toInt());
- genStdMsgs(w[2]);
- } else {
- genStdMsgs(w[3]);
- }
- setTxMsg(1);
- ui->txFirstCheckBox->setChecked(m_txFirst);
- static qint64 ms0=0;
- qint64 ms=QDateTime::currentMSecsSinceEpoch();
- if(SpecOp::NONE==m_specOp) {
- if(ui->autoButton->isChecked()) {
- if((ms-ms0)>500) ui->autoButton->click(); // Disable Tx on single click
- } else if((ms-ms0)<=500) {
- ui->autoButton->click(); // Enable Tx again, on double click
- }
- if(m_mode=="Q65" && m_ActiveStationsWidget!=NULL) {
- setRig (m_freqNominal);
- setXIT (ui->TxFreqSpinBox->value ());
- }
- } else {
- if(ui->autoButton->isChecked()) {
- if((ms-ms0)<=500) ui->autoButton->click(); // Disable Tx on double click
- } else if((ms-ms0)>500) {
- ui->autoButton->click(); // Enable Tx on single click
- }
- }
- ms0=ms;
- if(m_transmitting) m_restart=true;
-}
-
-void MainWindow::activeWorked(QString call, QString band)
-{
- QString bands=m_activeCall[call].bands;
- QByteArray ba=bands.toLatin1();
- if(band=="160m") ba[0]='a';
- if(band=="80m") ba[1]='b';
- if(band=="40m") ba[2]='c';
- if(band=="20m") ba[3]='d';
- if(band=="15m") ba[4]='e';
- if(band=="10m") ba[5]='f';
- if(band=="6m") ba[6]='g';
- m_activeCall[call].bands=QString::fromLatin1(ba);
-}
-
-void MainWindow::readFromStdout() //readFromStdout
-{
- bool bDisplayPoints = false;
- filtered = false;
- ignored = false;
- m_muted = false;
- QString all_decodes;
- if(m_ActiveStationsWidget!=NULL) {
- bDisplayPoints=(m_mode=="FT4" or m_mode=="FT8") and
- (m_specOp==SpecOp::ARRL_DIGI or m_ActiveStationsWidget->isVisible());
- }
- while(proc_jt9.canReadLine()) {
- auto line_read = proc_jt9.readLine ();
-
- QString the_line = QString(line_read);
- if(ui->actionEnable_QSY_Popups->isChecked() || m_qsymonitorWidget) showQSYMessage(the_line);
-
- if (m_mode == "FT8" and m_specOp == SpecOp::FOX and m_ActiveStationsWidget != NULL) { // see if we should add this to ActiveStations window
- if (!m_ActiveStationsWidget->wantedOnly() ||
- (the_line.contains(" " + m_config.my_callsign() + " ") ||
- the_line.contains(" <" + m_config.my_callsign() + "> ")))
- all_decodes.append(line_read);
- }
- if (auto p = std::strpbrk (line_read.constData (), "\n\r")) {
- // truncate before line ending chars
- line_read = line_read.left (p - line_read.constData ());
- }
- if(bDisplayPoints) line_read=line_read.replace("a7"," ");
- bool haveFSpread {false};
- bool blockUDP {false}; // allow udp spotting (JTAlert) for all non-filtered messages
- bool block_right_display {false};
- float fSpread {0.};
- if (m_mode.startsWith ("FST4"))
- {
- auto text = line_read.mid (64, 6).trimmed ();
- if (text.size ())
- {
- fSpread = text.toFloat (&haveFSpread);
- line_read = line_read.left (64);
- }
- auto const& cs = m_config.my_callsign ().toLocal8Bit ();
- if ("FST4W" == m_mode && ui->cbNoOwnCall->isChecked ()
- && (line_read.contains (" " + cs + " ")
- || line_read.contains ("<" + cs + ">"))) {
- continue;
- }
- }
-
- QString message0 {QString::fromUtf8(line_read.constData())};
- DecodedText decodedtext0 {QString::fromUtf8(line_read.constData())};
- DecodedText decodedtext {QString::fromUtf8(line_read.constData()).remove("TU; ")};
-
- // Don't allow a7 decodes during the first period and for non-contest messages when in any contest mode
- if ((!((no_a7_decodes && line_read.contains("a7") && !m_diskData) or (line_read.contains("a7") && SpecOp::NONE!=m_specOp
- && !m_diskData && !(line_read.contains(" R ") or line_read.contains("RR73") or line_read.contains("CQ ")))))
-
- // Filtering out some false decodes, and don't write all.txt for such
- // FDR step 1
- and (!((SpecOp::NONE==m_specOp or (m_multithreadFT8 && m_ft8DecoderStart<2)) &&
- ((message0.contains("> <") && SpecOp::EU_VHF!=m_specOp) // don't allow two hashes
- || (m_mode=="FT8" && m_multithreadFT8 && m_ft8DecoderStart<2 && earlyDecodes.contains(line_read.mid(23,19))) // MTD dupes
- || message0.contains(QRegularExpression {"(\\w+)/P (\\w+)/P "}) // don't allow two /P calls
- || message0.contains(QRegularExpression {"(\\w+)/R (\\w+)/R "}) // don't allow two /R calls
- || (message0.contains("/R ") && message0.contains("?")) // insecure /R decodes
- || (message0.contains(";") && message0.contains(" R "))))) // don't allow such at all
- // FDR step 2
- and (!(SpecOp::NONE==m_specOp && ui->actionReduce_false_decodes->isChecked() && m_mode=="FT8" &&
- ((((message0.contains("/P ") && message0.contains(" R ")) // /P and R
- || (message0.contains(";") && message0.contains("/R ")) // ; and /R
- || (message0.contains(";") && message0.contains("/P ")) // ; and /P
- || (message0.contains("<...>") && message0.contains(" R ")) // hash and R
- || (message0.contains("<...>") && message0.contains("/P ")) // hash and /P
- || (message0.contains("<...>") && message0.contains(";")) // hash and ;
- || message0.contains(QRegularExpression {"\\w\\w\\w\\w\\w\\w\\w\\w"}) // likely invalid callsigns
- || message0.contains(QRegularExpression {"\\d\\d\\d \\d\\d\\d"}) // contest messages
- || message0.contains("3.") || message0.contains("2.")) // -1.9 < dt < 1.9
- && (decodedtext.snr() < -15)) // for such SNRmin = -15
- or ((message0.contains("/R ") or message0.contains(" R ")) && decodedtext.snr() < -18) // for /R or contest calls SNRmin = -18
- or (((message0.contains("<...>") || message0.contains(";") // unresolved hash and F/H messages
- || message0.contains("? a") // ap decodes of low confidence
- || message0.contains("/R ") || message0.contains(" R ") // rover and contest callsigns
- || decodedtext.snr() < -20) // SNR < -20
- && (message0.contains("3.") || message0.contains("2."))))))) // for such -1.9 < dt < 1.9
- )
- {
- if (m_mode!="FT8" and m_mode!="FT4" and !m_mode.startsWith ("FST4") and m_mode!="Q65") {
- //Pad 22-char msg to at least 37 chars
- line_read = line_read.left(44) + " " + line_read.mid(44);
- }
- bool bAvgMsg=false;
- int navg=0;
-
- if(line_read.indexOf("<DecodeFinished>") >= 0) {
- m_bDecoded = line_read.mid(20).trimmed().toInt() > 0;
- int n=line_read.trimmed().size();
- int n2=line_read.trimmed().mid(n-7).toInt();
- int n0=n2/1000;
- int n1=n2%1000;
- if(m_mode=="Q65") {
- ndecodes_label.setText(QString {"%1 %2"}.arg (n0).arg (n1));
- } else {
- if(m_nDecodes==0 && !(m_multithreadFT8 && m_diskData)) ndecodes_label.setText("0");
- }
- decodeDone ();
- return;
- } else {
- m_nDecodes+=1;
- if(m_mode!="Q65") ndecodes_label.setText(QString::number(m_nDecodes));
- if(m_mode=="JT4" or m_mode=="JT65" or m_mode=="Q65") {
- //### Do something about Q65 here ? ###
- int nf=line_read.indexOf("f");
- if(nf>0) {
- navg=line_read.mid(nf+1,1).toInt();
- if(line_read.indexOf("f*")>0) navg=10;
- }
- int nd=-1;
- if(nf<0) nd=line_read.indexOf("d");
- if(nd>0) {
- navg=line_read.mid(nd+2,1).toInt();
- if(line_read.mid(nd+2,1)=="*") navg=10;
- }
- int na=-1;
- if(nf<0 and nd<0) na=line_read.indexOf("a");
- if(na>0) {
- navg=line_read.mid(na+2,1).toInt();
- if(line_read.mid(na+2,1)=="*") navg=10;
- }
- int nq=-1;
- if(nf<0 and nd<0 and na<0) nq=line_read.indexOf("q");
- if(nq>0) {
- navg=line_read.mid(nq+2,1).toInt();
- if(line_read.mid(nq+2,1)=="*") navg=10;
- }
- if(navg>=2) bAvgMsg=true;
- }
- write_all("Rx", line_read.trimmed());
- } // Filtering out some false decodes, and don't write all.txt for such
-
- if ("FST4W" == m_mode)
- {
- uploadWSPRSpots (true, line_read);
- }
-
- // Check validity of callsigns if "Reduce false decodes" is checked // EXPERIMENTAL FOR NOW
- if (m_mode=="FT8" && !m_multithreadFT8 && ui->actionReduce_false_decodes->isChecked() && decodedtext.snr() < -20) {
- bool notInALLCALL7 = false;
- QString deCall;
- QString deGrid;
- decodedtext.deCallAndGrid(/*out*/deCall,deGrid);
- QStringList word;
- word=decodedtext.string().mid(24).replace("<","").replace(">","").replace("/P","").replace("/R","").replace("/QRP","").replace("/5W","").split(" ",SkipEmptyParts);
-
- // check file ALLCALL7.TXT
- if (deCall!="TNX" && deCall!="73" && deCall!="GL" && deCall!="HNY" && deCall!="TU" && !deCall.left(4).contains("/")
- && !decodedtext.string().contains("<...>") && !ALLCALL7.contains(deCall)) {
- notInALLCALL7 = true;
-// ui->decodedTextBrowser->insertText("deCall not in ALLCALL7.TXT");
- }
- if (!ALLCALL7.contains(word[0]) && !(decodedtext.string().contains(" CQ ") or decodedtext.string().contains("TNX")
- or decodedtext.string().contains("...") or decodedtext.string().contains("HNY") or decodedtext.string().contains("QSY")
- or decodedtext.string().contains("73 ") or decodedtext.string().contains("GL ") or decodedtext.string().contains("PSE")
- or decodedtext.string().contains("/") or decodedtext.string().contains("<...>"))) {
- notInALLCALL7 = true;
-// ui->decodedTextBrowser->insertText("word0 not in ALLCALL7.TXT");
- }
-
- // check syntax of the two callsigns before we hide such messages
- if (notInALLCALL7) {
- deCall=deCall.replace("<","").replace(">","").replace("/P","").replace("/R","").replace("/QRP","").replace("/5W","");
- if (deCall!="TNX" && deCall!="73" && deCall!="GL" && deCall!="HNY" &&
- !(deCall.left(3).contains(QRegularExpression {"\\w\\d\\w"}) or
- deCall.left(3).contains(QRegularExpression {"\\d\\w\\d"}) or
- deCall.left(3).contains(QRegularExpression {"\\w\\w\\d"}) or
- deCall.left(4).contains("/") or decodedtext.string().contains("<...>"))) {
-// ui->decodedTextBrowser->insertText("deCall has false syntax");
- filtered = true;
- }
- if (word[0]!="CQ" && word[0]!="TNX" && word[0]!="73 " && word[0]!="HNY" && word[0]!="QSY" && word[0]!="PSE" &&
- !(word[0].left(3).contains(QRegularExpression {"\\w\\d\\w"}) or
- word[0].left(3).contains(QRegularExpression {"\\d\\w\\d"}) or
- word[0].left(3).contains(QRegularExpression {"\\w\\w\\d"}) or
- decodedtext.string().contains("/")or decodedtext.string().contains("<...>"))) {
-// ui->decodedTextBrowser->insertText("word0 has false syntax");
- filtered = true;
- }
- }
- notInALLCALL7 = false;
- }
-
- if(m_mode=="FT8" and SpecOp::FOX == m_specOp and
- (decodedtext.string().contains("R+") or decodedtext.string().contains("R-"))) {
- auto for_us = decodedtext.string().contains(" " + m_config.my_callsign() + " ") or
- decodedtext.string().contains(" "+m_baseCall) or
- decodedtext.string().contains(m_baseCall+" ") or
- decodedtext.string().contains(" <" + m_config.my_callsign() + "> ");
- if(decodedtext.string().contains(" DE ")) for_us=true; //Hound with compound callsign
- if(for_us) {
- QString houndCall,houndGrid;
- decodedtext.deCallAndGrid(/*out*/houndCall,houndGrid);
- foxRxSequencer(decodedtext.string(),houndCall,houndGrid);
- }
- }
-
-//Left (Band activity) window
- if(!bAvgMsg) {
- if(m_mode=="FT8" and SpecOp::FOX == m_specOp) {
- if(!m_bDisplayedOnce) {
- // This hack sets the font. Surely there's a better way!
- DecodedText dt{"."};
- ui->decodedTextBrowser->displayDecodedText (dt, m_config.my_callsign (), m_mode, m_config.DXCC (),
- m_logBook, m_currentBand, m_config.ppfx ());
- m_bDisplayedOnce=true;
- }
- } else {
-
-#ifdef FOX_OTP
- // remove verifications that are done
- QMutableListIterator < FoxVerifier * > it(m_verifications);
- while (it.hasNext()) {
- if (it.next()->finished()) {
- it.remove();
- }
- }
-#endif
- DecodedText decodedtext1=decodedtext0;
- if ((m_mode=="FT4" or m_mode=="FT8") and bDisplayPoints and decodedtext1.isStandardMessage()) {
- ARRL_Digi_Update(decodedtext1);
- }
-
-#ifdef FOX_OTP
- if ((SpecOp::HOUND == m_specOp) &&
- ((m_config.superFox() && (decodedtext0.mid(24, 8) == "$VERIFY$")) || // $VERIFY$ K8R 920749
- (decodedtext0.mid(24,-1).contains(QRegularExpression{"^[A-Z0-9]{2,6}\\.[0-9]{6}"})))) // K8R.920749
- {
- // two cases:
- // QString test_return = QString{"203630 -12 0.1 775 ~ K8R.920749"};
- // $VERIFY$ foxcall otp
- // QString test_return = QString{"203630 -12 0.1 775 ~ $VERIFY$ K8R 920749"};
- QStringList lineparts;
- QString callsign, otp;
- unsigned int hz;
- lineparts = decodedtext0.string().split(' ', SkipEmptyParts);
- if (lineparts.length() <= 6) {
- QStringList otp_parts;
- // split K8.V920749 into K8R and 920749
- otp_parts = lineparts[5].split('.', SkipEmptyParts);
- callsign = otp_parts[0];
- otp = otp_parts[1];
- hz = lineparts[3].toInt();
- if (!m_config.ShowOTP() or decodedtext0.mid(24,-1).contains(" 000000")) filtered = true;
- } else {
- // split $VERIFY$ K8R 920749 into K8R and 920749
- callsign = lineparts[6];
- otp = lineparts[7];
- hz = 750; // SF is 750
- if (!m_config.ShowOTP() or decodedtext0.mid(24,-1).contains(" 000000")) filtered = true;
- }
- QDateTime verifyDateTime;
- if (m_diskData) {
- verifyDateTime = m_UTCdiskDateTime; // get the date set from reading the wav file
- } else {
- verifyDateTime = QDateTime(QDateTime::currentDateTimeUtc().date(),
- QTime::fromString(lineparts[0], "hhmmss"));
- }
- if (!decodedtext0.mid(24,-1).contains(" 000000")) {
- FoxVerifier *fv = new FoxVerifier(MainWindow::userAgent(),
- &m_network_manager,
- m_config.OTPUrl(),
- callsign, // foxcall
- verifyDateTime,
- otp,
- hz); // freq
- connect(fv, &FoxVerifier::verifyComplete, this, &MainWindow::handleVerifyMsg);
- m_verifications << fv;
- }
- }
-#endif
-
- QString text = decodedtext.string().replace("<","").replace(">",""); // for Wait & Reply/Call and filtering
-
- // FT4 NS (NCCC Sprints): Log QSO after receiving "mycall hiscall R hisgrid"
- if (m_mode=="FT4" && SpecOp::NA_VHF==m_specOp && m_config.NCCC_Sprint() && m_hisCall!="" && m_hisGrid!="" &&
- text.contains(" " + m_config.my_callsign() + " " + m_hisCall + " R " + m_hisGrid.left(4))) {
- if (m_config.prompt_to_log() || m_config.autoLog()) logQSOTimer.start(0);
- QTimer::singleShot (500, [=] {
- on_stopTxButton_clicked();
- });
- }
-
- // Stop Wait & Call timeout when in QSO with this station
- if (ui->DX_Call_Button->isChecked() && m_hisCall!="" && text.contains(" " + m_config.my_callsign() + " " + m_hisCall)) {
- stopWCTimer.stop(); // stop any Wait & Call timeout
- if (ui->DX_Call_Button->isChecked()) ui->DX_Call_Button->click (); // disable Wait & Call
- no_wait_and_call = false; // reset Wait & Call
- }
-
- // Wait & Reply + FT4 NS (NCCC Sprints) reply to incoming RR73 messages
- if ((m_mode=="FT8" or m_mode=="FT4" or m_mode=="Q65" or m_mode=="FST4" or m_mode=="JT65" or m_mode=="JT9" or m_mode=="JT4") && m_hisCall!=""
- && text.contains(" " + m_config.my_callsign() + " " + m_hisCall) && ((!text.contains("73 ")
- && m_config.Wait_features_enabled() && !ui->autoButton->isChecked())
- or (m_mode=="FT4" && SpecOp::NA_VHF==m_specOp && m_config.NCCC_Sprint()))) {
- if (SpecOp::HOUND==m_specOp && (text.mid(4,2).contains("15") or text.mid(4,2).contains("45"))) return; // ignore stations calling in the wrong time slot
- tx_watchdog (false);
- m_bDoubleClicked = true;
- processMessage(decodedtext0);
- auto_tx_mode(true);
- if (m_mode=="FT4" && SpecOp::NA_VHF==m_specOp && m_config.NCCC_Sprint()) {
- if (!no_logging) logQSOTimer.start(0); // logging of stations not in contest mode
- } else {
- if (m_config.Wait_features_enabled()) stopWRTimer.start(int(8000.0*m_TRperiod)); // Wait & Reply Tx max 8*TRperiod
- }
- }
-
- // Wait & Call
- if (wait_and_call && (m_mode=="FT8" or m_mode=="FT4" or m_mode=="Q65" or m_mode=="FST4" or m_mode=="JT65" or m_mode=="JT9" or m_mode=="JT4") &&
- m_specOp!=SpecOp::FOX && ui->cbAutoSeq->isChecked() && m_hisCall!="" && !no_wait_and_call &&
- (text.contains("CQ " + m_hisCall) or text.contains("CQ DX " + m_hisCall) or text.contains(m_hisCall + " RR73")
- or text.contains(m_hisCall + " RRR") or text.contains(m_hisCall + " 73"))
- && m_config.Wait_features_enabled()) {
- if (!text.contains(" " + m_config.my_callsign() + " " + m_hisCall))
- block_right_display = true; // prevent display of first message twice
- m_bDoubleClicked = true;
- processMessage(decodedtext0);
- auto_tx_mode(true);
- no_wait_and_call = true;
- stopWCTimer.start(int(6200.0*m_TRperiod)); // Wait & Call Tx max 8*TRperiod
- }
-
- // Filtering
- QString text2 = "";
- QStringList tw;
- if (m_mode == "FT8" or m_mode == "FT4" or m_mode == "Q65" or m_mode == "FST4") {
- tw=text.mid(24).split(" ",SkipEmptyParts);
- } else {
- tw=text.mid(22).split(" ",SkipEmptyParts);
- }
- if (m_config.filters_for_word2()) {
- if (tw.size () < 2) {
- text2 = "___"; // prevent segfault errors with free text messages
- } else if (tw[1].length() == 2 && tw[1].contains(QRegularExpression{"\\w\\w"})) { // directional calls
- if (tw.size () > 2) {
- text2 = tw[2]; // for directional calls analyze word 3 for filtering
- } else {
- text2 = "___"; // prevent segfault errors with free text messages
- }
- } else {
- if (text.contains(";")) {
- text2 = tw[3]; // analyze word 4 for filtering of combined messages
- } else {
- text2 = tw[1]; // otherwise analyze word 2 for filtering
- }
- }
- if (!(SpecOp::NONE==m_specOp && m_config.AlwaysPass () // Always pass messages with keywords from Always Pass list
- && (
- (text2.startsWith(m_config.Pass1()) && (m_config.Pass1()!=""))
- || (text2.startsWith(m_config.Pass2()) && (m_config.Pass2()!=""))
- || (text2.startsWith(m_config.Pass3()) && (m_config.Pass3()!=""))
- || (text2.startsWith(m_config.Pass4()) && (m_config.Pass4()!=""))
- || (text2.startsWith(m_config.Pass5()) && (m_config.Pass5()!=""))
- || (text2.startsWith(m_config.Pass6()) && (m_config.Pass6()!=""))
- || (text2.startsWith(m_config.Pass7()) && (m_config.Pass7()!=""))
- || (text2.startsWith(m_config.Pass8()) && (m_config.Pass8()!=""))
- || (text2.startsWith(m_config.Pass9()) && (m_config.Pass9()!=""))
- || (text2.startsWith(m_config.Pass10()) && (m_config.Pass10()!=""))
- || (text2.startsWith(m_config.Pass11()) && (m_config.Pass11()!=""))
- || (text2.startsWith(m_config.Pass12()) && (m_config.Pass12()!=""))
- ))) {
-
- // Filtering out messages with keywords from Blacklist
- if ((SpecOp::NONE==m_specOp or SpecOp::HOUND==m_specOp) && m_config.Blacklisted ()
- && (
- (text2.startsWith(m_config.Blacklist1()) && (m_config.Blacklist1()!=""))
- || (text2.startsWith(m_config.Blacklist2()) && (m_config.Blacklist2()!=""))
- || (text2.startsWith(m_config.Blacklist3()) && (m_config.Blacklist3()!=""))
- || (text2.startsWith(m_config.Blacklist4()) && (m_config.Blacklist4()!=""))
- || (text2.startsWith(m_config.Blacklist5()) && (m_config.Blacklist5()!=""))
- || (text2.startsWith(m_config.Blacklist6()) && (m_config.Blacklist6()!=""))
- || (text2.startsWith(m_config.Blacklist7()) && (m_config.Blacklist7()!=""))
- || (text2.startsWith(m_config.Blacklist8()) && (m_config.Blacklist8()!=""))
- || (text2.startsWith(m_config.Blacklist9()) && (m_config.Blacklist9()!=""))
- || (text2.startsWith(m_config.Blacklist10()) && (m_config.Blacklist10()!=""))
- || (text2.startsWith(m_config.Blacklist11()) && (m_config.Blacklist11()!=""))
- || (text2.startsWith(m_config.Blacklist12()) && (m_config.Blacklist12()!=""))
- )) {
- if (!ui->cbBypass->isChecked()) filtered = true;
- if (!(m_config.filters_for_Wait_and_Pounce_only() or ui->cbBypass->isChecked())) return;
- // reset dB score when filtered
- if (pounce && (ui->respondComboBox->currentText()=="CQ: Max Dist"
- or ui->respondComboBox->currentText()=="CQ: Max dB"
- or ui->respondComboBox->currentText()=="CQ: Min dB")) {
- Dpoints=0;
- maxDPoints=0;
- dBpoints=-28;
- dBpoints2=99;
- maxdBPoints=-28;
- mindBPoints=99;
- }
-
- // Filtering out everything but messages with keywords from Whitelist
- } else if ((SpecOp::NONE==m_specOp or SpecOp::HOUND==m_specOp) && m_config.Whitelisted ()
- && !(text2.startsWith(m_config.Whitelist1()) && (m_config.Whitelist1()!=""))
- && !(text2.startsWith(m_config.Whitelist2()) && (m_config.Whitelist2()!=""))
- && !(text2.startsWith(m_config.Whitelist3()) && (m_config.Whitelist3()!=""))
- && !(text2.startsWith(m_config.Whitelist4()) && (m_config.Whitelist4()!=""))
- && !(text2.startsWith(m_config.Whitelist5()) && (m_config.Whitelist5()!=""))
- && !(text2.startsWith(m_config.Whitelist6()) && (m_config.Whitelist6()!=""))
- && !(text2.startsWith(m_config.Whitelist7()) && (m_config.Whitelist7()!=""))
- && !(text2.startsWith(m_config.Whitelist8()) && (m_config.Whitelist8()!=""))
- && !(text2.startsWith(m_config.Whitelist9()) && (m_config.Whitelist9()!=""))
- && !(text2.startsWith(m_config.Whitelist10()) && (m_config.Whitelist10()!=""))
- && !(text2.startsWith(m_config.Whitelist11()) && (m_config.Whitelist11()!=""))
- && !(text2.startsWith(m_config.Whitelist12()) && (m_config.Whitelist12()!=""))
- ) {
- if (!ui->cbBypass->isChecked()) filtered = true;
- if (!(m_config.filters_for_Wait_and_Pounce_only() or ui->cbBypass->isChecked())) return;
- // reset dB score when filtered
- if (pounce && (ui->respondComboBox->currentText()=="CQ: Max Dist"
- or ui->respondComboBox->currentText()=="CQ: Max dB"
- or ui->respondComboBox->currentText()=="CQ: Min dB")) {
- Dpoints=0;
- maxDPoints=0;
- dBpoints=-28;
- dBpoints2=99;
- maxdBPoints=-28;
- mindBPoints=99;
- }
- }
-
- // search logbook for filtering
- if (ui->actionHideTerritory1->isChecked() or ui->actionHideTerritory2->isChecked() or
- ui->actionHideTerritory3->isChecked() or ui->actionHideTerritory4->isChecked() or
- ui->actionHideB4->isChecked() or ui->actionHideEU->isChecked() or ui->actionHideAS->isChecked() or
- ui->actionHideNA->isChecked() or ui->actionHideSA->isChecked() or ui->actionHideAF->isChecked() or
- ui->actionHideOC->isChecked() or ui->actionHideAN->isChecked()) {
- QString deCall;
- QString deGrid;
- decodedtext.deCallAndGrid(/*out*/deCall,deGrid);
- // search for country names
- if (ui->actionHideTerritory1->isChecked() or ui->actionHideTerritory2->isChecked() or
- ui->actionHideTerritory3->isChecked() or ui->actionHideTerritory4->isChecked()) {
- auto const& looked_up = m_logBook.countries ()->lookup (deCall);
- auto countryName = looked_up.entity_name;
- // do some obvious abbreviations
- countryName.replace ("Islands", "Is.");
- countryName.replace ("Island", "Is.");
- countryName.replace ("North ", "N. ");
- countryName.replace ("Northern ", "N. ");
- countryName.replace ("South ", "S. ");
- countryName.replace ("East ", "E. ");
- countryName.replace ("Eastern ", "E. ");
- countryName.replace ("West ", "W. ");
- countryName.replace ("Western ", "W. ");
- countryName.replace ("Central ", "C. ");
- countryName.replace (" and ", " & ");
- countryName.replace ("Republic", "Rep.");
- countryName.replace ("United States of America", "U.S.A.");
- countryName.replace ("United States", "U.S.A.");
- countryName.replace ("Fed. Rep. of ", "");
- countryName.replace ("French ", "Fr.");
- countryName.replace ("Asiatic", "AS");
- countryName.replace ("European", "EU");
- countryName.replace ("African", "AF");
- if (ui->actionHideTerritory1->isChecked() && countryName.contains(m_config.Territory1())
- && (m_config.Territory1()!="") && !ui->cbBypass->isChecked()) filtered = true;
- if (ui->actionHideTerritory2->isChecked() && countryName.contains(m_config.Territory2())
- && (m_config.Territory2()!="") && !ui->cbBypass->isChecked()) filtered = true;
- if (ui->actionHideTerritory3->isChecked() && countryName.contains(m_config.Territory3())
- && (m_config.Territory3()!="") && !ui->cbBypass->isChecked()) filtered = true;
- if (ui->actionHideTerritory4->isChecked() && countryName.contains(m_config.Territory4())
- && (m_config.Territory4()!="") && !ui->cbBypass->isChecked()) filtered = true;
- }
- // search for callsigns worked B4 on band
- if (ui->actionHideB4->isChecked()) {
- bool callB4onBand;
- bool countryB4onBand;
- bool gridB4onBand;
- bool continentB4onBand;
- bool CQZoneB4onBand;
- bool ITUZoneB4onBand;
- auto const& looked_up = m_logBook.countries ()->lookup (deCall);
- m_logBook.match (deCall, m_mode, deGrid, looked_up, callB4onBand, countryB4onBand, gridB4onBand,
- continentB4onBand, CQZoneB4onBand, ITUZoneB4onBand, m_currentBand);
- if (callB4onBand && ui->actionHideB4->isChecked() && !ui->cbBypass->isChecked()) filtered = true;
- }
- // search for continents
- if (ui->actionHideEU->isChecked() or ui->actionHideAS->isChecked() or ui->actionHideNA->isChecked()
- or ui->actionHideSA->isChecked() or ui->actionHideAF->isChecked() or ui->actionHideOC->isChecked()
- or ui->actionHideAN->isChecked()) {
- auto const& looked_up = m_logBook.countries ()->lookup (deCall);
- QString continent = AD1CCty::continent (looked_up.continent);
- if (ui->actionHideEU->isChecked() && continent == "EU" && !ui->cbBypass->isChecked()) filtered = true;
- if (ui->actionHideAS->isChecked() && continent == "AS" && !ui->cbBypass->isChecked()) filtered = true;
- if (ui->actionHideNA->isChecked() && continent == "NA" && !ui->cbBypass->isChecked()) filtered = true;
- if (ui->actionHideSA->isChecked() && continent == "SA" && !ui->cbBypass->isChecked()) filtered = true;
- if (ui->actionHideAF->isChecked() && continent == "AF" && !ui->cbBypass->isChecked()) filtered = true;
- if (ui->actionHideOC->isChecked() && continent == "OC" && !ui->cbBypass->isChecked()) filtered = true;
- if (ui->actionHideAN->isChecked() && continent == "AN" && !ui->cbBypass->isChecked()) filtered = true;
- }
- }
- }
- } else {
- if (!(SpecOp::NONE==m_specOp && m_config.AlwaysPass () // Always pass messages with keywords from Always Pass list
- && (
- (text.contains(m_config.Pass1()) && (m_config.Pass1()!=""))
- || (text.contains(m_config.Pass2()) && (m_config.Pass2()!=""))
- || (text.contains(m_config.Pass3()) && (m_config.Pass3()!=""))
- || (text.contains(m_config.Pass4()) && (m_config.Pass4()!=""))
- || (text.contains(m_config.Pass5()) && (m_config.Pass5()!=""))
- || (text.contains(m_config.Pass6()) && (m_config.Pass6()!=""))
- || (text.contains(m_config.Pass7()) && (m_config.Pass7()!=""))
- || (text.contains(m_config.Pass8()) && (m_config.Pass8()!=""))
- || (text.contains(m_config.Pass9()) && (m_config.Pass9()!=""))
- || (text.contains(m_config.Pass10()) && (m_config.Pass10()!=""))
- || (text.contains(m_config.Pass11()) && (m_config.Pass11()!=""))
- || (text.contains(m_config.Pass12()) && (m_config.Pass12()!=""))
- ))) {
-
- // Filtering out messages with keywords from Blacklist
- if ((SpecOp::NONE==m_specOp or SpecOp::HOUND==m_specOp) && m_config.Blacklisted ()
- && (
- (text.contains(m_config.Blacklist1()) && (m_config.Blacklist1()!=""))
- || (text.contains(m_config.Blacklist2()) && (m_config.Blacklist2()!=""))
- || (text.contains(m_config.Blacklist3()) && (m_config.Blacklist3()!=""))
- || (text.contains(m_config.Blacklist4()) && (m_config.Blacklist4()!=""))
- || (text.contains(m_config.Blacklist5()) && (m_config.Blacklist5()!=""))
- || (text.contains(m_config.Blacklist6()) && (m_config.Blacklist6()!=""))
- || (text.contains(m_config.Blacklist7()) && (m_config.Blacklist7()!=""))
- || (text.contains(m_config.Blacklist8()) && (m_config.Blacklist8()!=""))
- || (text.contains(m_config.Blacklist9()) && (m_config.Blacklist9()!=""))
- || (text.contains(m_config.Blacklist10()) && (m_config.Blacklist10()!=""))
- || (text.contains(m_config.Blacklist11()) && (m_config.Blacklist11()!=""))
- || (text.contains(m_config.Blacklist12()) && (m_config.Blacklist12()!=""))
- )) {
- if (!ui->cbBypass->isChecked()) filtered = true;
- if (!(m_config.filters_for_Wait_and_Pounce_only() or ui->cbBypass->isChecked())) return;
- // reset dB score when filtered
- if (pounce && (ui->respondComboBox->currentText()=="CQ: Max Dist"
- or ui->respondComboBox->currentText()=="CQ: Max dB"
- or ui->respondComboBox->currentText()=="CQ: Min dB")) {
- Dpoints=0;
- maxDPoints=0;
- dBpoints=-28;
- dBpoints2=99;
- maxdBPoints=-28;
- mindBPoints=99;
- }
-
- // Filtering out everything but messages with keywords from Whitelist
- } else if ((SpecOp::NONE==m_specOp or SpecOp::HOUND==m_specOp) && m_config.Whitelisted ()
- && !(text.contains(m_config.Whitelist1()) && (m_config.Whitelist1()!=""))
- && !(text.contains(m_config.Whitelist2()) && (m_config.Whitelist2()!=""))
- && !(text.contains(m_config.Whitelist3()) && (m_config.Whitelist3()!=""))
- && !(text.contains(m_config.Whitelist4()) && (m_config.Whitelist4()!=""))
- && !(text.contains(m_config.Whitelist5()) && (m_config.Whitelist5()!=""))
- && !(text.contains(m_config.Whitelist6()) && (m_config.Whitelist6()!=""))
- && !(text.contains(m_config.Whitelist7()) && (m_config.Whitelist7()!=""))
- && !(text.contains(m_config.Whitelist8()) && (m_config.Whitelist8()!=""))
- && !(text.contains(m_config.Whitelist9()) && (m_config.Whitelist9()!=""))
- && !(text.contains(m_config.Whitelist10()) && (m_config.Whitelist10()!=""))
- && !(text.contains(m_config.Whitelist11()) && (m_config.Whitelist11()!=""))
- && !(text.contains(m_config.Whitelist12()) && (m_config.Whitelist12()!=""))
- ) {
- if (!ui->cbBypass->isChecked()) filtered = true;
- if (!(m_config.filters_for_Wait_and_Pounce_only() or ui->cbBypass->isChecked())) return;
- // reset dB score when filtered
- if (pounce && (ui->respondComboBox->currentText()=="CQ: Max Dist"
- or ui->respondComboBox->currentText()=="CQ: Max dB"
- or ui->respondComboBox->currentText()=="CQ: Min dB")) {
- Dpoints=0;
- maxDPoints=0;
- dBpoints=-28;
- dBpoints2=99;
- maxdBPoints=-28;
- mindBPoints=99;
- }
- }
-
- // search logbook for filtering
- if (ui->actionHideTerritory1->isChecked() or ui->actionHideTerritory2->isChecked() or
- ui->actionHideTerritory3->isChecked() or ui->actionHideTerritory4->isChecked() or
- ui->actionHideB4->isChecked() or ui->actionHideEU->isChecked() or ui->actionHideAS->isChecked() or
- ui->actionHideNA->isChecked() or ui->actionHideSA->isChecked() or ui->actionHideAF->isChecked() or
- ui->actionHideOC->isChecked() or ui->actionHideAN->isChecked()) {
- QString deCall;
- QString deGrid;
- decodedtext.deCallAndGrid(/*out*/deCall,deGrid);
- // search for country names
- if (ui->actionHideTerritory1->isChecked() or ui->actionHideTerritory2->isChecked() or
- ui->actionHideTerritory3->isChecked() or ui->actionHideTerritory4->isChecked()) {
- auto const& looked_up = m_logBook.countries ()->lookup (deCall);
- auto countryName = looked_up.entity_name;
- // do some obvious abbreviations
- countryName.replace ("Islands", "Is.");
- countryName.replace ("Island", "Is.");
- countryName.replace ("North ", "N. ");
- countryName.replace ("Northern ", "N. ");
- countryName.replace ("South ", "S. ");
- countryName.replace ("East ", "E. ");
- countryName.replace ("Eastern ", "E. ");
- countryName.replace ("West ", "W. ");
- countryName.replace ("Western ", "W. ");
- countryName.replace ("Central ", "C. ");
- countryName.replace (" and ", " & ");
- countryName.replace ("Republic", "Rep.");
- countryName.replace ("United States of America", "U.S.A.");
- countryName.replace ("United States", "U.S.A.");
- countryName.replace ("Fed. Rep. of ", "");
- countryName.replace ("French ", "Fr.");
- countryName.replace ("Asiatic", "AS");
- countryName.replace ("European", "EU");
- countryName.replace ("African", "AF");
- if (ui->actionHideTerritory1->isChecked() && countryName.contains(m_config.Territory1())
- && (m_config.Territory1()!="") && !ui->cbBypass->isChecked()) filtered = true;
- if (ui->actionHideTerritory2->isChecked() && countryName.contains(m_config.Territory2())
- && (m_config.Territory2()!="") && !ui->cbBypass->isChecked()) filtered = true;
- if (ui->actionHideTerritory3->isChecked() && countryName.contains(m_config.Territory3())
- && (m_config.Territory3()!="") && !ui->cbBypass->isChecked()) filtered = true;
- if (ui->actionHideTerritory4->isChecked() && countryName.contains(m_config.Territory4())
- && (m_config.Territory4()!="") && !ui->cbBypass->isChecked()) filtered = true;
- }
- // search for callsigns worked B4 on band
- if (ui->actionHideB4->isChecked()) {
- bool callB4onBand;
- bool countryB4onBand;
- bool gridB4onBand;
- bool continentB4onBand;
- bool CQZoneB4onBand;
- bool ITUZoneB4onBand;
- auto const& looked_up = m_logBook.countries ()->lookup (deCall);
- m_logBook.match (deCall, m_mode, deGrid, looked_up, callB4onBand, countryB4onBand, gridB4onBand,
- continentB4onBand, CQZoneB4onBand, ITUZoneB4onBand, m_currentBand);
- if (callB4onBand && ui->actionHideB4->isChecked() && !ui->cbBypass->isChecked()) filtered = true;
- }
- // search for continents
- if (ui->actionHideEU->isChecked() or ui->actionHideAS->isChecked() or ui->actionHideNA->isChecked()
- or ui->actionHideSA->isChecked() or ui->actionHideAF->isChecked() or ui->actionHideOC->isChecked()
- or ui->actionHideAN->isChecked()) {
- auto const& looked_up = m_logBook.countries ()->lookup (deCall);
- QString continent = AD1CCty::continent (looked_up.continent);
- if (ui->actionHideEU->isChecked() && continent == "EU" && !ui->cbBypass->isChecked()) filtered = true;
- if (ui->actionHideAS->isChecked() && continent == "AS" && !ui->cbBypass->isChecked()) filtered = true;
- if (ui->actionHideNA->isChecked() && continent == "NA" && !ui->cbBypass->isChecked()) filtered = true;
- if (ui->actionHideSA->isChecked() && continent == "SA" && !ui->cbBypass->isChecked()) filtered = true;
- if (ui->actionHideAF->isChecked() && continent == "AF" && !ui->cbBypass->isChecked()) filtered = true;
- if (ui->actionHideOC->isChecked() && continent == "OC" && !ui->cbBypass->isChecked()) filtered = true;
- if (ui->actionHideAN->isChecked() && continent == "AN" && !ui->cbBypass->isChecked()) filtered = true;
- }
- }
- }
- }
-
- // mute audible alerts when callsign is on the Ignored List
- if (m_config.alert_Enabled() && !ui->cbBypass->isChecked()) {
- QString deCall;
- QString deGrid;
- decodedtext.deCallAndGrid(deCall,deGrid);
- if (deCall!="" && ignoreList.contains(deCall + ",")) m_muted = true;
- }
-
- // hide or ignore callsigns
- if (ui->actionHideIgnored->isChecked() or ui->actionHideToday->isChecked() or ui->actionIgnoreIgnored->isChecked() or ui->actionIgnoreToday->isChecked()) {
- QString today = QDateTime::currentDateTimeUtc().toString ("yyyy-MM-dd");
- QString yesterday = QDateTime::currentDateTimeUtc().addDays(-1).toString ("yyyy-MM-dd");
- QString deCall;
- QString deGrid;
- decodedtext.deCallAndGrid(/*out*/deCall,deGrid);
- if (ui->actionHideIgnored->isChecked() && !ui->cbBypass->isChecked() && ignoreList.contains(deCall + ",")) filtered = true;
- if (ui->actionHideToday->isChecked() && !ui->cbBypass->isChecked() && (
- txLog.contains(QRegularExpression{today + ",[0-9][0-9]:[0-9][0-9]:[0-9][0-9]," + (deCall + ",")})
- or (m_config.twoDays() && txLog.contains(QRegularExpression{yesterday + ",[0-9][0-9]:[0-9][0-9]:[0-9][0-9]," + (deCall + ",")})))) {
- filtered = true;
- }
- if (ui->actionIgnoreIgnored->isChecked() && ignoreList.contains(deCall + ",")) {
- ignored = true;
- m_muted = true;
- }
- if (ui->actionIgnoreToday->isChecked() && (txLog.contains(QRegularExpression{today + ",[0-9][0-9]:[0-9][0-9]:[0-9][0-9]," + (deCall + ",")})
- or (m_config.twoDays() && txLog.contains(QRegularExpression{yesterday + ",[0-9][0-9]:[0-9][0-9]:[0-9][0-9]," + (deCall + ",")})))) {
- ignored = true;
- m_muted = true;
- }
- }
- if (ui->actionIgnoreB4->isChecked() && (pounce or m_auto)) {
- QString deCall;
- QString deGrid;
- decodedtext.deCallAndGrid(/*out*/deCall,deGrid);
- bool callB4onBand;
- bool countryB4onBand;
- bool gridB4onBand;
- bool continentB4onBand;
- bool CQZoneB4onBand;
- bool ITUZoneB4onBand;
- auto const& looked_up = m_logBook.countries ()->lookup (deCall);
- m_logBook.match (deCall, m_mode, deGrid, looked_up, callB4onBand, countryB4onBand, gridB4onBand,
- continentB4onBand, CQZoneB4onBand, ITUZoneB4onBand, m_currentBand);
- if (callB4onBand && ui->actionIgnoreB4->isChecked() && !ui->cbBypass->isChecked()) {
- ignored = true;
- m_muted = true;
- }
- }
-
- // insert blank line, but only if not filtered and no decodes
- int ntime=6;
- if (m_TRperiod>=60) ntime=4;
- if ((m_config.insert_blank () or m_config.alert_Enabled()) && (line_read.left(ntime) != m_tBlankLine) && message0.left(4).contains(QRegularExpression {"\\d\\d\\d\\d"}) && !m_diskData) {
- ui->decodedTextBrowser->new_period ();
- if (m_specOp == SpecOp::FOX and m_ActiveStationsWidget != NULL && m_config.insert_blank ()) { // clear the ActiveStations window
- m_ActiveStationsWidget->clearStations();
- m_ActiveStationsWidget->displayRecentStations("Fox Mode", "");
- }
- if (SpecOp::FOX != m_specOp && (!filtered or m_config.filters_for_Wait_and_Pounce_only()) && m_config.insert_blank ()) {
- QString band;
- if(((QDateTime::currentMSecsSinceEpoch() / 1000 - m_secBandChanged) > 4*int(m_TRperiod)/4) or m_displayBand) {
- band = ' ' + m_config.bands ()->find (m_freqNominal);
- }
- if (m_config.insert_blank ()) {
- if (ui->actionUse_Dark_Style->isChecked()) {
- if (m_config.detailed_blank()) {
- if (m_config.DXCC()) {
- ui->decodedTextBrowser->insertText(("------ " + m_dateTimeSeqStart.toString("yyyy-MM-dd - hh:mm:ss' UTC - '") + m_currentBandPeriod + " - " + m_mode + " ------"), "#a2a2a2", "#000000");
- } else {
- ui->decodedTextBrowser->insertText(("------ " + m_dateTimeSeqStart.toString("yyyy-MM-dd - hh:mm:ss' UTC - '") + m_currentBandPeriod + " - " + m_mode), "#a2a2a2", "#000000");
- }
- } else {
- ui->decodedTextBrowser->insertText(band.rightJustified(40, '-'), "#a2a2a2", "#000000");
- }
- } else {
- if (m_config.detailed_blank()) {
- if (m_config.DXCC()) {
- ui->decodedTextBrowser->insertLineSpacer ("------ " + m_dateTimeSeqStart.toString("yyyy-MM-dd - hh:mm:ss' UTC - '") + m_currentBandPeriod + " - " + m_mode + " ------");
- } else {
- ui->decodedTextBrowser->insertLineSpacer ("------ " + m_dateTimeSeqStart.toString("yyyy-MM-dd - hh:mm:ss' UTC - '") + m_currentBandPeriod + " - " + m_mode);
- }
- } else {
- ui->decodedTextBrowser->insertLineSpacer (band.rightJustified (40, '-'));
- }
- }
- }
- m_tBlankLine = line_read.left(ntime);
- }
- }
-
- // SuperHound label
- if (ui->labDXped->text().contains("Hound") && decodedtext0.mid(3,18).contains(" verified")) {
- verified = true;
- write_all("Vf",decodedtext0.string());
- ui->labDXped->setStyleSheet("QLabel {background-color: #00ff00; color: black;}");
- } else {
-#ifndef FOX_OTP
- if (m_specOp==SpecOp::HOUND && m_config.superFox() && (decodedtext0.mid(4,2).contains("00") or decodedtext0.mid(4,2).contains("30"))) verified = false;
-#endif
- }
- if ((!verified && ui->labDXped->isVisible()) or !ui->labDXped->text().contains("Hound"))
- ui->labDXped->setStyleSheet("QLabel {background-color: red; color: white;}");
-
- // show distance and bearing
- if (!filtered or m_config.filters_for_Wait_and_Pounce_only()) { // show decodes if not filtered
- QString distance;
- QString deCall;
- QString deGrid;
- decodedtext.deCallAndGrid(deCall,deGrid);
- if ((m_config.showDistance() || m_config.showAzimuth()) && deGrid.contains(grid_regexp)) {
- double utch=0.0;
- int nAz,nEl,nDmiles,nDkm,nHotAz,nHotABetter;
- QString my_Grid = m_config.my_grid();
- if (my_Grid.length() < 5) my_Grid = m_config.my_grid().left(4)+"mm";
- QString de_Grid= deGrid.left(4)+"mm";
- azdist_(const_cast <char *> (my_Grid.toLatin1().constData()),
- const_cast <char *> (de_Grid.toLatin1().constData()),&utch,
- &nAz,&nEl,&nDmiles,&nDkm,&nHotAz,&nHotABetter,(FCL)6,(FCL)6);
- if (m_config.showDistance()) {
- int nd=nDkm;
- if(m_config.miles()) nd=nDmiles;
- distance = QString::number(nd);
- if(m_config.miles()) distance += " mi";
- if(!m_config.miles()) distance += " km";
- }
- if (m_config.showAzimuth()) {
- if (distance.length()) distance += " / ";
- distance += QString::number(nAz) + "°";
- }
- }
-
- // display country names for JT65 and JT9 like for FT8
- if ((m_mode == "JT65" or m_mode == "JT9" or m_mode == "JT4") && m_config.DXCC()) {
- DecodedText decodedtextJT {((QString::fromUtf8(line_read.left(44).constData())) + (QString::fromUtf8(line_read.mid(62, 2).constData())))};
- ui->decodedTextBrowser->displayDecodedText (decodedtextJT, m_config.my_callsign (), m_mode, m_config.DXCC (),
- m_logBook, m_currentBandPeriod, m_config.ppfx (),
- ui->cbCQonly->isVisible() && ui->cbCQonly->isChecked(),
- haveFSpread, fSpread, bDisplayPoints, m_points, distance, m_muted);
- } else {
- ui->decodedTextBrowser->displayDecodedText (decodedtext1, m_config.my_callsign (), m_mode, m_config.DXCC (),
- m_logBook, m_currentBandPeriod, m_config.ppfx (),
- ui->cbCQonly->isVisible() && ui->cbCQonly->isChecked(),
- haveFSpread, fSpread, bDisplayPoints, m_points, distance, m_muted);
- }
- if(m_position != 0) ui->decodedTextBrowser->horizontalScrollBar()->setValue(m_position);
- if (m_mode=="FT8" && m_multithreadFT8 && m_ft8DecoderStart<2) earlyDecodes.append(line_read); //ft8md
- }
-
- // highlight callsigns worked B4 on band or worked today
- if(ui->actionHighlightB4->isChecked() or ui->actionHighlightToday->isChecked() or ui->actionHighlightIgnored->isChecked()
- or ui->actionHighlightTerritory1->isChecked() or ui->actionHighlightTerritory2->isChecked()
- or ui->actionHighlightTerritory3->isChecked() or ui->actionHighlightTerritory4->isChecked()) {
- QString today = QDateTime::currentDateTimeUtc().toString ("yyyy-MM-dd");
- QString yesterday = QDateTime::currentDateTimeUtc().addDays(-1).toString ("yyyy-MM-dd");
- QString deCall;
- QString deGrid;
- decodedtext.deCallAndGrid(/*out*/deCall,deGrid);
- bool callB4onBand;
- bool countryB4onBand;
- bool gridB4onBand;
- bool continentB4onBand;
- bool CQZoneB4onBand;
- bool ITUZoneB4onBand;
- if (ui->actionHighlightB4->isChecked()) {
- auto const& looked_up = m_logBook.countries ()->lookup (deCall);
- m_logBook.match (deCall, m_mode, deGrid, looked_up, callB4onBand, countryB4onBand, gridB4onBand,
- continentB4onBand, CQZoneB4onBand, ITUZoneB4onBand, m_currentBand);
- if (callB4onBand) ui->decodedTextBrowser->highlight_callsign(deCall, QColor(195,195,195), QColor(0,0,0), true);
- }
- if (ui->actionHighlightToday->isChecked() && (
- txLog.contains(QRegularExpression{today + ",[0-9][0-9]:[0-9][0-9]:[0-9][0-9]," + (deCall + ",")})
- or (m_config.twoDays() && txLog.contains(QRegularExpression{yesterday + ",[0-9][0-9]:[0-9][0-9]:[0-9][0-9]," + (deCall + ",")})))) {
- ui->decodedTextBrowser->highlight_callsign(deCall, QColor(100,100,100), QColor(255,255,0), true);
- }
- if (ui->actionHighlightIgnored->isChecked() && ignoreList.contains(deCall + ",")) {
- ui->decodedTextBrowser->highlight_callsign(deCall, QColor(85,0,0), QColor(255,255,0), true);
- }
- // search for country names
- if (ui->actionHighlightTerritory1->isChecked() or ui->actionHighlightTerritory2->isChecked() or
- ui->actionHighlightTerritory3->isChecked() or ui->actionHighlightTerritory4->isChecked()) {
- auto const& looked_up = m_logBook.countries ()->lookup (deCall);
- auto countryName = looked_up.entity_name;
- // do some obvious abbreviations
- countryName.replace ("Islands", "Is.");
- countryName.replace ("Island", "Is.");
- countryName.replace ("North ", "N. ");
- countryName.replace ("Northern ", "N. ");
- countryName.replace ("South ", "S. ");
- countryName.replace ("East ", "E. ");
- countryName.replace ("Eastern ", "E. ");
- countryName.replace ("West ", "W. ");
- countryName.replace ("Western ", "W. ");
- countryName.replace ("Central ", "C. ");
- countryName.replace (" and ", " & ");
- countryName.replace ("Republic", "Rep.");
- countryName.replace ("United States of America", "U.S.A.");
- countryName.replace ("United States", "U.S.A.");
- countryName.replace ("Fed. Rep. of ", "");
- countryName.replace ("French ", "Fr.");
- countryName.replace ("Asiatic", "AS");
- countryName.replace ("European", "EU");
- countryName.replace ("African", "AF");
- if (ui->actionHighlightTerritory1->isChecked() && countryName.contains(m_config.Territory1())
- && (m_config.Territory1()!="") && !ui->cbBypass->isChecked()) ui->decodedTextBrowser->highlight_callsign(deCall, QColor(115,43,245), QColor(255,255,255), true);
- if (ui->actionHighlightTerritory2->isChecked() && countryName.contains(m_config.Territory2())
- && (m_config.Territory2()!="") && !ui->cbBypass->isChecked()) ui->decodedTextBrowser->highlight_callsign(deCall, QColor(115,43,245), QColor(255,255,255), true);
- if (ui->actionHighlightTerritory3->isChecked() && countryName.contains(m_config.Territory3())
- && (m_config.Territory3()!="") && !ui->cbBypass->isChecked()) ui->decodedTextBrowser->highlight_callsign(deCall, QColor(115,43,245), QColor(255,255,255), true);
- if (ui->actionHighlightTerritory4->isChecked() && countryName.contains(m_config.Territory4())
- && (m_config.Territory4()!="") && !ui->cbBypass->isChecked()) ui->decodedTextBrowser->highlight_callsign(deCall, QColor(115,43,245), QColor(255,255,255), true);
- }
- }
-
- if((m_mode=="FT4" or m_mode=="FT8") and bDisplayPoints and decodedtext1.isStandardMessage()) {
- QString deCall,deGrid;
- decodedtext.deCallAndGrid(/*out*/deCall,deGrid);
- bool bWorkedOnBand=(ui->decodedTextBrowser->CQPriority()!="New Call on Band") and ui->decodedTextBrowser->CQPriority()!="";
- if(bWorkedOnBand) activeWorked(deCall,m_currentBand);
- }
-
- // CQ: First
- if(((pounce && text.contains(" CQ ") && m_config.Wait_features_enabled())
- or (m_auto && m_bCallingCQ && text.contains(" " + m_config.my_callsign() + " "))) && !ignored
- && !filtered && !selected && ui->respondComboBox->isVisible() && ui->respondComboBox->currentText()=="CQ: First"
- && (!(ui->actionFull_Duplex_Mode->isChecked() && m_txing))) {
- m_bDoubleClicked=true;
- selected = true;
- auto_tx_mode(true);
- processMessage(decodedtext0);
- auto now = QDateTime::currentDateTimeUtc();
- m_dateTimeQSOOn = now.addSecs (-(m_ntx - 1) * int(m_TRperiod) - int(fmod(double(now.time().second()),m_TRperiod)));
- QTimer::singleShot (6000, [=] {selected = false;});
- if (pounce) stopWCTimer.start(int(6200.0*m_TRperiod)); // Tx max 6*TRperiod
- }
-
- // CQ: Max Dist
- if((pounce or m_auto) && ui->respondComboBox->isVisible() && ui->respondComboBox->currentText()=="CQ: Max Dist"
- && (!(ui->actionFull_Duplex_Mode->isChecked() && m_txing))) {
- QString deCall;
- QString deGrid;
- decodedtext.deCallAndGrid(/*out*/deCall,deGrid);
- if (!filtered && !ignored && (deGrid.contains(grid_regexp) or m_bCallingCQ) && (
- (pounce && text.contains(" CQ ") && !txLog.contains(deCall) && m_config.Wait_features_enabled()) or
- (m_bCallingCQ && text.contains(" " + m_config.my_callsign() + " ") && !text.contains("73 "))
- )) {
- double utch=0.0;
- int nAz,nEl,nDmiles,nDkm,nHotAz,nHotABetter;
- azdist_(const_cast <char *> ((m_config.my_grid () + " ").left (6).toLatin1().constData()),
- const_cast <char *> ((deGrid + " ").left (6).toLatin1().constData()),&utch,
- &nAz,&nEl,&nDmiles,&nDkm,&nHotAz,&nHotABetter,6,6);
- Dpoints=nDkm;
- if (!deGrid.contains(grid_regexp)) Dpoints=1;
- if(Dpoints>maxDPoints) {
- maxDPoints=Dpoints;
- m_deCall=deCall;
- m_bDoubleClicked=true;
- if ((pounce && text.contains(" CQ ") && m_config.Wait_features_enabled()) or m_auto) {
- auto_tx_mode(true);
- processMessage(decodedtext0);
- if (pounce) stopWCTimer.start(int(6200.0*m_TRperiod)); // Tx max 6*TRperiod
- }
- ui->dxCallEntry->setText(deCall);
- genStdMsgs(QString::number(decodedtext.snr()));
- ui->RxFreqSpinBox->setValue(decodedtext.frequencyOffset());
- setTxMsg(m_ntx);
- m_currentMessageType=m_ntx;
- auto now = QDateTime::currentDateTimeUtc();
- m_dateTimeQSOOn = now.addSecs (-(m_ntx - 1) * int(m_TRperiod) - int(fmod(double(now.time().second()),m_TRperiod)));
- }
- }
- }
-
- // CQ: Max dB
- if((pounce or m_auto) && ui->respondComboBox->isVisible() && ui->respondComboBox->currentText()=="CQ: Max dB"
- && (!(ui->actionFull_Duplex_Mode->isChecked() && m_txing))) {
- QString deCall;
- QString deGrid;
- decodedtext.deCallAndGrid(/*out*/deCall,deGrid);
- if (!filtered && !ignored && (
- (pounce && text.contains(" CQ ") && !txLog.contains(deCall) && m_config.Wait_features_enabled()) or
- (m_bCallingCQ && text.contains(" " + m_config.my_callsign() + " ") && !text.contains("73 "))
- )) {
- dBpoints=decodedtext.string().mid(7,3).toInt();
- if(dBpoints>maxdBPoints) {
- maxdBPoints=dBpoints;
- m_deCall=deCall;
- m_bDoubleClicked=true;
- if ((pounce && text.contains(" CQ ") && m_config.Wait_features_enabled()) or m_auto) {
- auto_tx_mode(true);
- processMessage(decodedtext0);
- if (pounce) stopWCTimer.start(int(6200.0*m_TRperiod)); // Tx max 6*TRperiod
- }
- ui->dxCallEntry->setText(deCall);
- genStdMsgs(QString::number(decodedtext.snr()));
- ui->RxFreqSpinBox->setValue(decodedtext.frequencyOffset());
- setTxMsg(m_ntx);
- m_currentMessageType=m_ntx;
- auto now = QDateTime::currentDateTimeUtc();
- m_dateTimeQSOOn = now.addSecs (-(m_ntx - 1) * int(m_TRperiod) - int(fmod(double(now.time().second()),m_TRperiod)));
- QTimer::singleShot (6000, [=] {selected = false;});
- }
- }
- }
-
- // CQ: Min dB
- if((pounce or m_auto) && ui->respondComboBox->isVisible() && ui->respondComboBox->currentText()=="CQ: Min dB"
- && (!(ui->actionFull_Duplex_Mode->isChecked() && m_txing))) {
- QString deCall;
- QString deGrid;
- decodedtext.deCallAndGrid(/*out*/deCall,deGrid);
- if (!filtered && !ignored && (
- (pounce && text.contains(" CQ ") && !txLog.contains(deCall) && m_config.Wait_features_enabled()) or
- (m_bCallingCQ && text.contains(" " + m_config.my_callsign() + " ") && !text.contains("73 "))
- )) {
- dBpoints2=decodedtext.string().mid(7,3).toInt();
- if(dBpoints2<mindBPoints) {
- mindBPoints=dBpoints2;
- m_deCall=deCall;
- m_bDoubleClicked=true;
- if ((pounce && text.contains(" CQ ") && m_config.Wait_features_enabled()) or m_auto) {
- auto_tx_mode(true);
- processMessage(decodedtext0);
- if (pounce) stopWCTimer.start(int(6200.0*m_TRperiod)); // Tx max 6*TRperiod
- }
- ui->dxCallEntry->setText(deCall);
- genStdMsgs(QString::number(decodedtext.snr()));
- ui->RxFreqSpinBox->setValue(decodedtext.frequencyOffset());
- setTxMsg(m_ntx);
- m_currentMessageType=m_ntx;
- auto now = QDateTime::currentDateTimeUtc();
- m_dateTimeQSOOn = now.addSecs (-(m_ntx - 1) * int(m_TRperiod) - int(fmod(double(now.time().second()),m_TRperiod)));
- QTimer::singleShot (6000, [=] {selected = false;});
- }
- }
- }
-
- // Ensure that Tx stops and QSO is logged when repeat_Tx is enabled and "73" is received
- if(m_config.repeat_Tx() && m_mode=="Q65" && m_hisCall!="" && text.contains(m_baseCall) && text.contains(m_hisCall + " 73 ")) {
- if((m_config.prompt_to_log() or m_config.autoLog()) && !m_tune && CALLING != m_QSOProgress) logQSOTimer.start(0);
- cease_auto_Tx_after_QSO();
- }
-
- // highlight orange and blue callsigns
- if (m_config.highlight_orange() or (m_config.highlight_blue())) {
- QString deCall;
- QString deGrid;
- decodedtext.deCallAndGrid(/*out*/deCall,deGrid);
- if (m_config.highlight_orange() && m_config.highlight_orange_callsigns().contains(deCall + ","))
- ui->decodedTextBrowser->highlight_callsign(deCall, QColor(225,75,0), QColor(255,255,255), true);
- if (m_config.highlight_orange() && m_config.highlight_orange_callsigns().contains(deGrid))
- ui->decodedTextBrowser->highlight_callsign(deGrid, QColor(225,75,0), QColor(255,255,255), true);
- if (m_config.highlight_blue() && m_config.highlight_blue_callsigns().contains(deCall + ","))
- ui->decodedTextBrowser->highlight_callsign(deCall, QColor(0,100,255), QColor(255,255,255), true);
- if (m_config.highlight_blue() && m_config.highlight_blue_callsigns().contains(deGrid))
- ui->decodedTextBrowser->highlight_callsign(deGrid, QColor(0,100,255), QColor(255,255,255), true);
- // highlight directional calls
- if (tw.size () > 2) {
- if (m_config.highlight_orange() && tw[0]=="CQ" && m_config.highlight_orange_callsigns().contains(tw[1] + ","))
- ui->decodedTextBrowser->highlight_callsign(tw[1], QColor(225,75,0), QColor(255,255,255), true);
- if (m_config.highlight_blue() && tw[0]=="CQ" && m_config.highlight_blue_callsigns().contains(tw[1] + ","))
- ui->decodedTextBrowser->highlight_callsign(tw[1], QColor(0,100,255), QColor(255,255,255), true);
- }
- }
-
- // Highlight DX Call/Grid
- if (!pounce && (m_config.highlight_DXcall() or m_config.alert_Enabled()) && (m_hisCall != "") &&
- ((decodedtext.string().contains(QRegularExpression{"(\\w+) " + m_hisCall}))
- || (decodedtext.string().contains(QRegularExpression{"(\\w+) <" + m_hisCall + ">"}))
- || (decodedtext.string().contains(QRegularExpression{"<(\\w+)> " + m_hisCall}))
- || (decodedtext.string().contains(QRegularExpression{"<...> " + m_hisCall})))) {
- if (m_config.alert_Enabled() && m_config.alert_DXcall() && !m_muted) play_DXcall = true; // UR disable for versions without alerts
- if (m_config.highlight_DXcall()) {
- // repeated highlighting to override JTAlert
- ui->decodedTextBrowser->highlight_callsign(m_hisCall, QColor(255,0,0), QColor(255,255,255), true);
- QTimer::singleShot (500, [=] {ui->decodedTextBrowser->highlight_callsign(m_hisCall, QColor(255,0,0), QColor(255,255,255), true);});
- QTimer::singleShot (1000, [=] {ui->decodedTextBrowser->highlight_callsign(m_hisCall, QColor(255,0,0), QColor(255,255,255), true);});
- QTimer::singleShot (2500, [=] {ui->decodedTextBrowser->highlight_callsign(m_hisCall, QColor(255,0,0), QColor(255,255,255), true);});
- }
- }
- if (!pounce && (m_config.highlight_DXgrid () or m_config.alert_Enabled()) && (m_hisGrid!="") &&
- (decodedtext.string().contains(m_hisGrid.left(4)))) {
- if (m_config.highlight_DXgrid()) ui->decodedTextBrowser->highlight_callsign(m_hisGrid.left(4), QColor(0,0,200), QColor(255,255,255), true);
- if (m_config.alert_Enabled() && m_config.alert_DXcall() && !m_muted) play_DXcall = true; // UR disable for versions without alerts
- }
- QTimer::singleShot (100, [=] { // UR delete for versions without alerts
- if (m_config.alert_Enabled() && m_config.alert_DXcall() && play_DXcall && m_hisCall!="") {
-#ifdef WIN32
- QAudioOutput info(QAudioDeviceInfo::defaultOutputDevice());
- QString binPath = QCoreApplication::applicationDirPath();
- QAudioFormat format;
- format.setCodec("audio/pcm");
- format.setSampleRate (48000);
- format.setChannelCount (1);
- format.setSampleSize (16);
- format.setSampleType(QAudioFormat::SignedInt);
- QAudioOutput* audio;
- audio = new QAudioOutput(format, this);
- connect(audio, SIGNAL(stateChanged(QAudio::State)), this, SLOT(handleStateChanged(QAudio::State)));
- QFile *effect1 = new QFile(this);
- effect1->setFileName(QString("%1/%2").arg(binPath, "/sounds/DXcall.wav"));
- effect1->open(QIODevice::ReadOnly);
- audio->start(effect1);
-#else
- QString binPath = QCoreApplication::applicationDirPath();
- QSound::play(binPath + "/sounds/DXcall.wav"); // for Linux and macOS
-#endif
- play_DXcall = false;
- }
- }); // UR delete for versions without alerts
-
- if (m_bBestSPArmed && m_mode=="FT4" && CALLING == m_QSOProgress && !ignored && !filtered) {
- QString messagePriority=ui->decodedTextBrowser->CQPriority();
- if (messagePriority!="") {
- if (messagePriority=="New Call on Band"
- and m_BestCQpriority!="New Call on Band"
- and m_BestCQpriority!="New Multiplier"
- and (!(ui->actionFull_Duplex_Mode->isChecked() && m_txing))) {
- m_BestCQpriority="New Call on Band";
- m_bDoubleClicked = true;
- processMessage(decodedtext0);
- }
- if (messagePriority=="New DXCC"
- and m_BestCQpriority!="New DXCC"
- and m_BestCQpriority!="New Multiplier"
- and (!(ui->actionFull_Duplex_Mode->isChecked() && m_txing))) {
- m_BestCQpriority="New DXCC";
- m_bDoubleClicked = true;
- processMessage(decodedtext0);
- }
- }
- }
- }
- }
-
-//Right (Rx Frequency) window
- bool bDisplayRight=bAvgMsg;
- int audioFreq=decodedtext.frequencyOffset();
- if(m_mode=="FT8" or m_mode=="FT4" or m_mode=="FST4" or m_mode=="Q65") {
- int ftol=10;
- if(m_mode=="Q65") ftol=ui->sbFtol->value();
- auto const& parts = decodedtext.string().remove("<").remove(">")
- .split (' ', SkipEmptyParts);
- if (parts.size() > 6) {
- auto for_us = parts[5].contains (m_baseCall)
- || ("DE" == parts[5] && qAbs (ui->RxFreqSpinBox->value () - audioFreq) <= ftol);
- if(m_baseCall == m_config.my_callsign()) {
- if (m_baseCall != parts[5]) for_us=false;
- } else {
- if (m_config.my_callsign () != parts[5]) {
-// Same base call as ours but different prefix or suffix. Rare but can happen with
-// multi-station special events.
- for_us = false;
- }
- }
-
- // Reply also to averaged messages that are only displayed in the right window
- if(m_bCallingCQ && !m_bAutoReply && for_us && m_specOp!=SpecOp::FOX && m_specOp!=SpecOp::HOUND
- && ui->actionInclude_averaging->isVisible() && ui->actionInclude_averaging->isChecked()) {
- bool bProcessMsgNormally=ui->respondComboBox->currentText()!="CQ: None" or
- (m_ActiveStationsWidget!=NULL and !m_ActiveStationsWidget->isVisible());
- if (decodedtext.messageWords().length() >= 3) {
- QString t=decodedtext.messageWords()[2];
- if(t.contains("R+") or t.contains("R-") or t=="R" or t=="RRR" or t=="RR73") bProcessMsgNormally=true;
- } else {
- bProcessMsgNormally=true;
- }
- if(bProcessMsgNormally) {
- m_bDoubleClicked=true;
- m_bAutoReply = true;
- processMessage (decodedtext);
- }
- }
-
- if(SpecOp::FOX==m_specOp and decodedtext.string().contains(" DE ")) for_us=true; //Hound with compound callsign
- if(SpecOp::FOX==m_specOp and for_us and decodedtext.string().contains(QRegularExpression{" R\\W\\d"})) bDisplayRight=true;
- if(SpecOp::FOX!=m_specOp and (for_us or (abs(audioFreq - m_wideGraph->rxFreq()) <= 10))) bDisplayRight=true;
- if(SpecOp::HOUND==m_specOp and !for_us) bDisplayRight=false;
-
- // Give the Fox a warning when there is probably another Fox on the frequency
- if(SpecOp::FOX==m_specOp and audioFreq<1000 and !for_us and decodedtext.string().contains(QRegularExpression{" R\\W\\d"})) {
- if (first_Fox_alert) {
- first_Fox_alert = false;
- QTimer::singleShot (120000, [=] {first_Fox_alert = true;}); // Reset after 2 minutes
- } else {
- if (second_Fox_alert) {
- second_Fox_alert = false;
- QTimer::singleShot (300000, [=] {second_Fox_alert = true;}); // Reset after 5 minutes
- } else {
- if (!no_Fox_alert) {
- MessageBox::warning_message (this,
- "Looks like another fox is working on this frequency.\n\n"
- "Stop transmitting, exit Fox mode for a few minutes,\n"
- "and check the incoming FT8 messages.");
- no_Fox_alert = true;
- QTimer::singleShot (3600000, [=] { // No further Fox warnings for 60 minutes
- no_Fox_alert = false;
- first_Fox_alert = true;
- second_Fox_alert = true;
- });
- }
- }
- }
- }
-
- }
- } else {
- if((abs(audioFreq - m_wideGraph->rxFreq()) <= 10) and
- !m_config.enable_VHF_features()) bDisplayRight=true;
- }
- if(m_mode=="Q65" and !bAvgMsg and !decodedtext.string().contains(m_baseCall)) bDisplayRight=false;
- if((m_mode=="JT4" or m_mode=="Q65" or m_mode=="JT65") and decodedtext.string().contains(m_baseCall) && ui->actionInclude_averaging->isVisible() && !ui->actionInclude_averaging->isChecked()) bDisplayRight=true;
- if((m_mode=="FT8" or m_mode=="FT4") and SpecOp::FOX!=m_specOp && decodedtext0.string().replace("<","").replace(">","").contains(m_baseCall + " " + m_hisCall)) bDisplayRight=true; // really all messages for us
-
- // AutoSeq for JT65/JT4 short messages
- if ((m_mode=="JT65" or m_mode=="JT4") and m_config.enable_VHF_features() and ui->cbShMsgs->isChecked() && ui->cbAutoSeq->isChecked () && (abs(audioFreq - m_wideGraph->rxFreq()) <= 15)) {
- if (decodedtext.string().contains(" " + m_config.my_callsign() + " ") && decodedtext.string().contains(" OOO")) {
- setTxMsg(3);
- }
- if (decodedtext.string().contains(" RO")) {
- setTxMsg(4);
- }
- if (decodedtext.string().contains(" RRR")) {
- setTxMsg(5);
- }
- if (decodedtext.string().contains(" 73")) {
- setTxMsg(5);
- }
- }
-
- if (bDisplayRight && !block_right_display) {
- // This msg is within 10 hertz of our tuned frequency, or a JT4 or JT65 avg, or contains MyCall
-
- if(!pounce && (!m_bBestSPArmed or m_mode!="FT4")) {
- // insert blank line when band was changed
- if (m_config.insert_blank () && SpecOp::FOX!=m_specOp && m_band_changed && (m_currentBandPeriod == m_currentBand)) {
- if (ui->actionUse_Dark_Style->isChecked()) {
- ui->decodedTextBrowser2->insertText(("------------------- " + m_currentBandPeriod + " -----------------"), "#a2a2a2", "#000000");
- } else {
- ui->decodedTextBrowser2->insertLineSpacer ("------------------- " + m_currentBandPeriod + " -----------------");
- }
- m_band_changed = false;
- }
- if (m_config.alert_Enabled() && ui->actionInclude_averaging->isVisible() && ui->actionInclude_averaging->isChecked()) ui->decodedTextBrowser->new_period (); // ensure alerts are played
- ui->decodedTextBrowser2->displayDecodedText (decodedtext0, m_config.my_callsign (), m_mode, m_config.DXCC (),
- m_logBook, m_currentBand, m_config.ppfx (), false, false, 0.0, bDisplayPoints, m_points, "", m_muted);
- }
- m_QSOText = decodedtext.string ().trimmed ();
- }
-
- if (!blockUDP) // block udp spotting for false decodes (JTAlert)
- postDecode (true, decodedtext.string ());
-
- if(m_mode=="FT8" and SpecOp::HOUND==m_specOp) {
- if(decodedtext.string().contains(";")) {
- QString text = decodedtext.string().remove("<").remove(">"); // needed for MSHV multistream messages
- QStringList w=text.mid(24).split(" ",SkipEmptyParts);
- QString foxCall=w.at(3);
- if(w.at(0)==m_config.my_callsign() or w.at(0)==Radio::base_callsign(m_config.my_callsign())) {
- //### Check for ui->dxCallEntry->text()==foxCall before logging! ###
- ui->stopTxButton->click ();
- logQSOTimer.start(0);
- }
- if((w.at(2)==m_config.my_callsign() or w.at(2)==Radio::base_callsign(m_config.my_callsign()))
- and ui->tx3->text().length()>0) {
- m_rptRcvd=w.at(4);
- m_rptSent=decodedtext.string().mid(7,3);
- m_nFoxFreq=decodedtext.string().mid(16,4).toInt();
- hound_reply ();
- }
- } else {
- QString text = decodedtext.string().remove("<").remove(">"); // needed for MSHV multistream messages
- QStringList w=text.mid(24).split(" ",SkipEmptyParts);
- if(decodedtext.string().contains("/")) w.append(" +00"); //Add a dummy report
- if(w.size()>=3) {
- QString foxCall=w.at(1);
- if((w.at(0)==m_config.my_callsign() or w.at(0)==Radio::base_callsign(m_config.my_callsign())) and
- ui->tx3->text().length()>0) {
- if(w.at(2)=="RR73") {
- ui->stopTxButton->click ();
- logQSOTimer.start(0);
- } else {
- if(w.at(1)==Radio::base_callsign(ui->dxCallEntry->text()) and
- (w.at(2).mid(0,1)=="+" or w.at(2).mid(0,1)=="-")) {
- m_rptRcvd=w.at(2);
- m_rptSent=decodedtext.string().mid(7,3);
- m_nFoxFreq=decodedtext.string().mid(16,4).toInt();
- hound_reply ();
- } else {
- if (SpecOp::HOUND==m_specOp && (text.mid(4,2).contains("15") or text.mid(4,2).contains("45"))) return; // ignore stations calling in the wrong time slot
- if (text.contains(" " + m_config.my_callsign() + " " + m_hisCall) && !text.contains("73 ")) processMessage(decodedtext0); // needed for MSHV multistream messages
- }
- }
- }
- }
- }
- }
-
-//### I think this is where we are preventing Hounds from spotting Fox ###
- if(m_mode!="FT8" or (SpecOp::HOUND != m_specOp) or (SpecOp::HOUND == m_specOp and m_config.superFox())) {
- if(m_mode=="FT8" or m_mode=="FT4" or m_mode=="Q65"
- or m_mode=="JT4" or m_mode=="JT65" or m_mode=="JT9" or m_mode=="FST4") {
- auto_sequence (decodedtext, 25, 50);
- }
-
-// find and extract any report for myCall, but save in m_rptRcvd only if it's from DXcall
- QString rpt;
- bool stdMsg = decodedtext.report(m_baseCall,
- Radio::base_callsign(ui->dxCallEntry->text()), rpt);
- QString deCall;
- QString grid;
- decodedtext.deCallAndGrid(/*out*/deCall,grid);
- {
- auto t = Radio::base_callsign (ui->dxCallEntry->text ());
- auto const& dx_call = decodedtext.call ();
- if (rpt.size () // report in message
- && (m_baseCall == Radio::base_callsign (dx_call) // for us
- || "DE" == dx_call) // probably for us
- && (t == deCall // DX station base call is QSO partner
- || ui->dxCallEntry->text () == deCall // DX station full call is QSO partner
- || !t.size ())) // not in QSO
- {
- m_rptRcvd = rpt;
- }
- }
-// extract details and send to PSKreporter
- int nsec=QDateTime::currentMSecsSinceEpoch()/1000-m_secBandChanged;
- bool okToPost=(nsec > int(4*m_TRperiod)/5);
- if(m_mode=="FST4W" and okToPost) {
- line_read=line_read.left(22) + " CQ " + line_read.trimmed().mid(22);
- auto p = line_read.lastIndexOf (' ');
- DecodedText FST4W_post {QString::fromUtf8 (line_read.left (p).constData ())};
- pskPost(FST4W_post);
- } else {
- if (stdMsg && okToPost) pskPost(decodedtext);
- }
- if((m_mode=="JT4" or m_mode=="JT65" or m_mode=="Q65") and
- m_msgAvgWidget!=NULL) {
- if(m_msgAvgWidget->isVisible()) {
- QFile f(m_config.temp_dir ().absoluteFilePath ("avemsg.txt"));
- if(f.open(QIODevice::ReadOnly | QIODevice::Text)) {
- QTextStream s(&f);
- QString t=s.readAll();
- if (t != NULL) m_msgAvgWidget->displayAvg(t);
- else qDebug() << "tmp==NULL at s.readAll";
- }
- }
- }
- }
- }
- }
- if (m_mode == "FT8" and m_specOp == SpecOp::FOX and m_ActiveStationsWidget != NULL) {
- m_ActiveStationsWidget->addLine(all_decodes);
- }
-}
-
-//
-// start_tolerance - only respond to "DE ..." and free text 73
-// messages within +/- this value
-//
-// stop_tolerance - kill Tx if running station is seen to reply to
-// another caller and we are going to transmit within
-// +/- this value of the reply to another caller
-//
-void MainWindow::auto_sequence (DecodedText const& message, unsigned start_tolerance, unsigned stop_tolerance)
-{
- auto const& message_words = message.messageWords ();
- auto is_73 = message_words.filter (QRegularExpression {"^(73|RR73)$"}).size();
- auto msg_no_hash = message.clean_string();
- msg_no_hash = msg_no_hash.mid(22).remove("<").remove(">");
- bool is_OK=false;
- if(m_mode=="MSK144" && msg_no_hash.indexOf(ui->dxCallEntry->text()+" R ")>0) is_OK=true;
- if (message_words.size () > 3 && (message.isStandardMessage() || (is_73 or is_OK))) {
- auto df = message.frequencyOffset ();
- auto within_tolerance = (qAbs (ui->RxFreqSpinBox->value () - df) <= int (start_tolerance)
- || qAbs (ui->TxFreqSpinBox->value () - df) <= int (start_tolerance));
- bool acceptable_73 = is_73
- && m_QSOProgress >= ROGER_REPORT
- && ((message.isStandardMessage ()
- && (message_words.contains (m_baseCall)
- || message_words.contains (m_config.my_callsign ())
- || message_words.contains (ui->dxCallEntry->text ())
- || message_words.contains (Radio::base_callsign (ui->dxCallEntry->text ()))
- || message_words.contains ("DE")))
- || (!message.isStandardMessage () && m_mode != "MSK144")); // free text 73/RR73 except for MSK
-
- auto const& w = msg_no_hash.split(" ",SkipEmptyParts);
- QString w2;
- int nrpt=0;
- if (w.size () > 2)
- {
- w2=w.at(2);
- if(w.size()>3) {
- nrpt=w2.toInt();
- if(w2=="R") nrpt=w.at(3).toInt();
- }
- }
- bool bEU_VHF=(nrpt>=520001 and nrpt<=594000);
- if(bEU_VHF and message.clean_string ().contains("<"+m_config.my_callsign() + "> ")) {
- m_xRcvd=message.clean_string ().trimmed().right(13);
- }
- if (m_auto
- && (m_QSOProgress==REPLYING or (!ui->tx1->isEnabled () and m_QSOProgress==REPORT))
- && SpecOp::HOUND != m_specOp && qAbs (ui->TxFreqSpinBox->value () - df) <= int (stop_tolerance) //
- && message_words.at (2) != "DE"
- && !message_words.at (2).contains (QRegularExpression {"(^(CQ|QRZ))|" + m_baseCall})
- && message_words.at (3).contains (Radio::base_callsign (ui->dxCallEntry->text ()))) {
- // auto stop to avoid accidental QRM
- ui->stopTxButton->click (); // halt any transmission
- LOG_INFO("STOPPED!");
- } else if (m_auto // transmit allowed
- && ui->cbAutoSeq->isVisible () && ui->cbAutoSeq->isEnabled () && ui->cbAutoSeq->isChecked () // auto-sequencing allowed
- && ((!m_bCallingCQ // not calling CQ/QRZ
- && !m_sentFirst73 // not finished QSO
- && ((message_words.at (2).contains (m_baseCall)
- // being called and not already in a QSO
- && (message_words.at(3).contains(Radio::base_callsign(ui->dxCallEntry->text()))
- or bEU_VHF))
- || message_words.at(1) == m_baseCall // <de-call> RR73; ...
- // type 2 compound replies
- || (within_tolerance &&
- (acceptable_73 ||
- ("DE" == message_words.at (2) &&
- w2.contains(Radio::base_callsign (m_hisCall)))))))
- || (m_bCallingCQ && m_bAutoReply
- // look for type 2 compound call replies on our Tx and Rx offsets
- && ((within_tolerance && "DE" == message_words.at (2))
- || message_words.at (2).contains (m_baseCall))))) {
- if(SpecOp::FOX != m_specOp) processMessage (message);
- }
- }
-}
-
-void MainWindow::pskPost (DecodedText const& decodedtext)
-{
- if (m_diskData || !m_config.spot_to_psk_reporter() || decodedtext.isLowConfidence ()
- || (decodedtext.string().contains(m_baseCall) && decodedtext.string().contains(m_config.my_grid().left(4)))) return; // prevent self-spotting when running multiple instances
-
- QString msgmode=m_mode;
- QString deCall;
- QString grid;
- decodedtext.deCallAndGrid(/*out*/deCall,grid);
- int audioFrequency = decodedtext.frequencyOffset();
- if(m_mode=="FT8" or m_mode=="MSK144" or m_mode=="FT4") {
- audioFrequency=decodedtext.string().mid(16,4).toInt();
- }
- int snr = decodedtext.snr();
- Frequency frequency = m_freqNominalPeriod + audioFrequency; // prevent spotting wrong band
- if(grid.contains (grid_regexp) || decodedtext.string().contains(" CQ ")) {
-// qDebug() << "To PSKreporter:" << deCall << grid << frequency << msgmode << snr;
- if (!m_psk_Reporter.addRemoteStation (deCall, grid, frequency, msgmode, snr))
- {
- showStatusMessage (tr ("Spotting to PSK Reporter unavailable"));
- }
- }
-}
-
-void MainWindow::killFile ()
-{
- if (m_fnameWE.size () && !(m_saveAll || (m_saveDecoded && m_bDecoded))) {
- QFile f1 {m_fnameWE + ".wav"};
- if(f1.exists()) f1.remove();
- if(m_mode=="WSPR" or m_mode=="FST4W") {
- QFile f2 {m_fnameWE + ".c2"};
- if(f2.exists()) f2.remove();
- }
- }
-}
-
-void MainWindow::on_EraseButton_clicked ()
-{
- qint64 ms=QDateTime::currentMSecsSinceEpoch();
- if (m_config.alternate_erase_button()) {
- ui->decodedTextBrowser->erase ();
- if((ms-m_msErase)<500) {
- ui->decodedTextBrowser2->erase ();
- }
- } else {
- ui->decodedTextBrowser2->erase ();
- if(m_mode=="WSPR" or m_mode=="Echo" or m_mode=="FST4W") {
- ui->decodedTextBrowser->erase ();
- } else {
- if((ms-m_msErase)<500) {
- ui->decodedTextBrowser->erase ();
- }
- }
- }
- m_msErase=ms;
-}
-
-void MainWindow::band_activity_cleared ()
-{
- m_messageClient->decodes_cleared ();
- QFile f(m_config.temp_dir ().absoluteFilePath ("decoded.txt"));
- if(f.exists()) f.remove();
-}
-
-void MainWindow::rx_frequency_activity_cleared ()
-{
- m_QSOText.clear();
- set_dateTimeQSO(-1); // G4WJS: why do we do this?
-}
-
-void MainWindow::decodeBusy(bool b) //decodeBusy()
-{
- if (!b) {
- m_optimizingProgress.reset ();
- }
- m_decoderBusy=b;
- ui->DecodeButton->setEnabled(!b);
- ui->actionOpen->setEnabled(!b);
- ui->actionOpen_next_in_directory->setEnabled(!b);
- ui->actionDecode_remaining_files_in_directory->setEnabled(!b);
-
- statusUpdate ();
-}
-
-//------------------------------------------------------------- //guiUpdate()
-void MainWindow::guiUpdate()
-{
- static char message[38];
- static char msgsent[38];
- double txDuration;
-
- if(m_TRperiod==0) m_TRperiod=60.0;
- txDuration=tx_duration(m_mode,m_TRperiod,m_nsps,m_bFast9);
- if(m_mode=="FT8" and m_specOp==SpecOp::FOX and m_config.superFox()) txDuration=1.0+151*1024.0/12000.0;
- // qDebug () << "DEBUG SF " << m_mode << m_TRperiod << m_nsps << (SpecOp::FOX==m_specOp) << m_config.superFox() << txDuration;
- double tx1=0.0;
- double tx2=txDuration;
- if(m_mode=="FT8" or m_mode=="FT4") icw[0]=0; //No CW ID in FT4 or FT8 mode
- if((icw[0]>0) and (!m_bFast9)) tx2 += icw[0]*2560.0/48000.0; //Full length including CW ID
- if(tx2>m_TRperiod) tx2=m_TRperiod;
- if(!m_txFirst and m_mode!="WSPR" and m_mode!="FST4W") {
- tx1 += m_TRperiod;
- tx2 += m_TRperiod;
- }
-
- qint64 ms = QDateTime::currentMSecsSinceEpoch() % 86400000;
- int nsec=ms/1000;
- double tsec=0.001*ms;
- double t2p=fmod(tsec,2*m_TRperiod);
- m_s6=fmod(tsec,6.0);
- int nseq = fmod(double(nsec),m_TRperiod);
- m_tRemaining=m_TRperiod - fmod(tsec,m_TRperiod);
-
- if(m_mode=="Echo") {
- tx1=0.0;
- tx2=txDuration;
- if(m_auto and m_s6>4.0) m_bEchoTxOK=true;
- if(m_transmitting) m_bEchoTxed=true;
- }
-
- if(m_mode=="WSPR" or m_mode=="FST4W") {
- if(nseq==0 and m_ntr==0) { //Decide whether to Tx or Rx
- m_tuneup=false; //This is not an ATU tuneup
- bool btx = m_auto && m_WSPR_tx_next; // To Tx, we need m_auto and
- // scheduled transmit
- m_WSPR_tx_next = false;
- if(btx) {
- m_ntr=-1; //This says we will have transmitted
- ui->pbTxNext->setChecked (false);
- m_bTxTime=true; //Start a WSPR or FST4W Tx sequence
- } else {
- // This will be a WSPR or FST4W Rx sequence.
- m_ntr=1; //This says we will have received
- m_bTxTime=false; //Start a WSPR or FST4W Rx sequence
- }
- }
-
- } else {
- // For all modes other than WSPR and FST4W
- m_bTxTime = (t2p >= tx1) and (t2p < tx2);
- if(m_mode=="Echo") {
- m_bTxTime = (t2p >= tx1) and (t2p < (tx2+m_config.txDelay())) and m_bEchoTxOK;
- }
- if(m_mode=="FT8" and ui->tx5->currentText().contains("/B ")) {
- //FT8 beacon transmission from Tx5 only at top of a UTC minute
- double t4p=fmod(tsec,4*m_TRperiod);
- if(t4p >= 30.0) m_bTxTime=false;
- }
- }
- if(m_tune) m_bTxTime=true; //"Tune" takes precedence
-
- if(m_transmitting or m_auto or m_tune) {
- m_dateTimeLastTX = QDateTime::currentDateTimeUtc ();
-
-// Check for "txboth" (FT4 testing purposes only)
- QFile f(m_appDir + "/txboth");
- if(f.exists() and fmod(tsec,m_TRperiod) < (0.5 + 105.0*576.0/12000.0)) m_bTxTime=true;
-
-// Don't transmit another mode in the 30 m WSPR sub-band
- Frequency onAirFreq = m_freqNominal + ui->TxFreqSpinBox->value();
- if ((onAirFreq > 10139900 and onAirFreq < 10140320) and m_mode!="WSPR" and m_mode!="FST4W") {
- m_bTxTime=false;
- if (m_auto) auto_tx_mode (false);
- if(onAirFreq!=m_onAirFreq0) {
- m_onAirFreq0=onAirFreq;
- auto const& message = tr ("Please choose another Tx frequency."
- " WSJT-X will not knowingly transmit another"
- " mode in the WSPR sub-band on 30m.");
- QTimer::singleShot (0, [=] { // don't block guiUpdate
- MessageBox::warning_message (this, tr ("WSPR Guard Band"), message);
- });
- }
- }
-
- if(m_mode=="FT8" and SpecOp::FOX==m_specOp) {
-// Don't allow Fox mode in any of the default FT8 sub-bands.
- QVector<qint32> ft8Freq = {1840000,3573000,7074000,10136000,14074000,18100000,21074000,24915000,28074000,50313000,70154000};
- for(int i=0; i<ft8Freq.length()-1; i++) {
- int kHzdiff=m_freqNominal - ft8Freq[i];
- if(qAbs(kHzdiff) < 3000 ) {
- m_bTxTime=false;
- if (m_auto) auto_tx_mode (false);
- if (m_tune) stop_tuning();
- auto const& message = tr ("Please choose another dial frequency.\n"
- "Must be 3Khz away from %1.\n"
- "WSJT-X will not operate in Fox mode\n"
- "overlapping the standard FT8 sub-bands.").arg(ft8Freq[i]);
- QTimer::singleShot (0, [=] { // don't block guiUpdate
- MessageBox::warning_message (this, tr ("Fox Mode warning"), message);
- });
- break;
- }
- }
-// Don't allow Fox mode on WSPR frequencies.
- QVector<qint32> wsprFreq = {1836600,5364700,3568600,7038600,10138700,14095600,18104600,21094600,24924600,28124600};
- for(int i=0; i<wsprFreq.length()-1; i++) {
- int kHzdiff=m_freqNominal - wsprFreq[i];
- if(kHzdiff > -3500 && kHzdiff < 300) {
- m_bTxTime=false;
- if (m_auto) auto_tx_mode (false);
- if (m_tune) stop_tuning();
- auto const& message = tr ("Please choose another dial frequency.\n"
- "WSJT-X will not operate in Fox mode\n"
- "overlapping the WSPR sub-bands.").arg(ft8Freq[i]);
- QTimer::singleShot (0, [=] { // don't block guiUpdate
- MessageBox::warning_message (this, tr ("Fox Mode warning"), message);
- });
- break;
- }
- }
- }
-
- if (m_config.watchdog() && m_mode!="WSPR" && m_mode!="FST4W"
- && m_idleMinutes >= m_config.watchdog ()) {
- tx_watchdog (true); // disable transmit
- }
-
- double fTR=float((ms%int(1000.0*m_TRperiod)))/int(1000.0*m_TRperiod);
-
- QString txMsg;
- if(m_ntx == 1) txMsg=ui->tx1->text();
- if(m_ntx == 2) txMsg=ui->tx2->text();
- if(m_ntx == 3) txMsg=ui->tx3->text();
- if(m_ntx == 4) txMsg=ui->tx4->text();
- if(m_ntx == 5) txMsg=ui->tx5->currentText();
- if(m_ntx == 6) txMsg=ui->tx6->text();
- int msgLength=txMsg.trimmed().length();
- if(msgLength==0 and !m_tune) on_stopTxButton_clicked();
-
- if(g_iptt==0 and ((m_bTxTime and (fTR < 0.75) and (msgLength>0)) or m_tune)) {
- //### Allow late starts
- icw[0]=m_ncw;
- g_iptt = 1;
- setRig ();
- if(m_mode=="FT8") {
- if (SpecOp::FOX == m_specOp) {
- if(m_config.superFox()) {
- ui->TxFreqSpinBox->setValue(750); //SuperFox transmits at 750 Hz
- } else {
- if (ui->TxFreqSpinBox->value() > 900) {
- ui->TxFreqSpinBox->setValue(500);
- }
- }
- }
- else if (SpecOp::HOUND == m_specOp && !m_config.superFox()) {
- if(m_auto && !m_tune) {
- if (ui->TxFreqSpinBox->value() < 999 && m_ntx != 3) {
- // Hound randomized range: 1000-3000 Hz
-#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0)
- ui->TxFreqSpinBox->setValue (QRandomGenerator::global ()->bounded (1000, 2999));
-#else
- ui->TxFreqSpinBox->setValue ((qrand () % 2000) + 1000);
-#endif
- }
- }
- if (m_nSentFoxRrpt==2 and m_ntx==3) {
- // move off the original Fox frequency on subsequent tries of Tx3
- int nfreq=m_nFoxFreq + 300;
- if(m_nFoxFreq>600) nfreq=m_nFoxFreq - 300; //keep nfreq below 900 Hz
- ui->TxFreqSpinBox->setValue(nfreq);
- }
- if (m_nSentFoxRrpt == 1) {
- ++m_nSentFoxRrpt;
- }
- }
- }
-
-
-// If HoldTxFreq is not checked, randomize Fox's Tx Freq
-// NB: Maybe this should be done no more than once every 5 minutes or so ?
- if(m_mode=="FT8" and SpecOp::FOX==m_specOp and !ui->cbHoldTxFreq->isChecked() && !m_config.superFox()) {
-#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0)
- ui->TxFreqSpinBox->setValue (QRandomGenerator::global ()->bounded (300, 599));
-#else
- ui->TxFreqSpinBox->setValue(300.0 + 300.0*double(qrand())/RAND_MAX);
-#endif
- }
-
- setXIT (ui->TxFreqSpinBox->value ());
- m_config.transceiver_ptt (true); //Assert the PTT
- m_tx_when_ready = true;
- }
-// if(!m_bTxTime and !m_tune and m_mode!="FT4") m_btxok=false; //Time to stop transmitting
- if(!m_bTxTime and !m_tune) m_btxok=false; //Time to stop transmitting
- }
-
- if((m_mode=="WSPR" or m_mode=="FST4W") and
- ((m_ntr==1 and m_rxDone) or (m_ntr==-1 and nseq>tx2))) {
- if(m_monitoring) {
- m_rxDone=false;
- }
- if(m_transmitting) {
- WSPR_history(m_freqNominal,-1);
- m_bTxTime=false; //Time to stop a WSPR or FST4W transmission
- m_btxok=false;
- }
- else if (m_ntr != -1) {
- WSPR_scheduling ();
- m_ntr=0; //This WSPR or FST4W Rx sequence is complete
- }
- }
-
-
- // Calculate Tx tones when needed
- if((g_iptt==1 && m_iptt0==0) || m_restart) {
-//----------------------------------------------------------------------
- QByteArray ba;
- QByteArray ba0;
-
- if(m_mode=="WSPR") {
- ba=WSPR_message().toLatin1();
- } else {
- if(SpecOp::HOUND == m_specOp and m_ntx!=3) { //Hound transmits only Tx1 or Tx3
- m_ntx=1;
- ui->txrb1->setChecked(true);
- }
-
- if(m_mode=="FT4" and m_bBestSPArmed) {
- m_BestCQpriority="";
- m_bBestSPArmed=false;
- ui->pbBestSP->setStyleSheet ("");
- }
-
- if(m_ntx == 1) ba=ui->tx1->text().toLocal8Bit();
- if(m_ntx == 2) ba=ui->tx2->text().toLocal8Bit();
- if(m_ntx == 3) ba=ui->tx3->text().toLocal8Bit();
- if(m_ntx == 4) ba=ui->tx4->text().toLocal8Bit();
- if(m_ntx == 5) ba=ui->tx5->currentText().toLocal8Bit();
- if(m_ntx == 6) ba=ui->tx6->text().toLocal8Bit();
- }
-
- ba2msg(ba,message);
- int ichk=0;
- if (m_lastMessageSent != m_currentMessage
- || m_lastMessageType != m_currentMessageType)
- {
- m_lastMessageSent = m_currentMessage;
- m_lastMessageType = m_currentMessageType;
- }
- m_currentMessageType = 0;
- if(m_tune or m_mode=="Echo") {
- itone[0]=0;
- if(ui->rbEchoMessage->isChecked() or ui->rbEchoCW->isChecked()) {
- QString echoMsg=(ui->leEchoMessage->text()+" ").left(6);
- gen_echocall_(const_cast <char *> (echoMsg.toLatin1().constData()),const_cast<int *>(itone),(FCL)6);
- }
- } else {
- if(m_QSOProgress==REPORT || m_QSOProgress==ROGER_REPORT) m_bSentReport=true;
- if(m_bSentReport and (m_QSOProgress<REPORT or m_QSOProgress>ROGER_REPORT)) m_bSentReport=false;
- if(m_mode=="JT4") gen4_(message, &ichk , msgsent, const_cast<int *> (itone),
- &m_currentMessageType, (FCL)22, (FCL)22);
- if(m_mode=="JT9") gen9_(message, &ichk, msgsent, const_cast<int *> (itone),
- &m_currentMessageType, (FCL)22, (FCL)22);
- if(m_mode=="JT65") gen65(message, &ichk, msgsent, const_cast<int *> (itone),
- &m_currentMessageType);
- if(m_mode=="WSPR") genwspr_(message, msgsent, const_cast<int *> (itone),
- (FCL)22, (FCL)22);
- if(m_mode=="MSK144" or m_mode=="FT8" or m_mode=="FT4"
- or m_mode=="FST4" or m_mode=="FST4W" || "Q65" == m_mode) {
- if(m_mode=="MSK144") {
- genmsk_128_90_(message, &ichk, msgsent, const_cast<int *> (itone),
- &m_currentMessageType, (FCL)37, (FCL)37);
- if(m_restart) {
- int nsym=144;
- if(itone[40]==-40) nsym=40;
- m_modulator->set_nsym(nsym);
- }
- }
-
- if(m_mode=="FT8") {
- if(SpecOp::FOX==m_specOp and ui->tabWidget->currentIndex()==1) {
- foxTxSequencer();
- } else {
- int i3=0;
- int n3=0;
- char ft8msgbits[77];
- genft8_(message, &i3, &n3, msgsent, const_cast<char *> (ft8msgbits),
- const_cast<int *> (itone), (FCL)37, (FCL)37);
- int nsym=79;
- int nsps=4*1920;
- float fsample=48000.0;
- float bt=2.0;
- float f0=ui->TxFreqSpinBox->value() - m_XIT;
- int icmplx=0;
- int nwave=nsym*nsps;
- gen_ft8wave_(const_cast<int *>(itone),&nsym,&nsps,&bt,&fsample,&f0,foxcom_.wave,
- foxcom_.wave,&icmplx,&nwave);
- if(SpecOp::FOX == m_specOp) {
- //Fox must generate the full Tx waveform, not just an itone[] array.
- QString fm = QString::fromStdString(message).trimmed();
- foxGenWaveform(0,fm);
- foxcom_.nslots=1;
- foxcom_.nfreq=ui->TxFreqSpinBox->value();
- if(m_config.split_mode()) foxcom_.nfreq = foxcom_.nfreq - m_XIT; //Fox Tx freq
- QString foxCall=m_config.my_callsign() + " ";
- ::memcpy(foxcom_.mycall, foxCall.toLatin1(), sizeof foxcom_.mycall); //Copy Fox callsign into foxcom_
- bool bSuperFox=m_config.superFox();
- auto fname {QDir::toNativeSeparators(m_config.writeable_data_dir().absoluteFilePath("sfox_1.dat")).toLocal8Bit()};
- foxcom_.bMoreCQs=ui->cbMoreCQs->isChecked();
- foxcom_.bSendMsg=ui->cbSendMsg->isChecked();
- memcpy(foxcom_.textMsg, m_freeTextMsg.leftJustified(26,' ').toLatin1(),26);
- foxgen_(&bSuperFox, fname.constData(), (FCL)fname.size());
- if(bSuperFox) {
- writeFoxTxMsgs();
- sfox_tx();
- }
- }
- }
- }
- if(m_mode=="FT4") {
- int ichk=0;
- char ft4msgbits[77];
- genft4_(message, &ichk, msgsent, const_cast<char *> (ft4msgbits),
- const_cast<int *>(itone), (FCL)37, (FCL)37);
- int nsym=103;
- int nsps=4*576;
- float fsample=48000.0;
- float f0=ui->TxFreqSpinBox->value() - m_XIT;
- int nwave=(nsym+2)*nsps;
- int icmplx=0;
- gen_ft4wave_(const_cast<int *>(itone),&nsym,&nsps,&fsample,&f0,foxcom_.wave,
- foxcom_.wave,&icmplx,&nwave);
- }
- if(m_mode=="FST4" or m_mode=="FST4W") {
- int ichk=0;
- int iwspr=0;
- char fst4msgbits[101];
- QString wmsg;
- if(m_mode=="FST4W") {
- iwspr = 1;
- wmsg=WSPR_message();
- ba=wmsg.toLatin1();
- ba2msg(ba,message);
- }
- genfst4_(message,&ichk,msgsent,const_cast<char *> (fst4msgbits),
- const_cast<int *>(itone), &iwspr, (FCL)37, (FCL)37);
- int hmod=1;
- if(m_config.x2ToneSpacing()) hmod=2;
- if(m_config.x4ToneSpacing()) hmod=4;
- int nsps=720;
- if(m_TRperiod==30) nsps=1680;
- if(m_TRperiod==60) nsps=3888;
- if(m_TRperiod==120) nsps=8200;
- if(m_TRperiod==300) nsps=21504;
- if(m_TRperiod==900) nsps=66560;
- if(m_TRperiod==1800) nsps=134400;
- nsps=4*nsps; //48000 Hz sampling
- int nsym=160;
- float fsample=48000.0;
- float dfreq=hmod*fsample/nsps;
- float f0=ui->TxFreqSpinBox->value() - m_XIT + 1.5*dfreq;
- if(m_mode=="FST4W") f0=ui->WSPRfreqSpinBox->value() - m_XIT + 1.5*dfreq;
- int nwave=(nsym+2)*nsps;
- int icmplx=0;
- gen_fst4wave_(const_cast<int *>(itone),&nsym,&nsps,&nwave,
- &fsample,&hmod,&f0,&icmplx,foxcom_.wave,foxcom_.wave);
-
- QString t = QString::fromStdString(message).trimmed();
- }
- if(m_mode=="Q65") {
- int i3=-1;
- int n3=-1;
- genq65_(message, &ichk,msgsent, const_cast<int *>(itone), &i3, &n3, (FCL)37, (FCL)37);
- int nsps=1800;
- if(m_TRperiod==30) nsps=3600;
- if(m_TRperiod==60) nsps=7200;
- if(m_TRperiod==120) nsps=16000;
- if(m_TRperiod==300) nsps=41472;
- int nsps4=4*nsps; //48000 Hz sampling
- int nsym=85;
- float fsample=48000.0;
- int nwave=(nsym+2)*nsps4;
- int icmplx=0;
- float f0=ui->TxFreqSpinBox->value()-m_XIT;
- double toneSpacing=fsample/nsps4;
- genwave_(const_cast<int *>(itone),&nsym,&nsps4,&nwave,
- &fsample,&toneSpacing,&f0,&icmplx,foxcom_.wave,foxcom_.wave);
- }
-
- if(SpecOp::EU_VHF==m_specOp) {
- if(m_ntx==2) m_xSent=ui->tx2->text().right(13);
- if(m_ntx==3) m_xSent=ui->tx3->text().right(13);
- }
-
- if(SpecOp::FIELD_DAY==m_specOp or SpecOp::RTTY==m_specOp) {
- if(m_ntx==2 or m_ntx==3) {
- QStringList t=ui->tx2->text().split(' ', SkipEmptyParts);
- int n=t.size();
- if (n > 3) m_xSent=t.at(n-2) + " " + t.at(n-1);
- }
- }
- }
- msgsent[37]=0;
- }
-
- {
- auto temp = m_currentMessage;
- m_currentMessage = QString::fromLatin1(msgsent);
- if (m_currentMessage != temp) // check if tx message changed
- {
- statusUpdate ();
- }
- }
- m_bCallingCQ = 6 == m_ntx
- || m_currentMessage.contains (QRegularExpression {"^(CQ|QRZ) "});
- m_maxPoints=-1;
-
- if (m_tune) {
- m_currentMessage = "TUNE";
- m_currentMessageType = -1;
- }
- if(m_restart) {
- write_all("Tx",m_currentMessage);
- if (m_config.TX_messages () and m_mode!="Echo") {
- ui->decodedTextBrowser2->displayTransmittedText(m_currentMessage.trimmed(),m_mode,
- ui->TxFreqSpinBox->value(),m_bFastMode,m_TRperiod,m_config.superFox());
- }
- }
-
- auto t2 = QDateTime::currentDateTimeUtc ().toString ("hhmm");
- icw[0] = 0;
- auto msg_parts = m_currentMessage.split (' ', SkipEmptyParts);
- if (msg_parts.size () > 2) {
- // clean up short code forms
- msg_parts[0].remove (QChar {'<'});
- msg_parts[0].remove (QChar {'>'});
- msg_parts[1].remove (QChar {'<'});
- msg_parts[1].remove (QChar {'>'});
- }
- auto is_73 = message_is_73 (m_currentMessageType, msg_parts);
- m_sentFirst73 = is_73
- && !message_is_73 (m_lastMessageType, m_lastMessageSent.split (' ', SkipEmptyParts));
- if (m_sentFirst73 || (is_73 && CALLING == m_QSOProgress)) {
- m_qsoStop=t2;
- if(m_config.id_after_73 ()) {
- icw[0] = m_ncw;
- }
- if((m_config.prompt_to_log() or m_config.autoLog()) && !m_tune && CALLING != m_QSOProgress)
- {
- // always stop Tx after sending 73
- if (m_config.repeat_Tx() && (m_mode=="MSK144" or m_mode=="Q65") && m_ntx != 4) cease_auto_Tx_after_QSO ();
- if (!(m_mode=="FT4" && SpecOp::NA_VHF==m_specOp && m_config.NCCC_Sprint())) logQSOTimer.start(0);
- }
- else
- {
- cease_auto_Tx_after_QSO ();
- }
- }
-
- bool b=("FT8"==m_mode or "FT4"==m_mode or "Q65"==m_mode or "JT65"==m_mode or "JT9"==m_mode) and ui->cbAutoSeq->isVisible ()
- && ui->cbAutoSeq->isEnabled () && ui->cbAutoSeq->isChecked ();
- if(is_73 and (m_config.disable_TX_on_73() or b)) {
- m_nextCall=""; //### Temporary: disable use of "TU;" messages;
- if(m_nextCall!="") {
- useNextCall();
- } else {
- if(m_config.repeat_Tx() && (m_mode=="MSK144" or m_mode=="Q65")) {
- stopWRTimer.start(int(20000.0*m_TRperiod)); // send RR73 up to 10 times
- } else {
- auto_tx_mode (false);
- if(b) {
- m_ntx=6;
- ui->txrb6->setChecked(true);
- m_QSOProgress = CALLING;
- }
- }
- }
- }
-
- if(m_config.id_interval () >0) {
- int nmin=(m_sec0-m_secID)/60;
- if(m_sec0<m_secID) nmin=m_config.id_interval();
- if(nmin >= m_config.id_interval()) {
- icw[0]=m_ncw;
- m_secID=m_sec0;
- }
- }
-
- if ((m_currentMessageType < 6 || 7 == m_currentMessageType)
- && msg_parts.length() >= 3
- && (msg_parts[1] == m_config.my_callsign () ||
- msg_parts[1] == m_baseCall))
- {
- int i1;
- bool ok;
- i1 = msg_parts[2].toInt(&ok);
- if(ok and i1>=-50 and i1<50)
- {
- m_rptSent = msg_parts[2];
- m_qsoStart = t2;
- } else {
- if (msg_parts[2].mid (0, 1) == "R")
- {
- i1 = msg_parts[2].mid (1).toInt (&ok);
- if (ok and i1 >= -50 and i1 < 50)
- {
- m_rptSent = msg_parts[2].mid (1);
- m_qsoStart = t2;
- }
- }
- }
- }
- m_restart=false;
-//----------------------------------------------------------------------
- } else {
- if (!m_auto && m_sentFirst73) {
- m_sentFirst73 = false;
- }
- }
-
- if (g_iptt == 1 && m_iptt0 == 0) {
- auto const& current_message = QString::fromLatin1 (msgsent);
- if(m_config.watchdog () && m_mode!="WSPR" && m_mode!="FST4W"
- && current_message != m_msgSent0) {
- tx_watchdog (false); // in case we are auto sequencing
- m_msgSent0 = current_message;
- }
-
- if (m_mode != "FST4W" && m_mode != "WSPR" && m_mode!="Echo")
- {
- if(!m_tune) write_all("Tx",m_currentMessage);
- if (m_config.TX_messages () && !m_tune && SpecOp::FOX!=m_specOp)
- {
- ui->decodedTextBrowser2->displayTransmittedText(current_message.trimmed(),
- m_mode,ui->TxFreqSpinBox->value(),m_bFastMode,m_TRperiod,m_config.superFox());
- }
- }
-
- switch (m_ntx)
- {
- case 1: m_QSOProgress = REPLYING; break;
- case 2: m_QSOProgress = REPORT; break;
- case 3: m_QSOProgress = ROGER_REPORT; break;
- case 4: m_QSOProgress = ROGERS; break;
- case 5: m_QSOProgress = SIGNOFF; break;
- case 6: m_QSOProgress = CALLING; break;
- default: break; // determined elsewhere
- }
- m_transmitting = true;
- transmitDisplay (true);
- statusUpdate ();
- }
-
- if(!m_btxok && m_btxok0 && g_iptt==1) {
- stopTx();
- if ("1" == m_env.value ("WSJT_TX_BOTH", "0")) {
- m_txFirst = !m_txFirst;
- ui->txFirstCheckBox->setChecked (m_txFirst);
- }
- }
-
- if(m_startAnother) {
- if(m_mode=="MSK144") {
- m_wait++;
- }
- if(m_mode!="MSK144" or m_wait>=4) {
- m_wait=0;
- m_startAnother=false;
- on_actionOpen_next_in_directory_triggered();
- }
- }
-
- if(m_mode=="FT8" or m_mode=="MSK144" or m_mode=="FT4" or m_mode=="Q65") {
- if(ui->txrb1->isEnabled() and
- (SpecOp::NA_VHF==m_specOp or
- SpecOp::FIELD_DAY==m_specOp or
- SpecOp::RTTY==m_specOp or
- SpecOp::WW_DIGI==m_specOp or
- SpecOp::ARRL_DIGI==m_specOp or
- SpecOp::Q65_PILEUP==m_specOp)) {
- //We're in a contest-like mode other than EU_VHF: start QSO with Tx2.
- ui->tx1->setEnabled(false);
- ui->txb1->setEnabled(false);
- }
- if(!ui->tx1->isEnabled() and SpecOp::EU_VHF==m_specOp) {
- //We're in EU_VHF mode: start QSO with Tx1.
- ui->tx1->setEnabled(true);
- ui->txb1->setEnabled(true);
- }
- }
- if(m_mode=="Echo" and !m_monitoring and !m_auto and !m_diskData) m_echoRunning=false;
-
- if(m_mode=="Q65") {
- mem_qmap.lock();
- int n=0;
- if(m_decoderBusy) n=1;
- ipc_qmap[3]=n;
- n=0;
- if(m_transmitting) n=m_TRperiod;
- ipc_qmap[4]=n;
- if(ipc_qmap[0] > 0) { //ndecodes
- memcpy(&qmapcom, (char*)ipc_qmap, sizeof(qmapcom)); //Fetch the new decode(s)
- readWidebandDecodes();
- }
- if(ipc_qmap[5]>0) {
- setRig((m_freqNominal/1000000)*1000000 + 1000*ipc_qmap[5]);
- ipc_qmap[5]=0;
- }
- mem_qmap.unlock();
- }
-
-//Once per second (onesec)
- if(nsec != m_sec0) {
-
- // reset earlyDecodes for 2-stage or 3-stage decoding
- if (m_mode=="FT8" && !m_diskData && m_multithreadFT8 && m_ft8DecoderStart<2) {
- QDateTime now = QDateTime::currentDateTimeUtc();
- int s = now.time().toString("ss").toInt();
- if (m_ft8DecoderStart<2) {
- if ((s == 7 || s == 22 ||s == 37 || s == 52) && m_decoderBusy) {
- to_jt9(m_ihsym,-1,-1); //Allow jt9 to bail out early, if necessary
- decodeDone(); //We better clear a hung decoder status at this point
- }
- if (s == 10 || s == 25 ||s == 40 || s == 55) earlyDecodes = "";
- }
- }
-
- // reset blank line for MSK144
- if (m_mode=="MSK144") {
- QDateTime now = QDateTime::currentDateTimeUtc();
- int s = now.time().toString("ss").toInt();
- if ((m_TRperiod==5 && (s==0 || s==5 || s==10 || s==15 || s==20 || s==25 || s==30 || s==35 || s==40 || s==45 || s==50 || s==55))
- or (m_TRperiod==10 && (s==0 || s==10 || s==20 || s==30 || s==40 || s==50))
- or (m_TRperiod==15 && (s==0 || s==15 || s==30 || s==45))
- or (m_TRperiod==30 && (s==0 || s==30))) {
- BlankLineInserted = false;
- m_dateTimeSeqStart = qt_truncate_date_time_to (QDateTime::currentDateTimeUtc (), m_TRperiod * 1.e3);
- }
- }
-
- if (m_tune && m_config.tune_watchdog() && !(m_mode=="WSPR" || m_mode=="FST4W")) {
- QString remtime;
- remtime = QString::asprintf("%.0f s",tuneATU_Timer.remainingTime()/1000.0);
- ui->tuneButton->setText(remtime); // display Tune watchdog countdog
- }
-
- // prevent tuning on top of a SuperFox message
- if (SpecOp::HOUND==m_specOp && m_config.superFox() && m_tune) {
- QDateTime now = QDateTime::currentDateTimeUtc();
- int s = now.time().toString("ss").toInt();
- if ((s >= 0 && s < 15) || (s >= 30 && s < 45)) ui->tuneButton->click ();
- }
-
- if(m_mode=="FST4") chk_FST4_freq_range();
- m_currentBand=m_config.bands()->find(m_freqNominal);
- if( SpecOp::HOUND == m_specOp ) {
- qint32 tHound=QDateTime::currentMSecsSinceEpoch()/1000 - m_tAutoOn;
- //To keep calling Fox, Hound must reactivate Enable Tx at least once every 2 minutes
- if(m_ntx==1 and m_auto) {
- if(tHound >= 180 and tHound < 240 and watchdog_label.text() != " WD:1m ") {
- watchdog_label.setText (" HWD:2m ");
- }
- if(tHound >= 240 and tHound < 300) {
- watchdog_label.setStyleSheet ("QLabel{color: #000000; background-color: #ffff00}");
- watchdog_label.setText (" HWD:1m ");
- }
- if(tHound >= 300) {
- auto_tx_mode(false);
- statusUpdate ();
- watchdog_label.setStyleSheet ("QLabel{color: #ffffff; background-color: #ff0000}");
- watchdog_label.setText (" HWD:0m ");
- }
- }
- }
-
- progressBar.setVisible(true);
- // turn the progressbar red during transmission
- if(m_config.progressBar_red()) {
- if(m_transmitting) {
- if (m_useDarkStyle) {
- progressBar.setStyleSheet(QString("QProgressBar {color: #ffffff; text-align: center;} QProgressBar::chunk {background-color: #ff0000;}"));
- progressBar.setFormat ("%v/%m");
- } else {
-#ifdef WIN32
- if(m_TRperiod > 99) {
- progressBar.setStyleSheet(QString("QProgressBar {color: #000000; text-align: right; margin-right: 4em;} QProgressBar::chunk {background-color: #ff0000;}"));
- progressBar.setFormat ("%v/%m ");
- } else {
- progressBar.setStyleSheet(QString("QProgressBar {color: #000000; text-align: right; margin-right: 3em;} QProgressBar::chunk {background-color: #ff0000;}"));
- progressBar.setFormat ("%v/%m ");
- }
-#else
- progressBar.setStyleSheet(QString("QProgressBar {color: #000000; text-align: center;} QProgressBar::chunk {background-color: #ff4141;}"));
- progressBar.setFormat ("%v/%m");
-#endif
- }
- } else {
- progressBar.setStyleSheet("");
- progressBar.setFormat ("%v/%m");
- }
- } else {
- progressBar.setStyleSheet("");
- progressBar.setFormat ("%v/%m");
- }
- if(m_mode=="Echo") {
- progressBar.setMaximum(3);
- int n=0;
- if(m_transmitting or m_monitoring) n=int(m_s6)%3;
- progressBar.setValue(n);
- }
- if(m_mode!="Echo") {
- if(m_monitoring or m_transmitting) {
- progressBar.setMaximum(m_TRperiod);
- int isec=int(fmod(tsec,m_TRperiod));
- if(m_TRperiod-int(m_TRperiod)>0.0) {
- QString progBarLabel;
- progBarLabel = progBarLabel.asprintf("%d/%3.1f",isec,m_TRperiod);
- progressBar.setFormat (progBarLabel);
- }
- progressBar.setValue(isec);
- } else {
- progressBar.setValue(0);
- }
- }
-
- astroUpdate ();
-
- if(m_transmitting) {
- char s[42];
- if(SpecOp::FOX==m_specOp and ui->tabWidget->currentIndex()==1) {
- snprintf(s,sizeof(s),"Tx: %d Slots",foxcom_.nslots);
- } else {
- snprintf(s,sizeof(s),"Tx: %s",msgsent);
- }
- m_nsendingsh=0;
- if(s[4]==64) m_nsendingsh=1;
- if(m_nsendingsh==1 or m_currentMessageType==7) {
- tx_status_label.setStyleSheet("QLabel{color: #000000; background-color: #66ffff}");
- } else if(m_nsendingsh==-1 or m_currentMessageType==6) {
- tx_status_label.setStyleSheet("QLabel{color: #000000; background-color: #ffccff}");
- } else {
- tx_status_label.setStyleSheet("QLabel{color: #000000; background-color: #ffff33}");
- }
- if(m_tune) {
- tx_status_label.setText("Tx: TUNE");
- } else {
- if(m_mode=="Echo") {
- tx_status_label.setText("Tx: ECHO");
- } else {
- s[40]=0;
- QString t{QString::fromLatin1(s)};
- if(SpecOp::FOX==m_specOp and ui->tabWidget->currentIndex()==1 and foxcom_.nslots==1) {
- t=m_fm1.trimmed();
- }
- if(m_mode=="FT4") t="Tx: "+ m_currentMessage;
- tx_status_label.setText(t.trimmed());
- }
- }
- } else if(m_monitoring) {
- if (!m_tx_watchdog) {
- tx_status_label.setStyleSheet("QLabel{color: #000000; background-color: #00ff00}");
- auto t = tr ("Receiving");
- // switching tx_status_label text and color when filters are enabled
- if (((SpecOp::NONE==m_specOp or SpecOp::HOUND==m_specOp) && !m_config.filters_for_Wait_and_Pounce_only() &&
- (m_config.Blacklisted () or m_config.Whitelisted ())) or (ui->cbCQonly->isChecked() && ui->cbCQonly->isVisible())
- or ui->actionHideToday->isChecked() or ui->actionHideIgnored->isChecked()
- or ui->actionHideTerritory1->isChecked() or ui->actionHideTerritory2->isChecked()
- or ui->actionHideTerritory3->isChecked() or ui->actionHideTerritory4->isChecked()
- or ui->actionHideB4->isChecked() or ui->actionHideEU->isChecked() or ui->actionHideAS->isChecked()
- or ui->actionHideNA->isChecked() or ui->actionHideSA->isChecked() or ui->actionHideAF->isChecked()
- or ui->actionHideOC->isChecked() or ui->actionHideAN->isChecked()) {
- tx_status_label.setMinimumSize (QSize {120, 18});
- if (ui->cbBypass->isChecked()) {
- if (ui->cbCQonly->isChecked()) {
- tx_status_label.setStyleSheet ("QLabel{color: #000000; background-color: #00ffff}");
- t = " Receiving, Filters On ";
- } else {
- tx_status_label.setStyleSheet ("QLabel{color: #000000; background-color: #00ff00}");
- t = " Receiving, Filters bypassed ";
- }
- } else {
- tx_status_label.setStyleSheet ("QLabel{color: #000000; background-color: #00ffff}");
- t = " Receiving, Filters On ";
- }
- } else {
- tx_status_label.setMinimumSize (QSize {100, 18});
- tx_status_label.setStyleSheet ("QLabel{color: #000000; background-color: #00ff00}");
- }
- if(m_mode=="MSK144") {
- int npct=int(100.0*m_fCPUmskrtd/0.298667);
- if(npct>90) tx_status_label.setStyleSheet("QLabel{color: #000000; background-color: #ff0000}");
- t += QString {" %1%"}.arg (npct, 2);
- }
- tx_status_label.setText (t);
- }
- transmitDisplay(false);
- } else if (!m_diskData && !m_tx_watchdog) {
- tx_status_label.setStyleSheet("");
- tx_status_label.setText("");
- }
-
- QDateTime t = QDateTime::currentDateTimeUtc();
- QString utc = t.date().toString("yyyy MMM dd") + "\n " +
- t.time().toString() + " ";
-// QString utc = t.time().toString(); // UR for AL version use this and disable the 2 lines above
- ui->labUTC->setText(utc);
- if(m_bBestSPArmed and (m_dateTimeBestSP.secsTo(t) >= 120)) on_pbBestSP_clicked(); //BestSP timeout
- if(!m_monitoring and !m_diskData) ui->signal_meter_widget->setValue(0,0);
- m_sec0=nsec;
- displayDialFrequency ();
- }
- m_iptt0=g_iptt;
- m_btxok0=m_btxok;
-
- if(m_tci_audio) {
- Q_EMIT m_config.transceiver_volume(m_config.volume());
- }
-
- if (m_config.highlight_73()) {
- ui->cbCQonly->setText("CQ/73");
- ui->cbCQonly->setToolTip("CQ or 73 messages only.");
- } else {
- ui->cbCQonly->setText("CQ only");
- ui->cbCQonly->setToolTip("CQ messages only.");
- }
- check_button_color();
-
-} //End of guiUpdate
-
-void MainWindow::useNextCall()
-{
- ui->dxCallEntry->setText(m_nextCall);
- m_nextCall="";
- if(m_nextGrid.contains(grid_regexp)) {
- ui->dxGridEntry->setText(m_nextGrid);
- m_ntx=2;
- ui->txrb2->setChecked(true);
- } else {
- m_ntx=3;
- ui->txrb3->setChecked(true);
- }
- genStdMsgs(m_nextRpt);
-}
-
-void MainWindow::startTx2()
-{
- bool modulator_active;
- bool tci_active = m_tci_audio;
- if (tci_active) modulator_active=m_tci_mod_active;
- else modulator_active=m_modulator->isActive ();
- if (!modulator_active) { // TODO - not thread safe
- double fSpread=0.0;
- double snr=99.0;
- QString t=ui->tx5->currentText();
- if(t.mid(0,1)=="#") fSpread=t.mid(1,5).toDouble();
- if (tci_active) Q_EMIT m_config.transceiver_spread(fSpread);
- else m_modulator->setSpread(fSpread); // TODO - not thread safe
- t=ui->tx6->text();
- if(t.mid(0,1)=="#") snr=t.mid(1,5).toDouble();
- if(snr>0.0 or snr < -50.0) snr=99.0;
- if((m_ntx==6 or m_ntx==7) and m_config.force_call_1st() and
- ui->respondComboBox->currentIndex()==0) {
- ui->cbAutoSeq->setChecked(true);
- ui->respondComboBox->setCurrentIndex(1);
- }
- transmit (snr);
- ui->signal_meter_widget->setValue(0,0);
- if(m_mode=="Echo" and !m_tune) m_bTransmittedEcho=true;
-
- if((m_mode=="WSPR" or m_mode=="FST4W") and !m_tune) {
- if (m_config.TX_messages ()) {
- t = " Transmitting " + m_mode + " ----------------------- " +
- m_config.bands ()->find (m_freqNominal);
- t=beacon_start_time (m_TRperiod / 2) + ' ' + t.rightJustified (66, '-');
- ui->decodedTextBrowser->insertText(t);
- }
- write_all("Tx",m_currentMessage);
- if(m_position != 0) ui->decodedTextBrowser->horizontalScrollBar()->setValue(m_position);
- }
- }
-}
-
-void MainWindow::stopTx()
-{
- if (m_tci_audio) Q_EMIT m_config.transceiver_modulator_stop();
- else Q_EMIT endTransmitMessage ();
- m_btxok = false;
- m_transmitting = false;
- g_iptt=0;
- if (!m_tx_watchdog) {
- tx_status_label.setStyleSheet("");
- tx_status_label.setText("");
- }
- if (m_tci_audio) {
- ptt0Timer.start(0);
- } else {
- ptt0Timer.start(200); //end-of-transmission sequencer delay
- monitor (true);
- statusUpdate ();
- }
-}
-
-void MainWindow::stopTx2()
-{
- if (m_tci_audio) {
- Q_EMIT m_config.transceiver_ptt (false); //Lower PTT
- monitor (true);
- statusUpdate ();
- } else {
- m_config.transceiver_ptt (false); //Lower PTT
- }
- if (m_mode == "JT9" && m_bFast9
- && ui->cbAutoSeq->isVisible () && ui->cbAutoSeq->isEnabled () && ui->cbAutoSeq->isChecked ()
- && m_ntx == 5 && m_nTx73 >= 5) {
- on_stopTxButton_clicked ();
- m_nTx73 = 0;
- }
- if(((m_mode=="WSPR" or m_mode=="FST4W") and m_ntr==-1) and !m_tuneup) {
- m_wideGraph->setWSPRtransmitted();
- WSPR_scheduling ();
- m_ntr=0;
- }
- keep_last_tx_label = true;
- last_tx_label.setText(tr ("Last Tx: %1").arg (m_currentMessage.trimmed()));
-}
-
-void MainWindow::ba2msg(QByteArray ba, char message[]) //ba2msg()
-{
- int iz=ba.length();
- for(int i=0; i<37; i++) {
- if(i<iz) {
- if(int(ba[i])>=97 and int(ba[i])<=122) ba[i]=int(ba[i])-32;
- message[i]=ba[i];
- } else {
- message[i]=32;
- }
- }
- message[37]=0;
-}
-
-void MainWindow::on_txFirstCheckBox_stateChanged(int nstate) //TxFirst
-{
- m_txFirst = (nstate==2);
-}
-
-void MainWindow::set_dateTimeQSO(int m_ntx)
-{
- // m_ntx = -1 resets to default time
- // Our QSO start time can be fairly well determined from Tx 2 and Tx 3 -- the grid reports
- // If we CQ'd and sending sigrpt then 2 minutes ago n=2
- // If we're on msg 3 then 3 minutes ago n=3 -- might have sat on msg1 for a while
- // If we've already set our time on just return.
- // This should mean that Tx2 or Tx3 has been repeated so don't update the start time
- // We reset it in several places
- if (m_ntx == -1) { // we use a default date to detect change
- m_dateTimeQSOOn = QDateTime {};
- }
- else if (m_dateTimeQSOOn.isValid ()) {
- return;
- }
- else { // we also take of m_TRperiod/2 to allow for late clicks
- auto now = QDateTime::currentDateTimeUtc();
- m_dateTimeQSOOn = now.addSecs (-(m_ntx - 2) * int(m_TRperiod) -
- int(fmod(double(now.time().second()),m_TRperiod)));
- }
-}
-
-void MainWindow::set_ntx(int n) //set_ntx()
-{
- m_ntx=n;
-}
-
-void MainWindow::on_txrb1_toggled (bool status)
-{
- if (status) {
- if (ui->tx1->isEnabled ()) {
- m_ntx = 1;
- set_dateTimeQSO (-1); // we reset here as tx2/tx3 is used for start times
- }
- else {
- QTimer::singleShot (0, ui->txrb2, SLOT (click ()));
- }
- }
-}
-
-bool MainWindow::elide_tx1_not_allowed () const
-{
- auto const& my_callsign = m_config.my_callsign ();
- return
- (m_mode=="FT8" && SpecOp::HOUND == m_specOp)
- || ((m_mode.startsWith ("FT") || "MSK144" == m_mode || "Q65" == m_mode || "FST4" == m_mode)
- && Radio::is_77bit_nonstandard_callsign (my_callsign))
- || (my_callsign != m_baseCall && !shortList (my_callsign));
-}
-
-void MainWindow::on_txrb1_doubleClicked ()
-{
- ui->tx1->setEnabled (elide_tx1_not_allowed () || !ui->tx1->isEnabled ());
- if (!ui->tx1->isEnabled ()) {
- // leave time for clicks to complete before setting txrb2
- QTimer::singleShot (500, ui->txrb2, SLOT (click ()));
- }
-}
-
-void MainWindow::on_txrb2_toggled (bool status)
-{
- // Tx 2 means we already have CQ'd so good reference
- if (status) {
- m_ntx=2;
- set_dateTimeQSO (m_ntx);
- }
-}
-
-void MainWindow::on_txrb3_toggled(bool status)
-{
- // Tx 3 means we should have already have done Tx 1 so good reference
- if (status) {
- m_ntx=3;
- set_dateTimeQSO(m_ntx);
- }
-}
-
-void MainWindow::on_txrb4_toggled (bool status)
-{
- if (status) {
- m_ntx=4;
- }
-}
-
-void MainWindow::on_txrb4_doubleClicked ()
-{
- // RR73 only allowed if not a type 2 compound callsign
- auto const& my_callsign = m_config.my_callsign ();
- auto is_compound = my_callsign != m_baseCall;
- m_send_RR73 = !((is_compound && !shortList (my_callsign)) || m_send_RR73);
- if(m_mode=="FT4") m_send_RR73=true;
- genStdMsgs (m_rpt);
-}
-
-void MainWindow::on_txrb5_toggled (bool status)
-{
- if (status) {
- m_ntx = 5;
- }
-}
-
-void MainWindow::on_txrb5_doubleClicked ()
-{
- genStdMsgs (m_rpt, true);
-}
-
-void MainWindow::on_txrb6_toggled(bool status)
-{
- if (status) {
- m_ntx=6;
- if (ui->txrb6->text().contains (QRegularExpression {"^(CQ|QRZ) "})) set_dateTimeQSO(-1);
- }
- if(m_mode=="MSK144" && !keep_msk144_frequency && m_msk144basefreq > 0) {
- setRig(m_msk144basefreq); // reset MSK144 QSY
- msk144qsy = false;
- }
-}
-
-void MainWindow::on_txb1_clicked()
-{
- if (ui->tx1->isEnabled ()) {
- m_ntx=1;
- m_QSOProgress = REPLYING;
- ui->txrb1->setChecked(true);
- if(m_transmitting) m_restart=true;
- }
- else {
- on_txb2_clicked ();
- }
-}
-
-void MainWindow::on_txb1_doubleClicked()
-{
- ui->tx1->setEnabled (elide_tx1_not_allowed () || !ui->tx1->isEnabled ());
-}
-
-void MainWindow::on_txb2_clicked()
-{
- m_ntx=2;
- m_QSOProgress = REPORT;
- ui->txrb2->setChecked(true);
- if(m_transmitting) m_restart=true;
-}
-
-void MainWindow::on_txb3_clicked()
-{
- m_ntx=3;
- m_QSOProgress = ROGER_REPORT;
- ui->txrb3->setChecked(true);
- if(m_transmitting) m_restart=true;
-}
-
-void MainWindow::on_txb4_clicked()
-{
- m_ntx=4;
- m_QSOProgress = ROGERS;
- ui->txrb4->setChecked(true);
- if(m_transmitting) m_restart=true;
-}
-
-void MainWindow::on_txb4_doubleClicked()
-{
- // RR73 only allowed if not a type 2 compound callsign
- auto const& my_callsign = m_config.my_callsign ();
- auto is_compound = my_callsign != m_baseCall;
- m_send_RR73 = !((is_compound && !shortList (my_callsign)) || m_send_RR73);
- if(m_mode=="FT4") m_send_RR73=true;
- genStdMsgs (m_rpt);
-}
-
-void MainWindow::on_txb5_clicked()
-{
- m_ntx=5;
- m_QSOProgress = SIGNOFF;
- ui->txrb5->setChecked(true);
- if(m_transmitting) m_restart=true;
-}
-
-void MainWindow::on_txb5_doubleClicked()
-{
- genStdMsgs (m_rpt, true);
-}
-
-void MainWindow::on_txb6_clicked()
-{
- m_ntx=6;
- m_QSOProgress = CALLING;
- set_dateTimeQSO(-1);
- ui->txrb6->setChecked(true);
- if(m_transmitting) m_restart=true;
- if(m_mode=="MSK144" && !keep_msk144_frequency && m_msk144basefreq > 0) {
- setRig(m_msk144basefreq); // reset MSK144 QSY
- msk144qsy = false;
- }
-}
-
-void MainWindow::doubleClickOnCall2(Qt::KeyboardModifiers modifiers)
-{
-//Confusing: come here after double-click on left text window, not right window.
- m_decodedText2=true;
- doubleClickOnCall(modifiers);
- m_decodedText2=false;
-}
-
-void MainWindow::doubleClickOnCall(Qt::KeyboardModifiers modifiers)
-{
- m_bMyCallStd=stdCall(m_config.my_callsign()); //ft8md
- m_bHisCallStd=stdCall(m_hisCall); //ft8md
- set_dateTimeQSO(-1); // reset our QSO start time
- QTextCursor cursor;
- if(m_mode=="FST4W") {
- MessageBox::information_message (this,
- "Double-click not available for FST4W mode");
- return;
- }
- if(m_decodedText2) {
- cursor=ui->decodedTextBrowser->textCursor();
- } else {
- cursor=ui->decodedTextBrowser2->textCursor();
- }
- DecodedText message {cursor.block().text().trimmed().left(61).remove("TU; ")};
- if(SpecOp::HOUND==m_specOp && (message.string().mid(4,2).contains("15") or message.string().mid(4,2).contains("45"))) return; // ignore stations calling in the wrong time slot
-// if(message.string().contains(";") && message.string().contains("<")) {
-// QVector<qint32> Freq = {1840000,3573000,7074000,10136000,14074000,18100000,21074000,24915000,28074000,50313000,70154000,3575000,7047500,10140000,14080000,18104000,21140000,24919000,28180000,50318000};
-// for(int i=0; i<Freq.length()-1; i++) {
-// int kHzdiff=m_freqNominal - Freq[i];
-// if(qAbs(kHzdiff) < 3000 ) {
-// m_bTxTime=false;
-// if (m_auto) auto_tx_mode (false);
-// if (m_tune) stop_tuning();
-// auto const& msg2 = tr("Double-clicking on combined messages\n"
-// "not allowed on the standard sub-bands.");
-// QTimer::singleShot (0, [=] { // don't block guiUpdate
-// MessageBox::warning_message (this, tr ("Potential hash collision"), msg2);
-// });
-// return;
-// }
-// }
-// }
- if(modifiers==(Qt::ShiftModifier + Qt::ControlModifier + Qt::AltModifier)) {
- //### What was the purpose of this ??? ###
- cursor.setPosition(0);
- } else {
- cursor.setPosition(cursor.selectionStart());
- }
- if(SpecOp::FOX==m_specOp and m_decodedText2) {
- if(m_houndQueue.count()<10 and m_nSortedHounds>0) {
- QString t=cursor.block().text();
- selectHound(t, modifiers==(Qt::AltModifier)); // alt double-click gets put at top of queue
- }
- return;
- }
- int nmod = fmod(double(message.timeInSeconds()),2.0*m_TRperiod);
- if(ui->txFirstCheckBox->isVisible() && !ui->txFirstCheckBox->isEnabled() && (
- (nmod!=0 && !ui->txFirstCheckBox->isChecked()) or
- (nmod==0 && ui->txFirstCheckBox->isChecked()))) {
- auto const& msg = tr("This station transmits in the same time slot as you do.\n\n"
- "You must not start a QSO if both stations Tx even/1st\n"
- "or Tx odd/2nd, while the Tx even/1st checkbox is disabled.\n\n"
- "Click the MSK144 mode button to re-enable the Tx even/1st\n"
- "checkbox, or choose another station.");
- if(m_mode=="MSK144") MessageBox::warning_message (this, msg);
- return; // don't allow a QSO when both stations Tx 1st or Tx 2nd, and the Tx 1st checkbox is frozen
- } else {
- m_muted = true; // Don't play alert sounds again
- m_bDoubleClicked = true;
- m_hisCall0 = m_hisCall;
- processMessage (message, modifiers);
- // pressing ALT while double-clicking on a call only adds the callsign to DX Call Box
- if(SpecOp::FOX!=m_specOp && modifiers==Qt::AltModifier) {
- m_bDoubleClicked = false;
- if (m_auto) auto_tx_mode (false);
- }
- // MSK144 QSY: set RF freq so next received MSK144 signal is at 1500 Hz
- if(m_mode=="MSK144" && message.frequencyOffset() > 0 && (modifiers==Qt::ControlModifier or modifiers==(Qt::ControlModifier+Qt::AltModifier))) {
- Frequency dial_frequency = m_msk144basefreq + (message.frequencyOffset() - 1500);
- keep_msk144_frequency = true;
- monitor (true);
- setRig(dial_frequency);
- ui->labDialFreq->setText (Radio::pretty_frequency_MHz_string (dial_frequency));
- msk144qsy = true;
- if(modifiers==Qt::AltModifier or modifiers==(Qt::ControlModifier+Qt::AltModifier)) {
- m_bDoubleClicked = false;
- if (m_auto) auto_tx_mode (false);
- }
- keep_msk144_frequency = false;
- }
- m_muted = false;
- }
-}
-
-void MainWindow::processMessage (DecodedText const& message, Qt::KeyboardModifiers modifiers)
-{
- // decode keyboard modifiers we are interested in
- auto shift = modifiers.testFlag (Qt::ShiftModifier);
- auto ctrl = modifiers.testFlag (Qt::ControlModifier);
- auto auto_seq = ui->cbAutoSeq->isVisible () && ui->cbAutoSeq->isEnabled () && ui->cbAutoSeq->isChecked ();
- // basic mode sanity checks
- auto const& parts = message.clean_string ().split (' ', SkipEmptyParts);
- if (parts.size () < 5) return;
-
- auto const& mode = parts.at (4).left (1);
- if (("JT65" == m_mode && mode != "#")
- || ("JT9" == m_mode && mode != "@")
- || ("MSK144" == m_mode && !("&" == mode || "^" == mode))
- || ("Q65" == m_mode && mode.left (1) != ":")) {
- return; //Currently we do auto-sequencing only in FT4, FT8, MSK144, FST4, and Q65
- }
-
- //Skip the rest if no decoded text extracted
- int frequency = message.frequencyOffset();
- if (message.isTX()) {
- if (!m_config.enable_VHF_features()) {
- if(!shift) ui->RxFreqSpinBox->setValue(frequency); //Set Rx freq
- if((ctrl or shift) and !ui->cbHoldTxFreq->isChecked ()) {
- ui->TxFreqSpinBox->setValue(frequency); //Set Tx freq
- }
- }
- return;
- }
-
- // check for CQ with listening frequency
- if (parts.size () >= 7
- && m_bFastMode
- && "CQ" == parts[5]
- && m_config.is_transceiver_online ()) {
- bool ok;
- auto kHz = parts[6].toUInt (&ok);
- if (ok && kHz >= 10 && 3 == parts[6].size ()) {
- // QSY Freq for answering CQ nnn
- setRig (m_freqNominal / 1000000 * 1000000 + 1000 * kHz);
- ui->decodedTextBrowser2->displayQSY (QString {"QSY %1"}.arg (m_freqNominal / 1e6, 7, 'f', 3));
- if(m_mode=="MSK144") m_msk144basefreq = m_freqNominal / 1000000 * 1000000 + 1000 * kHz; // MSK144 QSY
- }
- }
-
- int nmod = fmod(double(message.timeInSeconds()),2.0*m_TRperiod);
- m_txFirst=(nmod!=0);
- if(SpecOp::HOUND == m_specOp) m_txFirst=false; //Hound must not transmit first
- if(SpecOp::FOX == m_specOp) m_txFirst=true; //Fox must always transmit first
- ui->txFirstCheckBox->setChecked(m_txFirst);
-
- auto const& message_words = message.messageWords ();
- if (message_words.size () < 3) return;
-
- QString hiscall;
- QString hisgrid;
- message.deCallAndGrid(/*out*/hiscall,hisgrid);
-
- // prevent starting a QSO with yourself
- if (m_bDoubleClicked && hiscall==m_baseCall) return;
-
- // don't call CQ when double-clicking on the final "73" message of your QSO
- if (m_bDoubleClicked && message.clean_string().remove("<").remove(">").contains((" " + m_baseCall + " "))
- && message.clean_string().remove("<").remove(">").contains(" " + hiscall + " ") && message.clean_string().mid(22).contains(" 73")) return;
-
- if(message.clean_string ().contains(hiscall+"/R")) {
- hiscall+="/R";
- ui->dxCallEntry->setText(hiscall);
- }
- if(message.clean_string ().contains(hiscall+"/P")) {
- hiscall+="/P";
- ui->dxCallEntry->setText(hiscall);
- }
-
- QStringList w=message.clean_string ().mid(22).remove("<").remove(">").split(" ",SkipEmptyParts);
- int nw=w.size();
- if(nw>=4) {
- if(message_words.size()<4) return;
- int n=w.at(nw-2).toInt();
- if(n>=520001 and n<=592047) {
- hiscall=w.at(1);
- hisgrid=w.at(nw-1);
- }
- }
-
- bool is_73 = message_words.filter (QRegularExpression {"^(73|RR73)$"}).size ();
- if (!is_73 and !message.isStandardMessage() and !message.clean_string ().contains("<")) {
- qDebug () << "Not processing message - hiscall:" << hiscall << "hisgrid:" << hisgrid
- << message.clean_string () << message.isStandardMessage();
- return;
- }
-
- if ((message.isJT9 () and m_mode != "JT9" and m_mode != "JT4") or
- (message.isJT65 () and m_mode != "JT65" and m_mode != "JT4")) {
- // We are not allowing mode change, so don't process decode
- return;
- }
-
- // ignore calls by other hounds
- if (SpecOp::HOUND == m_specOp
- && message.messageWords ().indexOf (QRegularExpression {R"(R\+-[0-9]+)"}) >= 1)
- {
- return;
- }
-
- QString firstcall = message.call();
- if(firstcall.length()>=4 and firstcall.mid(0,3)=="CQ ") firstcall="CQ";
- if(!m_bFastMode and (!m_config.enable_VHF_features() or m_mode=="FT8" or m_mode=="FT4" or m_mode=="FST4")) {
- // Don't change Tx freq if in a fast mode, or VHF features enabled; also not if a
- // station is calling me, unless CTRL or SHIFT is held down.
- if ((Radio::is_callsign (firstcall)
- && firstcall != m_config.my_callsign () && firstcall != m_baseCall
- && firstcall != "DE")
- || "CQ" == firstcall || "QRZ" == firstcall || ctrl || shift) {
- if (((SpecOp::HOUND != m_specOp) || m_mode != "FT8")
- && (!ui->cbHoldTxFreq->isChecked () || shift || ctrl)) {
- ui->TxFreqSpinBox->setValue(frequency);
- }
- if(m_mode != "JT4" && m_mode != "JT65" && !m_mode.startsWith ("JT9") &&
- m_mode != "Q65" && m_mode!="FT8" && m_mode!="FT4" && m_mode!="FST4") {
- return;
- }
- }
- }
-
- // prior DX call (possible QSO partner)
- auto qso_partner_base_call = Radio::base_callsign (ui->dxCallEntry->text ());
- auto base_call = Radio::base_callsign (hiscall);
-
-// Determine appropriate response to received message
- auto dtext = " " + message.clean_string () + " ";
- dtext=dtext.remove("<").remove(">");
- if(dtext.contains (" " + m_baseCall + " ")
- || dtext.contains ("<" + m_baseCall + "> ")
-//###??? || dtext.contains ("<" + m_baseCall + " " + hiscall + "> ")
- || dtext.contains ("/" + m_baseCall + " ")
- || dtext.contains (" " + m_baseCall + "/")
- || (firstcall == "DE")) {
-
- QString w2;
- int nw=w.size();
- if(nw>=3) w2=w.at(2);
- int nrpt=w2.toInt();
- QString w34;
- if(nw>=4) {
-// w34=w.at(nw-2);
- nrpt=w.at(nw-2).toInt();
- w34=w.at(nw-1);
- }
- bool bRTTY = (nrpt>=529 and nrpt<=599);
- bool bEU_VHF_w2=(nrpt>=520001 and nrpt<=594000);
- if(bEU_VHF_w2 and SpecOp::EU_VHF!=m_specOp) {
- auto const& msg = tr("Should you switch to EU VHF Contest mode?\n\n"
- "To do so, check 'Special operating activity' and\n"
- "'EU VHF Contest' on the Settings | Advanced tab.");
- MessageBox::information_message (this, msg);
- }
-
- QStringList t=message.clean_string ().split(' ', SkipEmptyParts);
- int n=t.size();
- QString t0=t.at(n-2);
- QString t1=t0.right(1);
- bool bFieldDay_msg = (t1>="A" and t1<="F" and t0.size()<=3 and n>=9);
- int m=t0.remove(t1).toInt();
- if(m < 1) bFieldDay_msg=false;
- if(bFieldDay_msg) {
- m_xRcvd=t.at(n-2) + " " + t.at(n-1);
- t0=t.at(n-3);
- }
- if(bFieldDay_msg and SpecOp::FIELD_DAY!=m_specOp) {
- // ### Should be in ARRL Field Day mode ??? ###
- MessageBox::information_message (this, tr ("Should you switch to ARRL Field Day mode?"));
- }
-
- if(bRTTY and SpecOp::RTTY != m_specOp) {
- // ### Should be in RTTY contest mode ??? ###
- MessageBox::information_message (this, tr ("Should you switch to RTTY contest mode?"));
- }
-
- // This is necessary to prevent crashes caused by double-clicking messages with <...> in certain QSO situations.
- if((SpecOp::EU_VHF==m_specOp or SpecOp::RTTY==m_specOp or SpecOp::FIELD_DAY==m_specOp)
- and message.string().contains("<...>")) return;
-
- if(SpecOp::EU_VHF==m_specOp and message_words.at(2).contains(m_baseCall) and
- (!message_words.at(3).contains(qso_partner_base_call)) and (!m_bDoubleClicked)) {
- return;
- }
-
- bool bContestOK=(m_mode=="FT4" or m_mode=="FT8" or m_mode=="Q65" or m_mode=="MSK144");
- if(message_words.size () > 4 // enough fields for a normal message
- && (message_words.at(2).contains(m_baseCall) || "DE" == message_words.at(2))
- && (message_words.at(3).contains(qso_partner_base_call) or m_bDoubleClicked
- or bEU_VHF_w2 or (m_QSOProgress==CALLING))) {
- if(message_words.at(4).contains(grid_regexp) and SpecOp::EU_VHF!=m_specOp) {
- if((SpecOp::NA_VHF==m_specOp or SpecOp::WW_DIGI==m_specOp or
- SpecOp::ARRL_DIGI==m_specOp or SpecOp::Q65_PILEUP==m_specOp)
- and bContestOK) {
- setTxMsg(3);
- m_QSOProgress=ROGER_REPORT;
- // FT4 NS (NCCC Sprints): Log QSO after sending "hiscall mycall R mygrid"
- if (SpecOp::NA_VHF==m_specOp && m_mode=="FT4" && m_config.NCCC_Sprint()) {
- if (m_auto && (m_config.prompt_to_log() || m_config.autoLog())) logQSOTimer.start(0);
- QTimer::singleShot (int(850.0*m_TRperiod), [=] {
- auto_tx_mode(false);
- if (m_auto) ui->autoButton->click();
- });
- if (m_config.prompt_to_log() || m_config.autoLog()) { // prevent dupe logbook entries
- no_logging = true;
- QTimer::singleShot (20000, [=] {no_logging = false;});
- }
- }
- } else {
- if(m_mode=="JT65" and message_words.size()>5 and message_words.at(5)=="OOO") {
- setTxMsg(3);
- m_QSOProgress=ROGER_REPORT;
- } else {
- setTxMsg(2);
- m_QSOProgress=REPORT;
- }
- }
- } else if(w34.contains(grid_regexp) and SpecOp::EU_VHF==m_specOp) {
-
- if(nrpt==0) {
- setTxMsg(2);
- m_QSOProgress=REPORT;
- } else {
- if(w2=="R") {
- setTxMsg(4);
- m_QSOProgress=ROGERS;
- } else {
- setTxMsg(3);
- m_QSOProgress=ROGER_REPORT;
- }
- }
- } else if(SpecOp::RTTY == m_specOp and bRTTY) {
- if(w2=="R") {
- setTxMsg(4);
- m_QSOProgress=ROGERS;
- } else {
- setTxMsg(3);
- m_QSOProgress=ROGER_REPORT;
- }
- m_xRcvd=t[n-2] + " " + t[n-1];
- } else if(SpecOp::FIELD_DAY==m_specOp and bFieldDay_msg) {
- if(t0=="R") {
- setTxMsg(4);
- m_QSOProgress=ROGERS;
- } else {
- setTxMsg(3);
- m_QSOProgress=ROGER_REPORT;
- }
- } else { // no grid on end of msg
- auto const& word_3 = message_words.at (4);
- auto word_3_as_number = word_3.toInt ();
- if (("RRR" == word_3
- || (word_3_as_number == 73 && ROGERS == m_QSOProgress)
- || "RR73" == word_3
- || ("R" == word_3 && m_QSOProgress != REPORT))) {
- if(m_mode=="FT4" and "RR73" == word_3) m_dateTimeRcvdRR73=QDateTime::currentDateTimeUtc();
- m_bTUmsg=false;
- m_nextCall=""; //### Temporary: disable use of "TU;" message
- if(SpecOp::RTTY == m_specOp and m_nextCall!="") {
- // We're in RTTY contest and have "nextCall" queued up: send a "TU; ..." message
- if (m_config.prompt_to_log() || m_config.autoLog()) {
- logQSOTimer.start(0);
- }
- else {
- cease_auto_Tx_after_QSO ();
- }
- ui->tx3->setText(ui->tx3->text().remove("TU; "));
- useNextCall();
- QString t="TU; " + ui->tx3->text();
- ui->tx3->setText(t);
- m_bTUmsg=true;
- } else {
- if (false) // Always Send 73 after receiving RRR or RR73, even in contest mode.
- {
- if (m_config.prompt_to_log() || m_config.autoLog()) {
- if (!(m_mode=="FT4" && SpecOp::NA_VHF==m_specOp && m_config.NCCC_Sprint())) logQSOTimer.start(0);
- }
- else {
- cease_auto_Tx_after_QSO ();
- }
- m_ntx=6;
- ui->txrb6->setChecked(true);
- }
- else if (word_3.contains (QRegularExpression {"^R(?!R73|RR)"})
- && m_QSOProgress != ROGER_REPORT)
- {
- m_ntx=4;
- ui->txrb4->setChecked(true);
- }
- else if ((m_QSOProgress > CALLING && m_QSOProgress < ROGERS)
- || word_3.contains (QRegularExpression {"^RR(?:R|73)$"}))
- {
- m_ntx=5;
- ui->txrb5->setChecked(true);
- }
- else if (ROGERS == m_QSOProgress)
- {
- if (m_config.prompt_to_log() || m_config.autoLog()) {
- if (!(m_mode=="FT4" && SpecOp::NA_VHF==m_specOp && m_config.NCCC_Sprint())) logQSOTimer.start(0);
- }
- else {
- cease_auto_Tx_after_QSO ();
- }
- m_ntx=6;
- ui->txrb6->setChecked(true);
- }
- else
- {
- // just work them (again)
- if (ui->tx1->isEnabled ()) {
- m_ntx = 1;
- m_QSOProgress = REPLYING;
- ui->txrb1->setChecked (true);
- } else {
- m_ntx=2;
- m_QSOProgress = REPORT;
- ui->txrb2->setChecked (true);
- }
- }
- }
- if (m_QSOProgress >= ROGER_REPORT)
- {
- m_QSOProgress = SIGNOFF;
- }
- } else if((m_QSOProgress >= REPORT
- || (m_QSOProgress >= REPLYING &&
- (m_mode=="MSK144" or m_mode=="FT8" or m_mode=="FT4" || "Q65" == m_mode)))
- && word_3.startsWith ('R')) {
- m_ntx=4;
- m_QSOProgress = ROGERS;
- if(SpecOp::RTTY == m_specOp) {
- int n=t.size();
- int nRpt=t[n-2].toInt();
- if(nRpt>=529 and nRpt<=599) m_xRcvd=t[n-2] + " " + t[n-1];
- }
- ui->txrb4->setChecked(true);
- } else if (m_QSOProgress >= CALLING)
- {
- if ((word_3_as_number >= -50 && word_3_as_number <= 49)
- || (word_3_as_number >= 529 && word_3_as_number <= 599))
- {
- if(SpecOp::EU_VHF==m_specOp or
- SpecOp::FIELD_DAY==m_specOp or
- SpecOp::RTTY==m_specOp)
- {
- setTxMsg(2);
- m_QSOProgress=REPORT;
- }
- else
- {
- if (word_3.startsWith ("R-") || word_3.startsWith ("R+"))
- {
- setTxMsg(4);
- m_QSOProgress=ROGERS;
- }
- else
- {
- setTxMsg (3);
- m_QSOProgress = ROGER_REPORT;
- }
- }
- }
- }
- else
- { // nothing for us
- return;
- }
- }
- }
- else if (5 == message_words.size ()
- && m_baseCall == message_words.at (1)) {
- // dual Fox style message, possibly from MSHV
- if (m_config.prompt_to_log() || m_config.autoLog()) {
- logQSOTimer.start(0);
- }
- else {
- cease_auto_Tx_after_QSO ();
- }
- m_ntx=6;
- ui->txrb6->setChecked(true);
- }
- else if (m_QSOProgress >= ROGERS
- && message_words.size () > 3 && message_words.at (2).contains (m_baseCall)
- && message_words.at (3) == "73") {
- // 73 back to compound call holder
- m_ntx=5;
- ui->txrb5->setChecked(true);
- m_QSOProgress = SIGNOFF;
- }
- else if (!(m_bAutoReply && (m_QSOProgress > CALLING))) {
- if ((message_words.size () > 5 && message_words.at (2).contains (m_baseCall)
- && message_words.at (5) == "OOO")) {
- // EME short code report or MSK144/FT8 contest mode reply, send back Tx3
- m_ntx=3;
- m_QSOProgress = ROGER_REPORT;
- ui->txrb3->setChecked (true);
- } else if (!is_73) { // don't respond to sign off messages
- m_ntx=2;
- m_QSOProgress = REPORT;
- ui->txrb2->setChecked(true);
- if (m_bDoubleClickAfterCQnnn and m_transmitting) {
- on_stopTxButton_clicked();
- TxAgainTimer.start(1500);
- }
- m_bDoubleClickAfterCQnnn=false;
- }
- else {
- return; // nothing we need to respond to
- }
- }
- else { // nothing for us
- return;
- }
- }
- else if (firstcall == "DE" && message_words.size () > 4 && message_words.at (4) == "73") {
- if (m_QSOProgress >= ROGERS && base_call == qso_partner_base_call && m_currentMessageType) {
- // 73 back to compound call holder
- m_ntx=5;
- ui->txrb5->setChecked(true);
- m_QSOProgress = SIGNOFF;
- } else {
- // treat like a CQ/QRZ
- if (ui->tx1->isEnabled ()) {
- m_ntx = 1;
- m_QSOProgress = REPLYING;
- ui->txrb1->setChecked (true);
- } else {
- m_ntx=2;
- m_QSOProgress = REPORT;
- ui->txrb2->setChecked (true);
- }
- }
- }
- else if (is_73 && !message.isStandardMessage ()) {
- m_ntx=5;
- ui->txrb5->setChecked(true);
- m_QSOProgress = SIGNOFF;
- } else if (!(m_auto && m_ntx == 3 && message.string().contains("73 "))) { // don't interrupt Tx3 transmissions
- // just work them
- if (ui->tx1->isEnabled ()) {
- m_ntx = 1;
- m_QSOProgress = REPLYING;
- ui->txrb1->setChecked (true);
- } else {
- m_ntx=2;
- m_QSOProgress = REPORT;
- ui->txrb2->setChecked (true);
- }
- }
- // if we get here then we are reacting to the message
- if (m_bAutoReply) m_bCallingCQ = CALLING == m_QSOProgress;
- m_maxPoints=-1;
- if (ui->RxFreqSpinBox->isEnabled () and m_mode != "MSK144" and !shift) {
- ui->RxFreqSpinBox->setValue (frequency); //Set Rx freq
- }
-
- QString s1 = m_QSOText.trimmed ();
- QString s2 = message.clean_string ().trimmed();
- if (s1!=s2 and !message.isTX()) {
- // insert blank line in decodedTextBrowser2 when band was changed for MSK144
- if (m_mode=="MSK144" && m_config.insert_blank () && m_band_changed && (m_currentBandPeriod == m_currentBand) && !BlankLineInserted) {
- if (ui->actionUse_Dark_Style->isChecked()) {
- ui->decodedTextBrowser2->insertText(("------------------- " + m_currentBandPeriod + " -----------------"), "#a2a2a2", "#000000");
- } else {
- ui->decodedTextBrowser2->insertLineSpacer ("------------------- " + m_currentBandPeriod + " -----------------");
- }
- BlankLineInserted = true;
- m_band_changed = false;
- }
- if (!s2.contains(m_baseCall) or m_mode=="MSK144") { // Taken care of elsewhere if for_us and slow mode
- ui->decodedTextBrowser2->displayDecodedText (message, m_config.my_callsign (), m_mode, m_config.DXCC (),
- m_logBook, m_currentBand, m_config.ppfx (), false, false, 0.0, false, -99, "", m_muted);
- }
- m_QSOText = s2;
- }
-
- if (Radio::is_callsign (hiscall)
- && (base_call != qso_partner_base_call || base_call != hiscall)) {
- if (qso_partner_base_call != base_call) {
- // clear the DX grid if the base call of his call is different
- // from the current DX call
- ui->dxGridEntry->clear ();
- }
- // his base call different or his call more qualified
- // i.e. compound version of same base call
- if (!((s2.contains(" " + m_config.my_callsign() + " ") && s2.mid(22).contains(" 73")) && (ui->respondComboBox->currentText()=="CQ: Max dB"
- or ui->respondComboBox->currentText()=="CQ: Max dB"))) ui->dxCallEntry->setText (hiscall);
- }
- if (hisgrid.contains (grid_regexp)) {
- if(ui->dxGridEntry->text().mid(0,4) != hisgrid) ui->dxGridEntry->setText(hisgrid);
- }
- lookup();
- m_hisGrid = ui->dxGridEntry->text();
-
- if (m_bDoubleClicked)
- {
- // extract our report if present
- message.report (m_baseCall, Radio::base_callsign(ui->dxCallEntry->text()), m_rptRcvd);
- }
-
- if (!m_bSentReport || base_call != qso_partner_base_call || m_mode == "FT8" || m_mode == "FT4"
- || m_mode == "FST4") // Change report within a QSO
- {
- auto n = message.report ().toInt ();
- if(m_mode=="MSK144" and m_bShMsgs) {
- if(n<=-2) n=-3;
- if(n>=-1 and n<=1) n=0;
- if(n>=2 and n<=4) n=3;
- if(n>=5 and n<=7) n=6;
- if(n>=8 and n<=11) n=10;
- if(n>=12 and n<=14) n=13;
- if(n>=15) n=16;
- }
- ui->rptSpinBox->setValue (n);
- }
-// Don't genStdMsgs if we're already sending 73, or a "TU; " msg is queued.
- m_bTUmsg=false; //### Temporary: disable use of "TU;" messages
- if (!m_nTx73 and !m_bTUmsg) {
- genStdMsgs (QString::number (ui->rptSpinBox->value ()));
- }
- if(m_transmitting) m_restart=true;
- if (auto_seq && !m_bDoubleClicked && m_mode!="FT4") {
- return;
- }
- if(m_config.quick_call() && m_bDoubleClicked) auto_tx_mode(true);
- m_bDoubleClicked=false;
-
-}
-
-void MainWindow::setTxMsg(int n)
-{
- m_ntx=n;
- if(n==1) ui->txrb1->setChecked(true);
- if(n==2) ui->txrb2->setChecked(true);
- if(n==3) ui->txrb3->setChecked(true);
- if(n==4) ui->txrb4->setChecked(true);
- if(n==5) ui->txrb5->setChecked(true);
- if(n==6) ui->txrb6->setChecked(true);
-}
-
-void MainWindow::genCQMsg ()
-{
- auto const& my_callsign = m_config.my_callsign ();
- auto is_compound = my_callsign != m_baseCall;
- auto is_type_two = !is77BitMode () && is_compound && stdCall (m_baseCall) && !shortList (my_callsign);
- if(my_callsign.size () && m_config.my_grid().size ()) {
- auto const& grid = m_config.my_grid ();
- if (ui->cbCQTx->isEnabled () && ui->cbCQTx->isVisible () && ui->cbCQTx->isChecked ()) {
- if(stdCall (my_callsign)
- || is_type_two) {
- msgtype (QString {"CQ %1 %2 %3"}
- .arg (m_freqNominal / 1000 - m_freqNominal / 1000000 * 1000, 3, 10, QChar {'0'})
- .arg (my_callsign)
- .arg (grid.left (4)),
- ui->tx6);
- } else {
- msgtype (QString {"CQ %1 %2"}
- .arg (m_freqNominal / 1000 - m_freqNominal / 1000000 * 1000, 3, 10, QChar {'0'})
- .arg (my_callsign),
- ui->tx6);
- }
- } else {
- if (stdCall (my_callsign)
- || is_type_two) {
- msgtype (QString {"%1 %2 %3"}.arg(m_CQtype).arg(my_callsign)
- .arg(grid.left(4)),ui->tx6);
- } else {
- msgtype (QString {"%1 %2"}.arg(m_CQtype).arg(my_callsign),ui->tx6);
- }
- }
- if ((m_mode=="JT4" or m_mode=="Q65") and ui->cbShMsgs->isChecked()) {
- if (ui->cbTx6->isChecked ()) {
- msgtype ("@1250 (SEND MSGS)", ui->tx6);
- } else {
- msgtype ("@1000 (TUNE)", ui->tx6);
- }
- }
-
- QString t=ui->tx6->text();
- QStringList tlist=t.split(" ");
- if((m_mode=="FT4" or m_mode=="FT8" or m_mode=="MSK144" || "Q65" == m_mode) and
- SpecOp::NONE != m_specOp and SpecOp::HOUND != m_specOp and SpecOp::Q65_PILEUP != m_specOp and
- ( tlist.at(1)==my_callsign or
- tlist.at(2)==my_callsign ) and
- stdCall(my_callsign)) {
- if(m_config.Individual_Contest_Name() && SpecOp::FOX != m_specOp) {
- m_cqStr = m_config.Contest_Name();
- } else {
- if(SpecOp::NA_VHF == m_specOp) m_cqStr="TEST";
- if(SpecOp::EU_VHF == m_specOp) m_cqStr="TEST";
- if(SpecOp::FIELD_DAY == m_specOp) m_cqStr="FD";
- if(SpecOp::RTTY == m_specOp) m_cqStr="RU";
- if(SpecOp::WW_DIGI == m_specOp) m_cqStr="WW";
- if(SpecOp::ARRL_DIGI == m_specOp) m_cqStr="TEST";
- }
- if( tlist.at(1)==my_callsign ) {
- t="CQ " + m_cqStr + " " + tlist.at(1) + " " + tlist.at(2);
- } else {
- t="CQ " + m_cqStr + " " + tlist.at(2) + " " + tlist.at(3);
- }
- ui->tx6->setText(t);
- }
- } else {
- ui->tx6->clear ();
- }
-}
-
-void MainWindow::abortQSO()
-{
- bool b=m_auto;
- clearDX();
- if(b) auto_tx_mode(false);
- ui->txrb6->setChecked(true);
-}
-
-bool MainWindow::stdCall(QString const& w)
-{
- static QRegularExpression standard_call_re {
- R"(
- ^\s* # optional leading spaces
- ( [A-Z]{0,2} | [A-Z][0-9] | [0-9][A-Z] ) # part 1
- ( [0-9][A-Z]{0,3} ) # part 2
- (/R | /P)? # optional suffix
- \s*$ # optional trailing spaces
- )", QRegularExpression::CaseInsensitiveOption | QRegularExpression::ExtendedPatternSyntaxOption};
- return standard_call_re.match (w).hasMatch ();
-}
-
-bool MainWindow::is77BitMode () const
-{
- return "FT8" == m_mode || "FT4" == m_mode || "MSK144" == m_mode
- || "FST4" == m_mode || "Q65" == m_mode;
-}
-
-void MainWindow::ScrollBarPosition(int n) {
- m_position=n;
-}
-
-void MainWindow::genStdMsgs(QString rpt, bool unconditional)
-{
- genCQMsg ();
- auto const& hisCall=ui->dxCallEntry->text();
- if(!hisCall.size ()) {
- ui->labAz->clear ();
- ui->tx1->clear ();
- ui->tx2->clear ();
- ui->tx3->clear ();
- ui->tx4->clear ();
- if(unconditional && !keepTx5) ui->tx5->lineEdit ()->clear (); //Test if it needs sending again
- m_gen_message_is_cq = false;
- return;
- }
- m_hisCall0 = hisCall;
- auto const& my_callsign = m_config.my_callsign ();
- auto is_compound = my_callsign != m_baseCall;
- auto is_type_one = !is77BitMode () && is_compound && shortList (my_callsign);
- auto const& my_grid = m_config.my_grid ().left (4);
- auto const& hisBase = Radio::base_callsign (hisCall);
- save_dxbase_(const_cast <char *> ((hisBase + " ").left(6).toLatin1().constData()), (FCL)6);
- auto eme_short_codes = m_config.enable_VHF_features () && ui->cbShMsgs->isChecked ()
- && m_mode == "JT65";
-
- bool bMyCall=stdCall(my_callsign);
- bool bHisCall=stdCall(hisCall);
-
- QString t0=hisBase + " " + m_baseCall + " ";
- QString t0s=hisCall + " " + my_callsign + " ";
- QString t0a,t0b;
-
- if (is77BitMode () && bHisCall && bMyCall) t0=hisCall + " " + my_callsign + " ";
- t0a="<"+hisCall + "> " + my_callsign + " ";
- t0b=hisCall + " <" + my_callsign + "> ";
-
- QString t00=t0;
- QString t {t0 + my_grid};
- if(!bMyCall) t=t0a;
- msgtype(t, ui->tx1);
- if (eme_short_codes) {
- t=t+" OOO";
- if(!bHisCall) t=hisCall + " " + m_baseCall + " OOO";
- if(!bMyCall) t=hisBase + " " + my_callsign + " OOO";
- msgtype(t, ui->tx2);
- msgtype("RO", ui->tx3);
- msgtype("RRR", ui->tx4);
- msgtype("73", ui->tx5->lineEdit());
- } else {
- int n=rpt.toInt();
- rpt = rpt.asprintf("%+2.2d",n);
-
- if (is77BitMode ()) {
- QString t2,t3;
- QString sent=rpt;
- QString rs,rst;
- int nn=(n+36)/6;
- if(nn<2) nn=2;
- if(nn>9) nn=9;
- rst = rst.asprintf("5%1d9 ",nn);
- rs=rst.mid(0,2);
- t=t0;
- if(!bMyCall) {
- t=t0b;
- msgtype(t0a, ui->tx1);
- }
- if(!bHisCall) {
- t=t0a;
- msgtype(t0a + my_grid, ui->tx1);
- }
- if(SpecOp::NA_VHF==m_specOp) sent=my_grid;
- if(SpecOp::WW_DIGI==m_specOp) sent=my_grid;
- if(SpecOp::ARRL_DIGI==m_specOp) sent=my_grid;
- if(SpecOp::Q65_PILEUP==m_specOp) sent=my_grid;
- if(SpecOp::FIELD_DAY==m_specOp) sent=m_config.Field_Day_Exchange();
- if(SpecOp::RTTY==m_specOp) {
- sent=rst + m_config.RTTY_Exchange();
- QString t1=m_config.RTTY_Exchange();
- if(t1=="DX" or t1=="#") {
- t1 = t1.asprintf("%4.4d",ui->sbSerialNumber->value());
- sent=rst + t1;
- }
- if(t1.contains(QRegularExpression {"\\d\\d\\d\\d"})) {
- t1 = m_config.RTTY_Exchange();
- }
- }
- if(SpecOp::EU_VHF==m_specOp) {
- QString a;
- t="<" + t0s.split(" ").at(0) + "> <" + t0s.split(" ").at(1) + "> ";
- a = a.asprintf("%4.4d ",ui->sbSerialNumber->value());
- sent=rs + a + m_config.my_grid();
- }
- msgtype(t + sent, ui->tx2);
- if(sent==rpt) msgtype(t + "R" + sent, ui->tx3);
- if(sent!=rpt) msgtype(t + "R " + sent, ui->tx3);
- if(m_mode=="FT4" and SpecOp::RTTY==m_specOp) {
- QDateTime now=QDateTime::currentDateTimeUtc();
- int sinceTx3 = m_dateTimeSentTx3.secsTo(now);
- int sinceRR73 = m_dateTimeRcvdRR73.secsTo(now);
- if(m_bDoubleClicked and (sinceTx3 < 15) and (sinceRR73 < 3)) {
- t="TU; " + ui->tx3->text();
- ui->tx3->setText(t);
- }
- }
- }
-
- if(m_mode=="MSK144" and m_bShMsgs) {
- int i=t0s.length()-1;
- t0="<" + t0s.mid(0,i) + "> ";
- if(SpecOp::NA_VHF != m_specOp) {
- if(n<=-2) n=-3;
- if(n>=-1 and n<=1) n=0;
- if(n>=2 and n<=4) n=3;
- if(n>=5 and n<=7) n=6;
- if(n>=8 and n<=11) n=10;
- if(n>=12 and n<=14) n=13;
- if(n>=15) n=16;
- rpt = rpt.asprintf("%+2.2d",n);
- }
- }
-
- if (!is77BitMode ()) {
- t=(is_type_one ? t0 : t00) + rpt;
- msgtype(t, ui->tx2);
- t=t0 + "R" + rpt;
- msgtype(t, ui->tx3);
- }
-
- if(m_mode=="MSK144" and m_bShMsgs) {
- if(m_specOp==SpecOp::NONE) {
- t=t0 + "R" + rpt;
- msgtype(t, ui->tx3);
- }
- m_send_RR73=false;
- }
-
- t=t0 + (m_send_RR73 ? "RR73" : "RRR");
- if((m_mode=="MSK144" and !m_bShMsgs) or m_mode=="FT8" or m_mode=="FT4" || m_mode == "FST4" || m_mode == "Q65") {
- if(!bHisCall and bMyCall) t=hisCall + " <" + my_callsign + "> " + (m_send_RR73 ? "RR73" : "RRR");
- if(bHisCall and !bMyCall) t="<" + hisCall + "> " + my_callsign + " " + (m_send_RR73 ? "RR73" : "RRR");
- }
- if ((m_mode=="JT4" || m_mode=="Q65") && m_bShMsgs) t="@1500 (RRR)";
- msgtype(t, ui->tx4);
-
- t=t0 + "73";
- if((m_mode=="MSK144" and !m_bShMsgs) or m_mode=="FT8" or m_mode=="FT4" || m_mode == "FST4" || m_mode == "Q65") {
- if(!bHisCall and bMyCall) t=hisCall + " <" + my_callsign + "> 73";
- if(bHisCall and !bMyCall) t="<" + hisCall + "> " + my_callsign + " 73";
- }
- if (m_mode=="JT4" || m_mode=="Q65") {
- if (m_bShMsgs) t="@1750 (73)";
- if (!keepTx5) msgtype(t, ui->tx5->lineEdit());
- } else if ("MSK144" == m_mode && m_bShMsgs) {
- if (!keepTx5) msgtype(t, ui->tx5->lineEdit());
- } else if(unconditional || hisBase != m_lastCallsign || !m_lastCallsign.size ()) {
- // only update tx5 when forced or callsign changes
- if (!keepTx5) msgtype(t, ui->tx5->lineEdit());
- m_lastCallsign = hisBase;
- }
- }
-
- if (is77BitMode ()) return;
-
- if (is_compound) {
- if (is_type_one) {
- t=hisBase + " " + my_callsign;
- msgtype(t, ui->tx1);
- } else {
- t = "DE " + my_callsign + " ";
- switch (m_config.type_2_msg_gen ())
- {
- case Configuration::type_2_msg_1_full:
- msgtype(t + my_grid, ui->tx1);
- if (!eme_short_codes) {
- if(is77BitMode () && SpecOp::NA_VHF == m_specOp) {
- msgtype(t + "R " + my_grid, ui->tx3); // #### Unreachable code
- } else {
- msgtype(t + "R" + rpt, ui->tx3);
- }
- if ((m_mode != "JT4" && m_mode != "Q65") || !m_bShMsgs) {
- if (!keepTx5) msgtype(t + "73", ui->tx5->lineEdit ());
- }
- }
- break;
-
- case Configuration::type_2_msg_3_full:
- if (is77BitMode () && SpecOp::NA_VHF == m_specOp) {
- msgtype(t + "R " + my_grid, ui->tx3);
- msgtype(t + "RRR", ui->tx4);
- } else {
- msgtype(t00 + my_grid, ui->tx1);
- msgtype(t + "R" + rpt, ui->tx3);
- }
- if (!eme_short_codes && ((m_mode != "JT4" && m_mode != "Q65") || !m_bShMsgs)) {
- if (!keepTx5) msgtype(t + "73", ui->tx5->lineEdit ());
- }
- break;
-
- case Configuration::type_2_msg_5_only:
- msgtype(t00 + my_grid, ui->tx1);
- if (!eme_short_codes) {
- if (is77BitMode () && SpecOp::NA_VHF == m_specOp) {
- msgtype(t + "R " + my_grid, ui->tx3); // #### Unreachable code
- msgtype(t + "RRR", ui->tx4);
- } else {
- msgtype(t0 + "R" + rpt, ui->tx3);
- }
- }
- // don't use short codes here as in a sked with a type 2
- // prefix we would never send out prefix/suffix
- if (!keepTx5) msgtype(t + "73", ui->tx5->lineEdit ());
- break;
- }
- }
- if (hisCall != hisBase
- && m_config.type_2_msg_gen () != Configuration::type_2_msg_5_only
- && !eme_short_codes) {
- // cfm we have his full call copied as we could not do this earlier
- t = hisCall + " 73";
- if (!keepTx5) msgtype(t, ui->tx5->lineEdit ());
- }
- } else {
- if (hisCall != hisBase and SpecOp::HOUND != m_specOp) {
- if (shortList(hisCall)) {
- // cfm we know his full call with a type 1 tx1 message
- t = hisCall + " " + my_callsign;
- msgtype(t, ui->tx1);
- }
- else if (!eme_short_codes
- && ("MSK144" != m_mode || !m_bShMsgs)) {
- t=hisCall + " 73";
- if (!keepTx5) msgtype(t, ui->tx5->lineEdit ());
- }
- }
- }
- m_rpt=rpt;
- if(SpecOp::HOUND == m_specOp and is_compound) ui->tx1->setText("DE " + my_callsign);
-}
-
-void MainWindow::TxAgain()
-{
- auto_tx_mode(true);
-}
-
-void MainWindow::clearDX ()
-{
- set_dateTimeQSO (-1);
- if (m_QSOProgress != CALLING) {
- auto_tx_mode (false);
- }
- ui->dxCallEntry->clear ();
- if (m_config.clear_DXgrid () or (SpecOp::HOUND == m_specOp && m_config.superFox())) ui->dxGridEntry->clear ();
- if (!keepTx5) ui->tx5->setCurrentText(""); // clear tx5
- if (ui->respondComboBox->isVisible()) {
- Dpoints=0; // reset points
- maxDPoints=0; // reset points
- dBpoints=-28; // reset points
- dBpoints2=99; // reset points
- maxdBPoints=-28; // reset points
- mindBPoints=99; // reset points
- }
- m_lastCallsign.clear ();
- m_rptSent.clear ();
- m_rptRcvd.clear ();
- m_qsoStart.clear ();
- m_qsoStop.clear ();
- m_inQSOwith.clear();
- genStdMsgs (QString {});
- if (m_mode=="FT8" and SpecOp::HOUND == m_specOp) {
- m_ntx=1;
- ui->txrb1->setChecked(true);
- m_hisCall = "";
- m_hisCall0 = "";
- } else {
- m_ntx=6;
- ui->txrb6->setChecked(true);
- }
- m_QSOProgress = CALLING;
-}
-
-void MainWindow::lookup()
-{
- QString hisCall {ui->dxCallEntry->text()};
- QString hisgrid0 {ui->dxGridEntry->text()};
- if (!hisCall.size ()) return;
- QFile f {m_config.writeable_data_dir ().absoluteFilePath ("CALL3.TXT")};
- if (f.open (QIODevice::ReadOnly | QIODevice::Text))
- {
- char c[132];
- qint64 n=0;
- for(int i=0; i<999999; i++) {
- n=f.readLine(c,sizeof(c));
- if(n <= 0) {
- if(!hisgrid0.contains(grid_regexp)) {
- ui->dxGridEntry->clear();
- }
- break;
- }
- QString t=QString(c);
- int i1=t.indexOf(",");
- if(t.left(i1)==hisCall) {
- QString hisgrid=t.mid(i1+1,6);
- i1=hisgrid.indexOf(",");
- if(i1>0) {
- hisgrid=hisgrid.mid(0,4);
- } else {
- hisgrid=hisgrid.mid(0,6).toUpper();
- }
- if(hisgrid.left(4)==hisgrid0.left(4) or (hisgrid0.size()==0)) {
- ui->dxGridEntry->setText(hisgrid);
- }
- break;
- }
- }
- f.close();
- }
-}
-
-void MainWindow::on_lookupButton_clicked() //Lookup button
-{
- qint64 ms=QDateTime::currentMSecsSinceEpoch();
- lookup();
- if((ms-m_msErase)<500) {
- QString hisCall=ui->dxCallEntry->text();
- if (hisCall !="") QDesktopServices::openUrl (QUrl {"https://www.qrz.com/db/" + hisCall});
- }
- m_msErase=ms;
-}
-
-void MainWindow::on_addButton_clicked() //Add button
-{
- if(!ui->dxGridEntry->text ().size ()) {
- MessageBox::warning_message (this, tr ("Add to CALL3.TXT")
- , tr ("Please enter a valid grid locator"));
- return;
- }
- m_call3Modified=false;
- QString hisCall=ui->dxCallEntry->text();
- QString hisgrid=ui->dxGridEntry->text();
- QString newEntry=hisCall + "," + hisgrid;
-
- // int ret = MessageBox::query_message(this, tr ("Add to CALL3.TXT"),
- // tr ("Is %1 known to be active on EME?").arg (newEntry));
- // if(ret==MessageBox::Yes) {
- // newEntry += ",EME,,";
- // } else {
- newEntry += ",,,";
- // }
-
- QFile f1 {m_config.writeable_data_dir ().absoluteFilePath ("CALL3.TXT")};
- if(!f1.open(QIODevice::ReadWrite | QIODevice::Text)) {
- MessageBox::warning_message (this, tr ("Add to CALL3.TXT")
- , tr ("Cannot open \"%1\" for read/write: %2")
- .arg (f1.fileName ()).arg (f1.errorString ()));
- return;
- }
- if(f1.size()==0) {
- QTextStream out(&f1);
- out << "ZZZZZZ"
-#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0)
- << Qt::endl
-#else
- << endl
-#endif
- ;
- f1.seek (0);
- }
- QFile f2 {m_config.writeable_data_dir ().absoluteFilePath ("CALL3.TMP")};
- if(!f2.open(QIODevice::ReadWrite | QIODevice::Truncate | QIODevice::Text)) {
- MessageBox::warning_message (this, tr ("Add to CALL3.TXT")
- , tr ("Cannot open \"%1\" for writing: %2")
- .arg (f2.fileName ()).arg (f2.errorString ()));
- return;
- }
- {
- QTextStream in(&f1); //Read from CALL3.TXT
- QTextStream out(&f2); //Copy into CALL3.TMP
- QString hc=hisCall;
- QString hc1="";
- QString hc2="000000";
- QString s;
- do {
- s=in.readLine();
- hc1=hc2;
- if(s.mid(0,2)=="//") {
- out << s + QChar::LineFeed; //Copy all comment lines
- } else {
- int i1=s.indexOf(",");
- hc2=s.mid(0,i1);
- if(hc>hc1 && hc<hc2) {
- out << newEntry + QChar::LineFeed;
- out << s + QChar::LineFeed;
- m_call3Modified=true;
- } else if(hc==hc2) {
- QString t {tr ("%1\nis already in CALL3.TXT"
- ", do you wish to replace it?").arg (s)};
- int ret = MessageBox::query_message (this, tr ("Add to CALL3.TXT"), t);
- if(ret==MessageBox::Yes) {
- out << newEntry + QChar::LineFeed;
- m_call3Modified=true;
- }
- } else {
- if(s!="") out << s + QChar::LineFeed;
- }
- }
- } while(!s.isNull());
- if(hc>hc1 && !m_call3Modified) out << newEntry + QChar::LineFeed;
- }
-
- if(m_call3Modified) {
- auto const& old_path = m_config.writeable_data_dir ().absoluteFilePath ("CALL3.OLD");
- QFile f0 {old_path};
- if (f0.exists ()) f0.remove ();
- f1.copy (old_path); // copying as we want to
- // preserve symlinks
- f1.open (QFile::WriteOnly | QFile::Text); // truncates
- f2.seek (0);
- QByteArray tmp = f2.readAll();
- if (tmp != (const char*)NULL) f1.write (tmp); // copy contents
- else qDebug() << "tmp==NULL at f1.write";
- f2.remove ();
- }
-}
-
-void MainWindow::on_ignoreButton_clicked() //Ignore button
-{
- addCallsignToignoreList();
-}
-
-void MainWindow::msgtype(QString t, QLineEdit* tx) //msgtype()
-{
-// Set background colors of the Tx message boxes, depending on message type
- char message[38];
- char msgsent[38];
- QByteArray s=t.toUpper().toLocal8Bit();
- ba2msg(s,message);
- int ichk=1,itype=0;
- gen65(message, &ichk,msgsent, const_cast<int*>(itone0), &itype);
- msgsent[22]=0;
- bool text=false;
- bool shortMsg=false;
- if(itype==6) text=true;
-
-//### Check this stuff ###
- if(itype==7 and m_config.enable_VHF_features() and m_mode=="JT65") shortMsg=true;
- if(m_mode=="MSK144" and t.mid(0,1)=="<") text=false;
- if((m_mode=="MSK144" or m_mode=="FT8" or m_mode=="FT4" || "Q65" == m_mode) and
- SpecOp::NA_VHF==m_specOp) {
- int i0=t.trimmed().length()-7;
- if(t.mid(i0,3)==" R ") text=false;
- }
- text=false;
-//### ... to here ...
-
-
- QPalette p(tx->palette());
- if(text) {
- p.setColor(QPalette::Base,"#ffccff"); //pink
- } else {
- if(shortMsg) {
- p.setColor(QPalette::Base,"#66ffff"); //light blue
- } else {
- p.setColor(QPalette::Base,Qt::transparent);
- if ("MSK144" == m_mode && t.count ('<') == 1) {
- p.setColor(QPalette::Base,"#00ffff"); //another light blue
- }
- }
- }
- tx->setPalette(p);
-
- auto pos = tx->cursorPosition ();
- tx->setText(t.toUpper());
- tx->setCursorPosition (pos);
-}
-
-void MainWindow::on_tx1_editingFinished() //tx1 edited
-{
- if (SpecOp::HOUND==m_specOp && m_config.superFox() && !m_bDoubleClicked) {
- clearDX();
- return;
- }
- QString t=ui->tx1->text();
- msgtype(t, ui->tx1);
-}
-
-void MainWindow::on_tx2_editingFinished() //tx2 edited
-{
- QString t=ui->tx2->text();
- msgtype(t, ui->tx2);
-}
-
-void MainWindow::on_tx3_editingFinished() //tx3 edited
-{
- if (SpecOp::HOUND==m_specOp && m_config.superFox() && !m_bDoubleClicked) {
- clearDX();
- return;
- }
- QString t=ui->tx3->text();
- msgtype(t, ui->tx3);
-}
-
-void MainWindow::on_tx4_editingFinished() //tx4 edited
-{
- QString t=ui->tx4->text();
- msgtype(t, ui->tx4);
-}
-
-void MainWindow::on_tx5_currentTextChanged (QString const& text) //tx5 edited
-{
- msgtype(text, ui->tx5->lineEdit ());
-}
-
-void MainWindow::on_tx6_editingFinished() //tx6 edited
-{
- QString t=ui->tx6->text().toUpper();
- if(t.indexOf(" ")>0) {
- QString t1=t.split(" ").at(1);
- QRegExp AZ4("^[A-Z]{1,4}$");
- QRegExp NN3("^[0-9]{1,3}$");
- m_CQtype="CQ";
- if(t1.size()<=4 and t1.contains(AZ4)) m_CQtype="CQ " + t1;
- if(t1.size()<=3 and t1.contains(NN3)) m_CQtype="CQ " + t1;
- }
- msgtype(t, ui->tx6);
-}
-
-void MainWindow::on_RoundRobin_currentTextChanged(QString text)
-{
- ui->sbTxPercent->setEnabled (text == tr ("Random"));
-}
-
-void MainWindow::on_DX_Call_Button_clicked (bool checked)
-{
- if((m_mode=="FT8" or m_mode=="FT4" or m_mode=="Q65" or m_mode=="FST4" or m_mode=="MSK144") &&
- (m_specOp==SpecOp::NONE or m_specOp==SpecOp::HOUND) && ui->cbAutoSeq->isChecked() && checked
- && (m_hisCall!="" or (m_mode=="FT8" && m_specOp==SpecOp::HOUND))) {
- wait_and_call = true; // toggle Wait & Call on when allowed
- } else {
- wait_and_call = false; // toggle Wait & Call off in any other case
- ui->DX_Call_Button->setChecked (false);
- if (m_specOp==SpecOp::HOUND && m_config.superFox() && !m_auto) clearDX();
- }
- check_button_color();
-}
-
-void MainWindow::wheelEvent(QWheelEvent *event) // mouse wheel events
-{
- if(ui->labDialFreq->hasFocus() && !m_transmitting) { // kHz + or -
- Frequency dial_frequency {m_rigState.ptt () && m_rigState.split () ?
- m_rigState.tx_frequency () : m_rigState.frequency ()};
- if (event->angleDelta().x() > 2 or event->angleDelta().y() > 2) {
- dial_frequency = dial_frequency + 1000;
- ui->labDialFreq->setText (Radio::pretty_frequency_MHz_string (dial_frequency));
- } else if (event->angleDelta().x() < -2 or event->angleDelta().y() < -2) {
- dial_frequency = dial_frequency - 1000;
- ui->labDialFreq->setText (Radio::pretty_frequency_MHz_string (dial_frequency));
- }
- if (m_astroWidget && m_astroWidget->doppler_tracking() && m_astroWidget->DopplerMethod()!=0) {
- setRig(dial_frequency - m_astroCorrection.rx);
- } else {
- setRig(dial_frequency);
- }
- setXIT (ui->TxFreqSpinBox->value ());
- ui->labDialFreq->clearFocus();
- }
-}
-
-void MainWindow::mousePressEvent(QMouseEvent *event) // mouse press events
-{
- if(ui->labDialFreq->hasFocus() && !m_transmitting) { // kHz + or -
- if (event->button() & Qt::RightButton) {
- m_bandEdited = true;
- band_changed(m_freqNominal+1000);
- } else if (event->button() & Qt::LeftButton) {
- m_bandEdited = true;
- band_changed(m_freqNominal-1000);
- }
- ui->labDialFreq->clearFocus();
- }
- if(ui->tuneButton->hasFocus() && (event->button() & Qt::RightButton)) { // Tune button
- m_config.transceiver_tune (false); // reset any prior rig tuning
- blocked=true;
- m_config.transceiver_tune (true); // toggle rig tuning
- blocked=false;
- if(ui->tuneButton->text()=="Tuning") { // reset Tune button by another right-click
- ui->tuneButton->setChecked(false);
- ui->tuneButton->setText("Tune");
- m_config.transceiver_tune (false); // reset rig tuning
- } else {
- ui->tuneButton->setChecked(true);
- ui->tuneButton->setText("Tuning");
- QTimer::singleShot (6000, [=] { // reset Tune button after 6 seconds
- ui->tuneButton->setChecked(false);
- ui->tuneButton->setText("Tune");
- });
- }
- ui->tuneButton->clearFocus();
- }
- if(ui->DX_Call_Button->hasFocus() && (event->button() & Qt::RightButton)) { // DX_Call_Button
- clearDX(); // clear dxCallEntry
- ui->dxGridEntry->clear (); // clear dxGridEntry
- if (!keepTx5) ui->tx5->setCurrentText(""); // clear tx5
- if (ui->respondComboBox->isVisible()) {
- Dpoints=0; // reset points
- maxDPoints=0; // reset points
- dBpoints=-28; // reset points
- dBpoints2=99; // reset points
- maxdBPoints=-28; // reset points
- mindBPoints=99; // reset points
- }
- ui->DX_Call_Button->clearFocus();
- }
- if(m_config.alternate_erase_button() && ui->EraseButton->hasFocus() && (event->button() & Qt::RightButton)) {
- ui->decodedTextBrowser2->erase ();
- ui->EraseButton->clearFocus();
- }
- if(ui->txFirstCheckBox->isVisible() && ui->txFirstCheckBox->hasFocus() && (event->button() & Qt::RightButton)) {
- ui->txFirstCheckBox->setEnabled(false); // freeze txFirstCheckBox
- ui->txFirstCheckBox->clearFocus();
- }
- if(ui->msk144Button->hasFocus() && (event->button() & Qt::RightButton)) {
- ui->txFirstCheckBox->setEnabled(true); // unfreeze txFirstCheckBox
- ui->ft8Button->clearFocus();
- ui->msk144Button->clearFocus();
- }
- if(ui->q65Button->hasFocus() && (event->button() & Qt::RightButton)) { // switch to Q65_Pileup mode
- m_config.setSpecial_Q65_Pileup();
- m_specOp=m_config.special_op_id();
- on_actionQ65_triggered();
- ui->q65Button->clearFocus();
- }
- if(ui->jt65Button->hasFocus() && (event->button() & Qt::RightButton)) { // switch to JT9 mode
- on_actionJT9_triggered();
- ui->jt65Button->clearFocus();
- }
- if(ui->houndButton->hasFocus() && (event->button() & Qt::RightButton)) { // toggle SuperFox mode
- keep_frequency = true;
- not_erase = true; // prevent erasing the decodedTextBrowser
- m_config.toggle_SF();
- QTimer::singleShot (250, [=] {
- keep_frequency = false;
- not_erase = false;
- });
- on_actionFT8_triggered();
- ui->houndButton->clearFocus();
- ui->labDXped->setStyleSheet("QLabel {background-color: red; color: white;}");
- }
- // Search callsign on qrz.com, qrzcq.com or hamqth.com
- if(ui->lookupButton->hasFocus() && (event->button() & Qt::RightButton)) { // search callsign on QRZ.com
- QString hisCall=ui->dxCallEntry->text();
- if (hisCall !="") QDesktopServices::openUrl (QUrl {"https://www.qrz.com/db/" + hisCall});
- ui->lookupButton->clearFocus();
- }
- if(ui->addButton->hasFocus() && (event->button() & Qt::RightButton)) { // search callsign on hamqth.com
- QString hisCall=ui->dxCallEntry->text();
- if (hisCall !="") QDesktopServices::openUrl (QUrl {"https://www.hamqth.com/" + hisCall});
- ui->addButton->clearFocus();
- }
- if(ui->ignoreButton->hasFocus() && (event->button() & Qt::RightButton)) { // search callsign on qrzcq.com
- QString hisCall=ui->dxCallEntry->text();
- if (hisCall !="") QDesktopServices::openUrl (QUrl {"https://www.qrzcq.com/call/" + hisCall});
- ui->ignoreButton->clearFocus();
- }
- // Wait & Pounce
- if(ui->autoButton->hasFocus() && (event->button() & Qt::RightButton) && ui->respondComboBox->currentText()!="CQ: None") {
- if (!pounce && !m_auto && m_config.Wait_features_enabled() && SpecOp::FOX!=m_specOp) {
- pounce = true;
- check_button_color();
- stopWRTimer.stop(); // Stop any Wait & Reply timeout
- stopWCTimer.stop(); // Stop any Wait & Call timeout
- } else {
- pounce = false;
- check_button_color();
- }
- ui->autoButton->clearFocus();
- }
- if(ui->DecodeButton->hasFocus() && (event->button() & Qt::RightButton)) { // Decode button
- if(m_decoderBusy) {
- to_jt9(m_ihsym,-1,-1); //Allow jt9 to bail out early, if necessary
- decodeDone(); //Clear a hung decoder status
- }
- ui->DecodeButton->clearFocus();
- }
- if(ui->ft8Button->hasFocus() && (event->button() & Qt::RightButton)) { // Switch contest mode on/off
- not_erase = true; // prevent erasing the decodedTextBrowser
- QTimer::singleShot (350, [=] {not_erase = false;});
- m_specOp=m_config.special_op_id();
- if (!m_config.bSpecialOp()) {
- m_config.setSpecial_On();
- if (m_specOp==SpecOp::HOUND) {
- ui->houndButton->click();
- }
- } else {
- m_config.setSpecial_None();
- if(ui->txrb1->isChecked()) on_txb2_clicked();
- ui->tx1->setEnabled(true);
- ui->txb1->setEnabled(true);
- if (m_specOp==SpecOp::HOUND) {
- ui->houndButton->setChecked(false);
- m_config.setSpecial_None();
- keep_frequency = true;
- QTimer::singleShot (250, [=] {keep_frequency = false;});
- }
- }
- m_specOp=m_config.special_op_id();
- SpecOp nContest0=m_specOp;
- if(m_specOp!=nContest0) {
- ui->tx1->setEnabled(true);
- ui->txb1->setEnabled(true);
- set_mode(m_mode);
- }
- displayDialFrequency ();
- update_watchdog_label ();
- checkMSK144ContestType();
- chkFT4();
- if(SpecOp::EU_VHF==m_specOp and m_config.my_grid().size()<6) {
- MessageBox::information_message (this,
- "EU VHF Contest messages require a 6-character locator.");
- }
- if((m_specOp==SpecOp::FOX or m_specOp==SpecOp::HOUND) and
- m_mode!="FT8") {
- MessageBox::information_message (this,
- "Fox-and-Hound operation is available only in FT8 mode.\nGo back and change your selection.");
- }
- ui->labDXped->setVisible(SpecOp::NONE != m_specOp);
- if ((!verified && ui->labDXped->isVisible()) or ui->labDXped->text()!="Super Hound")
- ui->labDXped->setStyleSheet("QLabel {background-color: red; color: white;}");
- set_mode(m_mode);
- configActiveStations();
- check_button_color();
- ui->ft8Button->clearFocus();
- statusChanged();
- }
- // freeze the Tx5 text
- if(ui->txb5->hasFocus() && (event->button() & Qt::RightButton)) {
- if (!keepTx5) {
- keepTx5 = true;
- ui->tx5->setStyleSheet("color: #000000; background-color: #ffff00");
- } else {
- keepTx5 = false;
- ui->tx5->setStyleSheet("");
- }
- ui->txb5->clearFocus();
- }
- // Toggle FT8 DXp frequencies
- if(ui->pb80->hasFocus() && (event->button() & Qt::RightButton) && (m_mode=="FT8" || m_mode=="FT4")) {
- keep_frequency = true;
- setRig(3567000);
- QTimer::singleShot (250, [=] {keep_frequency = false;});
- setXIT (ui->TxFreqSpinBox->value ());
- ui->pb80->clearFocus();
- }
- if(ui->pb40->hasFocus() && (event->button() & Qt::RightButton) && (m_mode=="FT8" || m_mode=="FT4")) {
- keep_frequency = true;
- setRig(7056000);
- QTimer::singleShot (250, [=] {keep_frequency = false;});
- setXIT (ui->TxFreqSpinBox->value ());
- ui->pb40->clearFocus();
- }
- if(ui->pb30->hasFocus() && (event->button() & Qt::RightButton) && (m_mode=="FT8" || m_mode=="FT4")) {
- keep_frequency = true;
- setRig(10131000);
- QTimer::singleShot (250, [=] {keep_frequency = false;});
- setXIT (ui->TxFreqSpinBox->value ());
- ui->pb30->clearFocus();
- }
- if(ui->pb20->hasFocus() && (event->button() & Qt::RightButton) && (m_mode=="FT8" || m_mode=="FT4")) {
- keep_frequency = true;
- setRig(14090000);
- QTimer::singleShot (250, [=] {keep_frequency = false;});
- setXIT (ui->TxFreqSpinBox->value ());
- ui->pb20->clearFocus();
- }
- if(ui->pb17->hasFocus() && (event->button() & Qt::RightButton) && (m_mode=="FT8" || m_mode=="FT4")) {
- keep_frequency = true;
- setRig(18095000);
- QTimer::singleShot (250, [=] {keep_frequency = false;});
- setXIT (ui->TxFreqSpinBox->value ());
- ui->pb17->clearFocus();
- }
- if(ui->pb15->hasFocus() && (event->button() & Qt::RightButton) && (m_mode=="FT8" || m_mode=="FT4")) {
- keep_frequency = true;
- setRig(21091000);
- QTimer::singleShot (250, [=] {keep_frequency = false;});
- setXIT (ui->TxFreqSpinBox->value ());
- ui->pb15->clearFocus();
- }
- if(ui->pb12->hasFocus() && (event->button() & Qt::RightButton) && (m_mode=="FT8" || m_mode=="FT4")) {
- keep_frequency = true;
- setRig(24911000);
- QTimer::singleShot (250, [=] {keep_frequency = false;});
- setXIT (ui->TxFreqSpinBox->value ());
- ui->pb12->clearFocus();
- }
- if(ui->pb10->hasFocus() && (event->button() & Qt::RightButton) && (m_mode=="FT8" || m_mode=="FT4")) {
- keep_frequency = true;
- setRig(28091000);
- QTimer::singleShot (250, [=] {keep_frequency = false;});
- setXIT (ui->TxFreqSpinBox->value ());
- ui->pb10->clearFocus();
- }
- if(ui->pb6->hasFocus() && (event->button() & Qt::RightButton) && m_mode=="FT8") {
- keep_frequency = true;
- setRig(50323000);
- QTimer::singleShot (250, [=] {keep_frequency = false;});
- setXIT (ui->TxFreqSpinBox->value ());
- ui->pb6->clearFocus();
- }
- if(ui->pb2->hasFocus() && (event->button() & Qt::RightButton)) {
- int f;
- if (m_config.region()==2) {
- f = 222174000;
- } else {
- f = 70154000;
- }
- auto const& row = m_config.frequencies ()->best_working_frequency (f);
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0) {
- on_bandComboBox_activated (row);
- } else {
- keep_frequency = true;
- setRig(f);
- QTimer::singleShot (250, [=] {keep_frequency = false;});
- }
- setXIT (ui->TxFreqSpinBox->value ());
- ui->pb2->clearFocus();
- }
- if(ui->pb70->hasFocus() && (event->button() & Qt::RightButton)) {
- auto const& row = m_config.frequencies ()->best_working_frequency (1296174000);
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0) {
- on_bandComboBox_activated (row);
- } else {
- keep_frequency = true;
- setRig(1296174000);
- QTimer::singleShot (250, [=] {keep_frequency = false;});
- }
- setXIT (ui->TxFreqSpinBox->value ());
- ui->pb70->clearFocus();
- }
- if (ui->pbBandHopping->hasFocus() && event->button() & Qt::RightButton) { // Band Hopping button
- if(ui->pbBandHopping->isChecked()) {
- bandHopping(); // Force band hopping to switch to the next selected frequency
- } else {
- // Testing the default audio device
-#ifdef WIN32
- QAudioOutput info(QAudioDeviceInfo::defaultOutputDevice());
- QString binPath = QCoreApplication::applicationDirPath();
- QAudioFormat format;
- format.setCodec("audio/pcm");
- format.setSampleRate (48000);
- format.setChannelCount (1);
- format.setSampleSize (16);
- format.setSampleType(QAudioFormat::SignedInt);
- QAudioOutput* audio;
- audio = new QAudioOutput(format, this);
- QFile *effect = new QFile(this);
- effect->setFileName(QString("%1/%2").arg(binPath, "/sounds/Testing_long.wav"));
- effect->open(QIODevice::ReadOnly);
- audio->start(effect);
-#else
- QString binPath = QCoreApplication::applicationDirPath();
- QSound::play(binPath + "/sounds/Testing_long.wav"); // for Linux and macOS
-#endif
- }
- ui->pbBandHopping->clearFocus();
- }
-}
-
-void MainWindow::on_dxCallEntry_textChanged (QString const& call)
-{
- if (SpecOp::HOUND==m_specOp && m_config.superFox() && !(m_bDoubleClicked or (m_hisCall0 != ""
- && (call.left(6).contains(m_hisCall0) or call.right(6).contains(m_hisCall0))))
- && !ui->DX_Call_Button->isChecked()) { // allow Wait & Call
- clearDX();
- return;
- }
- set_dateTimeQSO (-1); // reset the QSO start time when DXCall changes
- m_hisCall = call;
- if(m_QSYMessageCreatorWidget) m_QSYMessageCreatorWidget->getDxBase(QString(Radio::base_callsign(call)));
- if (!blocked) ui->dxGridEntry->clear(); // conditional because not always useful with highlightDXCall/DXGrid feature
- if (ui->DX_Call_Button->isChecked() && !(m_mode=="FT8" && SpecOp::HOUND==m_specOp)) ui->DX_Call_Button->click ();
- statusChanged();
- statusUpdate ();
- check_button_color();
-}
-
-void MainWindow::on_dxCallEntry_editingFinished()
-{
- auto const& dxBase = Radio::base_callsign (m_hisCall);
- save_dxbase_(const_cast <char *> ((dxBase + " ").left (6).toLatin1().constData()), (FCL)6);
- if(m_QSYMessageCreatorWidget) m_QSYMessageCreatorWidget->getDxBase(QString(dxBase));
-}
-
-void MainWindow::on_dxCallEntry_returnPressed ()
-{
- on_lookupButton_clicked();
-}
-
-void MainWindow::on_dxGridEntry_textChanged (QString const& grid)
-{
- if (ui->dxGridEntry->hasAcceptableInput ()) {
- if (grid != m_hisGrid) {
- m_hisGrid = grid;
- statusUpdate ();
- }
- qint64 nsec = (QDateTime::currentMSecsSinceEpoch()/1000) % 86400;
- double utch=nsec/3600.0;
- int nAz,nEl,nDmiles,nDkm,nHotAz,nHotABetter;
- azdist_(const_cast <char *> ((m_config.my_grid () + " ").left (6).toLatin1().constData()),
- const_cast <char *> ((m_hisGrid + " ").left (6).toLatin1().constData()),&utch,
- &nAz,&nEl,&nDmiles,&nDkm,&nHotAz,&nHotABetter,(FCL)6,(FCL)6);
- QString t;
- int nd=nDkm;
- if(m_config.miles()) nd=nDmiles;
- if(m_mode=="MSK144") {
- if(nHotABetter==0)t = t.asprintf("Az: %d B: %d El: %d %d",nAz,nHotAz,nEl,nd);
- if(nHotABetter!=0)t = t.asprintf("Az: %d A: %d El: %d %d",nAz,nHotAz,nEl,nd);
- } else {
- t = t.asprintf("Az: %d %d",nAz,nd);
- }
- if(m_config.miles()) t += " mi";
- if(!m_config.miles()) t += " km";
- ui->labAz->setText (t);
- } else {
- if (m_hisGrid.size ()) {
- m_hisGrid.clear ();
- ui->labAz->clear ();
- statusUpdate ();
- }
- }
-}
-
-void MainWindow::on_genStdMsgsPushButton_clicked() //genStdMsgs button
-{
- ui->pbBandHopping->setChecked(false); // disable band hopping
- genStdMsgs(m_rpt);
- if (!m_bDoubleClicked && m_hisCall!="") {
- if (ui->tx1->isEnabled ()) {
- QTimer::singleShot (0, ui->txrb1, SLOT (click ())); // Go to Tx1
- } else {
- QTimer::singleShot (0, ui->txrb2, SLOT (click ())); // Go to Tx2 if Tx1 is disabled
- }
- m_bMyCallStd=stdCall(m_config.my_callsign()); //ft8md
- m_bHisCallStd=stdCall(m_hisCall); //ft8md
-
- }
-}
-
-void MainWindow::cease_auto_Tx_after_QSO ()
-{
- if (SpecOp::FOX != m_specOp
- && ui->cbAutoSeq->isVisible () && ui->cbAutoSeq->isEnabled () && ui->cbAutoSeq->isChecked ())
- {
- // ensure that auto Tx is disabled even if disable Tx
- // on 73 is not checked, unless in Fox mode where it is allowed
- // to be a robot.
- auto_tx_mode (false);
- }
-}
-
-void MainWindow::on_logQSOButton_clicked() //Log QSO button
-{
- if (!(m_config.repeat_Tx() && (m_mode=="MSK144" or m_mode=="Q65"))) {
- if (SpecOp::NA_VHF==m_specOp && m_mode=="FT4" && m_config.NCCC_Sprint()) {
- QTimer::singleShot (int(850.0*m_TRperiod), [=] {cease_auto_Tx_after_QSO ();});
- } else {
- cease_auto_Tx_after_QSO ();
- }
- }
-
- if (!m_hisCall.size ()) {
- MessageBox::warning_message (this, tr ("Warning: DX Call field is empty."));
- if ((SpecOp::NA_VHF == m_specOp or SpecOp::WW_DIGI == m_specOp) && m_config.autoLog()) return; // prevent program crash
- }
- // m_dateTimeQSOOn should really already be set but we'll ensure it gets set to something just in case
- if (!m_dateTimeQSOOn.isValid ()) {
- auto now = QDateTime::currentDateTimeUtc();
- m_dateTimeQSOOn = now.addSecs (-(m_ntx - 2) * int(m_TRperiod) -
- int(fmod(double(now.time().second()),m_TRperiod)));
- }
- auto dateTimeQSOOff = QDateTime::currentDateTimeUtc();
- if (dateTimeQSOOff < m_dateTimeQSOOn) dateTimeQSOOff = m_dateTimeQSOOn;
- QString grid=m_hisGrid;
- if(grid=="....") grid="";
-
- // Optionally replace empty grids by "ZZ00"
- if(m_config.ZZ00() && m_hisGrid=="" && m_specOp!=SpecOp::NONE && m_specOp!=SpecOp::FOX && m_specOp!=SpecOp::HOUND) m_hisGrid = "ZZ00";
-
- switch( m_specOp )
- {
- case SpecOp::NA_VHF:
- m_xSent=m_config.my_grid().left(4);
- m_xRcvd=m_hisGrid.left(4);
- break;
- case SpecOp::EU_VHF:
- m_rptSent=m_xSent.split(" ").at(0).left(2);
- m_rptRcvd=m_xRcvd.split(" ").at(0).left(2);
- if(m_xRcvd.split(" ").size()>=2) m_hisGrid=m_xRcvd.split(" ").at(1);
- grid=m_hisGrid;
- ui->dxGridEntry->setText(grid);
- break;
- case SpecOp::FIELD_DAY:
- m_rptSent=m_xSent.split(" ").at(0);
- m_rptRcvd=m_xRcvd.split(" ").at(0);
- break;
- case SpecOp::RTTY:
- m_rptSent=m_xSent.split(" ").at(0);
- m_rptRcvd=m_xRcvd.split(" ").at(0);
- break;
- case SpecOp::WW_DIGI:
- m_xSent=m_config.my_grid().left(4);
- m_xRcvd=m_hisGrid.left(4);
- break;
- case SpecOp::ARRL_DIGI:
- m_xSent=m_config.my_grid().left(4);
- m_xRcvd=m_hisGrid.left(4);
- break;
- case SpecOp::Q65_PILEUP:
- m_xSent=m_config.my_grid().left(4);
- m_xRcvd=m_hisGrid;
- break;
- default: break;
- }
-
- m_logDlg->initLogQSO (m_hisCall, grid, m_mode, m_rptSent, m_rptRcvd,
- m_dateTimeQSOOn, dateTimeQSOOff, m_freqNominal +
- ui->TxFreqSpinBox->value(), m_noSuffix, m_xSent, m_xRcvd);
- m_inQSOwith="";
- if (ui->respondComboBox->isVisible() && ui->respondComboBox->currentText() != "CQ: None") {
- Dpoints=0; // reset points
- maxDPoints=0; // reset points
- dBpoints=-28; // reset points
- dBpoints2=99; // reset points
- maxdBPoints=-28; // reset points
- mindBPoints=99; // reset points
- }
- QTimer::singleShot (2000, [=] {
- pounce = false;
- filtered = false;
- read_txLog();
- check_button_color();
- });
- QTimer::singleShot (7000, [=] {
- read_txLog();
- });
- stopWRTimer.stop(); // Stop any Wait & Reply timeout
- stopWCTimer.stop(); // Stop any Wait & Call timeout
-}
-
-void MainWindow::acceptQSO (QDateTime const& QSO_date_off, QString const& call, QString const& grid
- , Frequency dial_freq, QString const& mode
- , QString const& rpt_sent, QString const& rpt_received
- , QString const& tx_power, QString const& comments
- , QString const& name, QDateTime const& QSO_date_on, QString const& operator_call
- , QString const& my_call, QString const& my_grid
- , QString const& exchange_sent, QString const& exchange_rcvd
- , QString const& propmode, QString const& satellite
- , QString const& satmode
- , QString const& freqRx, QByteArray const& ADIF)
-{
- QString date = QSO_date_on.toString("yyyyMMdd");
- m_lastloggedcall=call; //ft8md
- if (!m_logBook.add (call, grid, m_config.bands()->find(dial_freq), mode, ADIF))
- {
- MessageBox::warning_message (this, tr ("Log file error"),
- tr ("Cannot open \"%1\"").arg (m_logBook.path ()));
- }
-
- m_messageClient->qso_logged (QSO_date_off, call, grid, dial_freq, mode, rpt_sent, rpt_received
- , tx_power, comments, name, QSO_date_on, operator_call, my_call, my_grid
- , exchange_sent, exchange_rcvd, propmode, satellite, satmode, freqRx);
- m_messageClient->logged_ADIF (ADIF);
-
- // Log to N1MM Logger
- if (m_config.broadcast_to_n1mm () && m_config.valid_n1mm_info ())
- {
- QUdpSocket sock;
- if (-1 == sock.writeDatagram (ADIF + " <eor>"
- , QHostAddress {m_config.n1mm_server_name ()}
- , m_config.n1mm_server_port ()))
- {
- MessageBox::warning_message (this, tr ("Error sending log to N1MM"),
- tr ("Write returned \"%1\"").arg (sock.errorString ()));
- }
- }
-
- // Log to Cloudlog API if enabled
- if (m_config.cloudlog_enabled())
- {
- m_cloudlog.logQso(ADIF);
- }
-
- blocked=true; // needed to clear DXgrid only optionally
- if (m_config.clear_DXcall ()) clearDX ();
- if (m_config.clear_DXgrid ()) ui->dxGridEntry->clear ();
- QTimer::singleShot (50, [=] {blocked = false;}); // needed to clear DXgrid only optionally
- m_dateTimeQSOOn = QDateTime {};
- if(m_specOp!=SpecOp::NONE and m_specOp!=SpecOp::FOX and m_specOp!=SpecOp::HOUND) {
- ui->sbSerialNumber->setValue(ui->sbSerialNumber->value() + 1);
- }
-
- if(m_ActiveStationsWidget!=NULL) {
- if(m_mode=="Q65") {
- m_score++;
- m_EMEworked[call]=true;
- if(m_specOp==SpecOp::Q65_PILEUP) {
- rm_q3list_(const_cast<char *> (m_deCall.toLatin1().constData()), m_deCall.size());
- refreshPileupList();
- }
- m_ActiveStationsWidget->setRate(m_score);
- } else if (m_specOp==SpecOp::ARRL_DIGI) {
- QString band=m_config.bands()->find(dial_freq);
- activeWorked(call,band);
- int points=m_activeCall[call].points;
- m_score += points;
- ARRL_logged al;
- al.time=QDateTime::currentDateTimeUtc();
- al.band=band;
- al.points=points;
- m_arrl_log.append(al);
- updateRate();
- }
- }
-
- m_xSent.clear ();
- m_xRcvd.clear ();
- if (m_config.set_RXtoTX ()) on_pbT2R_clicked(); // Mod for WD5DHK
-}
-
-void MainWindow::updateRate()
-{
- int iz=m_arrl_log.size();
- int rate=0;
- int nbc=0;
- double hrDiff;
-
- for(int i=iz-1; i>=0; i--) {
- hrDiff = m_arrl_log[i].time.msecsTo(QDateTime::currentDateTimeUtc())/3600000.0;
- if(hrDiff > 1.0) break;
- rate += m_arrl_log[i].points;
- if(i<iz-1 and m_arrl_log[i].band != m_arrl_log[i+1].band) nbc += 1;
- }
- m_ActiveStationsWidget->setRate(rate);
- m_ActiveStationsWidget->setScore(m_score);
- m_ActiveStationsWidget->setBandChanges(nbc);
-}
-
-qint64 MainWindow::nWidgets(QString t)
-{
- Q_ASSERT(t.length()==N_WIDGETS);
- qint64 n=0;
- for(int i=0; i<N_WIDGETS; i++) {
- n=n + n + t.mid(i,1).toInt();
- }
- return n;
-}
-
-void MainWindow::displayWidgets(qint64 n)
-{
- /* See text file "displayWidgets.txt" for widget numbers */
- qint64 j=qint64(1)<<(N_WIDGETS-1);
- bool b;
- for(int i=0; i<N_WIDGETS; i++) {
- b=(n&j) != 0;
- if(i==0) ui->txFirstCheckBox->setVisible(b);
- if(i==1) ui->TxFreqSpinBox->setVisible(b);
- if(i==2) ui->RxFreqSpinBox->setVisible(b);
- if(i==3) ui->sbFtol->setVisible(b);
- if(i==4) ui->rptSpinBox->setVisible(b);
- if(i==5) ui->sbTR->setVisible(b);
- if(i==6) {
- ui->sbCQTxFreq->setVisible (b);
- ui->cbCQTx->setVisible (b);
- auto is_compound = m_config.my_callsign () != m_baseCall;
- ui->cbCQTx->setEnabled (b && (!is_compound || shortList (m_config.my_callsign ())));
- }
- if(i==7) ui->cbShMsgs->setVisible(b);
- if(i==8) ui->cbFast9->setVisible(b);
- if(i==9) ui->cbAutoSeq->setVisible(b);
- if(i==10) ui->cbTx6->setVisible(b);
- // if(i==11) ui->pbTxMode->setVisible(b);
- if(i==12) ui->pbR2T->setVisible(b);
- if(i==13) ui->pbT2R->setVisible(b);
- if(i==14) ui->cbHoldTxFreq->setVisible(b);
- if(i==15) ui->sbSubmode->setVisible(b);
- if(i==16) ui->syncSpinBox->setVisible(b);
- if(i==17) ui->WSPR_controls_widget->setVisible(b);
- if(i==18) ui->ClrAvgButton->setVisible(b);
- if(i==19) ui->actionQuickDecode->setEnabled(b);
- if(i==19) ui->actionMediumDecode->setEnabled(b);
- if(i==19) ui->actionDeepestDecode->setEnabled(b);
- if(i==20) ui->actionInclude_averaging->setVisible (b);
- if(i==21) ui->actionInclude_correlation->setVisible (b);
- if(i==22) {
- if(!b && m_echoGraph->isVisible()) m_echoGraph->hide();
- }
- if(i==23) ui->cbSWL->setVisible(b);
- if(i==24) ui->actionEnable_AP_FT8->setVisible (b);
- if(i==25) ui->actionEnable_AP_JT65->setVisible (b);
- if(i==26) ui->actionEnable_AP_DXcall->setVisible (b);
- if(i==27) ui->respondComboBox->setVisible(b);
- if(i==29) ui->measure_check_box->setVisible(b);
- if(i==30) ui->labDXped->setVisible(b);
- if(i==31) ui->cbRxAll->setVisible(b);
- if(i==32) ui->cbCQonly->setVisible(b);
- if(i==33) ui->sbTR_FST4W->setVisible(b);
- if (34 == i) // adjust the stacked widget
- {
- ui->opt_controls_stack->setCurrentIndex (b ? 1 : 0);
- ui->sbF_Low->setVisible(b);
- }
- if(i==35) ui->sbF_High->setVisible(b);
- if(i==36) ui->actionAuto_Clear_Avg->setVisible (b);
- if(i==37) ui->sbMaxDrift->setVisible(b);
- j=j>>1;
- }
- ui->pbBestSP->setVisible(m_mode=="FT4");
- b=false;
- if(m_mode=="FT4" or m_mode=="FT8" || "Q65" == m_mode) {
- b=SpecOp::EU_VHF==m_specOp or
- ( SpecOp::RTTY==m_specOp and
- (m_config.RTTY_Exchange()=="DX" or m_config.RTTY_Exchange()=="#") );
- }
- if(m_mode=="MSK144") b=SpecOp::EU_VHF==m_specOp;
- ui->sbEchoAvg->setVisible(m_mode=="Echo");
- ui->sbSerialNumber->setVisible(b);
- m_lastCallsign.clear (); // ensures Tx5 is updated for new modes
- b=m_mode.startsWith("FST4");
- ui->sbNB->setVisible(b);
- genStdMsgs (m_rpt, true);
- configActiveStations();
-}
-
-void MainWindow::on_actionFST4_triggered()
-{
- QTimer::singleShot (50, [=] {
- ui->TxFreqSpinBox->setValue(m_settings->value("TxFreq_old",1500).toInt());
- ui->RxFreqSpinBox->setValue(m_settings->value("RxFreq_old",1500).toInt());
- on_sbSubmode_valueChanged(ui->sbSubmode->value());
- ui->cbHoldTxFreq->setChecked (HoldTxFreqStatus);
- });
- m_mode="FST4";
- if(m_specOp==SpecOp::HOUND) {
- m_config.setSpecial_None();
- m_specOp=m_config.special_op_id();
- }
- ui->actionFST4->setChecked(true);
- m_bFast9=false;
- m_bFastMode=false;
- m_fastGraph->hide();
- m_wideGraph->show();
- if (m_tci_audio && ui->bandComboBox->currentText()!="OOB")
- Q_EMIT m_config.transceiver_period(m_TRperiod);
- m_nsps=6912; //For symspec only
- m_FFTSize = m_nsps / 2;
- if (m_tci_audio) Q_EMIT m_config.transceiver_blocksize (m_FFTSize);
- else Q_EMIT FFTSize (m_FFTSize);
- ui->lh_decodes_title_label->setText(tr ("Band Activity"));
- ui->rh_decodes_title_label->setText(tr ("Rx Frequency"));
- WSPR_config(false);
- if(m_config.single_decode()) {
-// 01234567890123456789012345678901234567
- displayWidgets(nWidgets("11111100010011100001000000010000000000"));
- m_wideGraph->setSingleDecode(true);
- } else {
- displayWidgets(nWidgets("11101100010011100001000000010000001100"));
- m_wideGraph->setSingleDecode(false);
- ui->sbFtol->setValue(20);
- }
- setup_status_bar(false);
- ui->cbAutoSeq->setChecked(true);
- m_wideGraph->setMode(m_mode);
- m_wideGraph->setPeriod(m_TRperiod,6912);
- m_wideGraph->setRxFreq(ui->RxFreqSpinBox->value());
- m_wideGraph->setTol(ui->sbFtol->value());
- m_wideGraph->setTxFreq(ui->TxFreqSpinBox->value());
- m_wideGraph->setFST4_FreqRange(ui->sbF_Low->value(),ui->sbF_High->value());
- chk_FST4_freq_range();
- switch_mode (Modes::FST4);
- m_wideGraph->setMode(m_mode);
- ui->sbTR->values ({15, 30, 60, 120, 300, 900, 1800});
- ui->sbTR->setValue (m_settings->value ("TRPeriod_FST4", 60).toInt()); // remember sbTR settings by mode
- QTimer::singleShot (50, [=] {on_sbTR_valueChanged (ui->sbTR->value());});
- ui->txFirstCheckBox->setEnabled(true);
- statusChanged();
- m_bOK_to_chk=true;
- chk_FST4_freq_range();
-}
-
-void MainWindow::on_actionFST4W_triggered()
-{
- m_mode="FST4W";
- if(m_specOp==SpecOp::HOUND) {
- m_config.setSpecial_None();
- m_specOp=m_config.special_op_id();
- }
- ui->actionFST4W->setChecked(true);
- m_bFast9=false;
- m_bFastMode=false;
- m_fastGraph->hide();
- m_wideGraph->show();
- if (m_tci_audio && ui->bandComboBox->currentText()!="OOB")
- Q_EMIT m_config.transceiver_period(m_TRperiod);
- m_nsps=6912; //For symspec only
- m_FFTSize = m_nsps / 2;
- if (m_tci_audio) Q_EMIT m_config.transceiver_blocksize (m_FFTSize);
- else Q_EMIT FFTSize (m_FFTSize);
- WSPR_config(true);
-// 01234567890123456789012345678901234567
- displayWidgets(nWidgets("00000000000000000101000000000000010000"));
- setup_status_bar(false);
- ui->band_hopping_group_box->setChecked(false);
- ui->band_hopping_group_box->setVisible(false);
- on_sbTR_FST4W_valueChanged (ui->sbTR_FST4W->value ());
- ui->WSPRfreqSpinBox->setMinimum(100);
- ui->WSPRfreqSpinBox->setMaximum(5000);
- m_wideGraph->setMode(m_mode);
- m_wideGraph->setPeriod(m_TRperiod,6912);
- m_wideGraph->setTxFreq(ui->WSPRfreqSpinBox->value());
- m_wideGraph->setRxFreq(ui->sbFST4W_RxFreq->value());
- m_wideGraph->setTol(ui->sbFST4W_FTol->value());
- ui->sbFtol->setValue(100);
- switch_mode (Modes::FST4W);
- statusChanged();
-}
-
-void MainWindow::on_actionFT4_triggered()
-{
- QTimer::singleShot (50, [=] {
- ui->TxFreqSpinBox->setValue(m_settings->value("TxFreq_old",1500).toInt());
- ui->RxFreqSpinBox->setValue(m_settings->value("RxFreq_old",1500).toInt());
- on_sbSubmode_valueChanged(ui->sbSubmode->value());
- ui->cbHoldTxFreq->setChecked (HoldTxFreqStatus);
- });
- m_mode="FT4";
- if(m_specOp==SpecOp::HOUND) {
- m_config.setSpecial_None();
- m_specOp=m_config.special_op_id();
- }
- m_TRperiod=7.5;
- bool bVHF=m_config.enable_VHF_features();
- m_bFast9=false;
- m_bFastMode=false;
- WSPR_config(false);
- switch_mode (Modes::FT4);
- m_nsps=6912;
- m_FFTSize = m_nsps/2;
- if (m_tci_audio) Q_EMIT m_config.transceiver_blocksize (m_FFTSize);
- else Q_EMIT FFTSize (m_FFTSize);
- m_hsymStop=21;
- setup_status_bar (bVHF);
- m_toneSpacing=12000.0/576.0;
- ui->actionFT4->setChecked(true);
- m_wideGraph->setMode(m_mode);
- m_send_RR73=true;
- VHF_features_enabled(bVHF);
- ui->cbAutoSeq->setChecked(true);
- m_fastGraph->hide();
- m_wideGraph->show();
- ui->rh_decodes_headings_label->setText(" UTC dB DT Freq " + tr ("Message"));
- m_wideGraph->setPeriod(m_TRperiod,m_nsps);
- if (m_tci_audio && ui->bandComboBox->currentText()!="OOB")
- Q_EMIT m_config.transceiver_period(m_TRperiod);
- if (!m_tci_audio) {
- m_modulator->setTRPeriod(m_TRperiod); // TODO - not thread safe
- m_detector->setTRPeriod(m_TRperiod); // TODO - not thread safe
- }
- ui->rh_decodes_title_label->setText(tr ("Rx Frequency"));
- ui->lh_decodes_title_label->setText(tr ("Band Activity"));
- ui->lh_decodes_headings_label->setText( " UTC dB DT Freq " + tr ("Message"));
-// 01234567890123456789012345678901234567
- displayWidgets(nWidgets("11101000010011100001000000011000100000"));
- ui->txrb2->setEnabled(true);
- ui->txrb4->setEnabled(true);
- ui->txrb5->setEnabled(true);
- ui->txrb6->setEnabled(true);
- ui->txb2->setEnabled(true);
- ui->txb4->setEnabled(true);
- ui->txb5->setEnabled(true);
- ui->txb6->setEnabled(true);
- ui->txFirstCheckBox->setEnabled(true);
- chkFT4();
- statusChanged();
-}
-
-void MainWindow::on_actionFT8_triggered()
-{
- QTimer::singleShot (50, [=] {
- if(m_specOp!=SpecOp::FOX) ui->TxFreqSpinBox->setValue(m_settings->value("TxFreq_old",1500).toInt());
- if(m_specOp==SpecOp::FOX && !m_config.superFox()) ui->TxFreqSpinBox->setValue(m_TxFreqFox);
- if(SpecOp::HOUND == m_specOp && m_config.superFox()) clearDX();
- on_sbSubmode_valueChanged(ui->sbSubmode->value());
- ui->cbHoldTxFreq->setChecked (HoldTxFreqStatus);
- });
- m_mode="FT8";
- bool bVHF=m_config.enable_VHF_features();
- m_bFast9=false;
- m_bFastMode=false;
- WSPR_config(false);
- m_nsps=6912;
- m_FFTSize = m_nsps / 2;
- if (m_tci_audio) Q_EMIT m_config.transceiver_blocksize (m_FFTSize);
- else Q_EMIT FFTSize (m_FFTSize);
- if (m_multithreadFT8 && !(m_specOp==SpecOp::HOUND && m_config.superFox())) {
- if (m_ft8DecoderStart==0) m_hsymStop=49;
- else if (m_ft8DecoderStart==1) {
- m_hsymStop=50;
- m_earlyDecode2=46;
- }
- else if (m_ft8DecoderStart==2) m_hsymStop=48;
- else if (m_ft8DecoderStart==3) m_hsymStop=49;
- else if (m_ft8DecoderStart==4) m_hsymStop=50;
- } else {
- m_hsymStop=50;
- m_earlyDecode2=47;
- }
- setup_status_bar (bVHF);
- m_toneSpacing=0.0; //???
- ui->actionFT8->setChecked(true); //???
- m_wideGraph->setMode(m_mode);
- VHF_features_enabled(bVHF);
- ui->cbAutoSeq->setChecked(true);
- m_TRperiod=15.0;
- ui->sbFtol->setValue (m_settings->value ("Ftol_SF", 50).toInt()); // restore last used Ftol parameter
- m_fastGraph->hide();
- m_wideGraph->show();
- ui->rh_decodes_headings_label->setText(" UTC dB DT Freq " + tr ("Message"));
- m_wideGraph->setPeriod(m_TRperiod,m_nsps);
- if (m_tci_audio && ui->bandComboBox->currentText()!="OOB")
- Q_EMIT m_config.transceiver_period(m_TRperiod);
- if (!m_tci_audio) {
- m_modulator->setTRPeriod(m_TRperiod); // TODO - not thread safe
- m_detector->setTRPeriod(m_TRperiod); // TODO - not thread safe
- }
- ui->rh_decodes_title_label->setText(tr ("Rx Frequency"));
- if(SpecOp::FOX==m_specOp) {
- ui->lh_decodes_title_label->setText(tr ("Stations calling DXpedition %1").arg (m_config.my_callsign()));
- ui->lh_decodes_headings_label->setText( "Call Grid dB Freq Dist Age Cont Score");
- } else {
- ui->lh_decodes_title_label->setText(tr ("Band Activity"));
- ui->lh_decodes_headings_label->setText( " UTC dB DT Freq " + tr ("Message"));
- }
-
-// 01234567890123456789012345678901234567
- displayWidgets(nWidgets("11101000010011100001000010011000100000"));
- ui->txrb2->setEnabled(true);
- ui->txrb4->setEnabled(true);
- ui->txrb5->setEnabled(true);
- ui->txrb6->setEnabled(true);
- ui->txb2->setEnabled(true);
- ui->txb4->setEnabled(true);
- ui->txb5->setEnabled(true);
- ui->txb6->setEnabled(true);
- ui->txFirstCheckBox->setEnabled(true);
- ui->cbAutoSeq->setEnabled(true);
- if(SpecOp::FOX==m_specOp) {
- ui->txFirstCheckBox->setChecked(true);
- ui->txFirstCheckBox->setEnabled(false);
- ui->cbHoldTxFreq->setChecked(true);
- ui->cbAutoSeq->setEnabled(false);
- ui->tabWidget->setCurrentIndex(1);
- m_wideGraph->setSuperFox(false);
- if(m_config.superFox()) {
- ui->TxFreqSpinBox->setValue(750); //SuperFox transmits at 750 Hz
- m_wideGraph->setSuperFox(true);
- } else {
- ui->TxFreqSpinBox->setValue(500);
- }
- // 01234567890123456789012345678901234567
- displayWidgets(nWidgets("11101000010011100001000000000011000000"));
- ui->cbRxAll->setText(tr("Show Already Worked"));
- if(m_config.superFox()) {
- ui->labDXped->setText(tr ("Super Fox"));
- } else {
- ui->labDXped->setText(tr ("Fox"));
- }
- on_fox_log_action_triggered();
- if (m_ActiveStationsWidget) m_ActiveStationsWidget->setClickOK(true); // allow clicks
- }
- if(SpecOp::HOUND == m_specOp) {
- ui->houndButton->setChecked(true);
- ui->txFirstCheckBox->setChecked(false);
- ui->txFirstCheckBox->setEnabled(false);
- ui->cbAutoSeq->setEnabled(false);
- ui->tabWidget->setCurrentIndex(0);
- ui->cbHoldTxFreq->setChecked(true);
- m_wideGraph->setSuperHound(false);
- if(m_config.superFox()) {
- // 01234567890123456789012345678901234567
- displayWidgets(nWidgets("11111000010011000001000000000011000000"));
- ui->labDXped->setText(tr ("Super Hound"));
- ui->cbRxAll->setEnabled(false);
- m_wideGraph->setRxFreq(ui->RxFreqSpinBox->value());
- m_wideGraph->setTol(ui->sbFtol->value());
- m_wideGraph->setSuperHound(true);
- clearDX();
- if(ui->RxFreqSpinBox->value() < 700 or ui->RxFreqSpinBox->value() > 800)
- ui->RxFreqSpinBox->setValue(750);
- } else {
- // 01234567890123456789012345678901234567
- displayWidgets(nWidgets("11101000010011000001000000000011000000"));
- ui->labDXped->setText(tr ("Hound"));
- ui->cbRxAll->setEnabled(true);
- m_wideGraph->setSuperHound(false);
- ui->RxFreqSpinBox->setValue(m_settings->value("RxFreq_old",1500).toInt());
- }
- ui->txrb1->setChecked(true);
- ui->txrb2->setEnabled(false);
- ui->txrb4->setEnabled(false);
- ui->txrb5->setEnabled(false);
- ui->txrb6->setEnabled(false);
- ui->txb2->setEnabled(false);
- ui->txb4->setEnabled(false);
- ui->txb5->setEnabled(false);
- ui->txb6->setEnabled(false);
- if (m_ActiveStationsWidget) m_ActiveStationsWidget->setClickOK(false);
- } else {
- switch_mode (Modes::FT8);
- }
- if(m_specOp != SpecOp::HOUND) {
- ui->houndButton->setChecked(false);
- m_wideGraph->setSuperHound(false);
- }
-
- m_specOp=m_config.special_op_id();
- if(m_specOp!=SpecOp::NONE and m_specOp!=SpecOp::FOX and m_specOp!=SpecOp::HOUND) {
- QString t0="";
- if(SpecOp::NA_VHF==m_specOp) t0="NA VHF";
- if(SpecOp::EU_VHF==m_specOp) t0="EU VHF";
- if(SpecOp::FIELD_DAY==m_specOp) t0="Field Day";
- if(SpecOp::RTTY==m_specOp) t0="FT RU";
- if(SpecOp::WW_DIGI==m_specOp) t0="WW Digi";
- if(SpecOp::ARRL_DIGI==m_specOp) t0="ARRL Digi";
- if(SpecOp::Q65_PILEUP==m_specOp) t0="Q65 Pileup";
- if(t0=="") {
- ui->labDXped->setVisible(false);
- } else {
- ui->labDXped->setVisible(true);
- ui->labDXped->setText(t0);
- }
- if(m_specOp!=SpecOp::Q65_PILEUP) on_contest_log_action_triggered();
- }
-
- if((SpecOp::FOX==m_specOp or SpecOp::HOUND==m_specOp) and !m_config.superFox() and !m_config.split_mode()
- and !m_bWarnedSplit and m_config.rig_name() != "None") {
- QString errorMsg;
- MessageBox::critical_message (this,
- "Operation in FT8 DXpedition mode normally requires\n"
- " *Split* rig control (either *Rig* or *Fake It* on\n"
- "the *Settings | Radio* tab.)", errorMsg);
- m_bWarnedSplit=true;
- }
- if (ui->labDXped->isVisible()) ui->labDXped->setStyleSheet("QLabel {background-color: red; color: white;}");
- statusChanged();
- configActiveStations();
-}
-
-void MainWindow::on_actionJT4_triggered()
-{
- QTimer::singleShot (50, [=] {
- ui->TxFreqSpinBox->setValue(m_settings->value("TxFreq_old",1500).toInt());
- ui->RxFreqSpinBox->setValue(m_settings->value("RxFreq_old",1500).toInt());
- });
- m_mode="JT4";
- if(m_specOp==SpecOp::HOUND) {
- m_config.setSpecial_None();
- m_specOp=m_config.special_op_id();
- }
- bool bVHF=m_config.enable_VHF_features();
- WSPR_config(false);
- switch_mode (Modes::JT4);
- m_TRperiod=60.0;
- if (m_tci_audio && ui->bandComboBox->currentText()!="OOB")
- Q_EMIT m_config.transceiver_period(m_TRperiod);
- if (!m_tci_audio) {
- m_modulator->setTRPeriod(m_TRperiod); // TODO - not thread safe
- m_detector->setTRPeriod(m_TRperiod); // TODO - not thread safe
- }
- m_nsps=6912; //For symspec only
- m_FFTSize = m_nsps / 2;
- if (m_tci_audio) Q_EMIT m_config.transceiver_blocksize (m_FFTSize);
- else Q_EMIT FFTSize (m_FFTSize);
- m_hsymStop=176;
- if(m_config.decode_at_52s()) m_hsymStop=184;
- m_toneSpacing=0.0;
- ui->actionJT4->setChecked(true);
- VHF_features_enabled(true);
- m_wideGraph->setPeriod(m_TRperiod,m_nsps);
- m_wideGraph->setMode(m_mode);
- m_bFastMode=false;
- m_bFast9=false;
- setup_status_bar (bVHF);
- ui->sbSubmode->setMaximum(6);
- ui->lh_decodes_headings_label->setText("UTC dB DT Freq " + tr ("Message"));
- ui->rh_decodes_headings_label->setText("UTC dB DT Freq " + tr ("Message"));
- if(bVHF) {
- // restore last used parameters
- ui->sbFtol->setValue (m_settings->value ("Ftol_JT4", 50).toInt());
- m_nSubMode=m_settings->value("SubMode_JT4",0).toInt();
- ui->sbSubmode->setValue(m_settings->value("SubMode_JT4",0).toInt());
- QTimer::singleShot (50, [=] {on_sbSubmode_valueChanged(ui->sbSubmode->value());});
- m_bShMsgs=m_settings->value("ShMsgs_JT4",false).toBool();
- ui->cbShMsgs->setChecked(m_bShMsgs);
- } else {
- ui->sbSubmode->setValue(0);
- }
- if(bVHF) {
- // 01234567890123456789012345678901234567
- displayWidgets(nWidgets("11111001011011011011110000010000000000"));
- } else {
- displayWidgets(nWidgets("11101000010011000011000000010000000000"));
- }
- fast_config(false);
- ui->txFirstCheckBox->setEnabled(true);
- statusChanged();
-}
-
-void MainWindow::on_actionJT9_triggered()
-{
- m_mode="JT9";
- if(m_specOp==SpecOp::HOUND) {
- m_config.setSpecial_None();
- m_specOp=m_config.special_op_id();
- }
- bool bVHF=m_config.enable_VHF_features();
- // restore last used parameters
- if(bVHF && m_mode!="JT65" && !blocked) {
- ui->sbSubmode->setMaximum(7);
- m_bFast9=m_settings->value("JT9_Fast",false).toBool();
- ui->cbFast9->setChecked(m_bFast9 or m_bFastMode);
- ui->sbFtol->setValue (m_settings->value ("Ftol_JT9", 50).toInt());
- m_nSubMode=m_settings->value("SubMode",0).toInt();
- ui->sbSubmode->setValue(m_nSubMode);
- QTimer::singleShot (50, [=] {
- on_sbTR_valueChanged (ui->sbTR->value());
- on_sbSubmode_valueChanged(ui->sbSubmode->value());
- });
- }
-// m_bFast9=ui->cbFast9->isChecked();
- m_bFastMode=m_bFast9;
- WSPR_config(false);
- switch_mode (Modes::JT9);
- m_nsps=6912;
- m_FFTSize = m_nsps / 2;
- if (m_tci_audio) Q_EMIT m_config.transceiver_blocksize (m_FFTSize);
- else Q_EMIT FFTSize (m_FFTSize);
- m_hsymStop=173;
- if(m_config.decode_at_52s()) m_hsymStop=179;
- setup_status_bar (bVHF);
- m_toneSpacing=0.0;
- ui->actionJT9->setChecked(true);
- m_wideGraph->setMode(m_mode);
- VHF_features_enabled(bVHF);
- if(m_nSubMode>=4 and bVHF) {
- ui->cbFast9->setEnabled(true);
- } else {
- ui->cbFast9->setEnabled(false);
- ui->cbFast9->setChecked(false);
- }
- ui->sbSubmode->setMaximum(7);
- if(m_bFast9) {
- ui->sbTR->values ({5, 10, 15, 30});
- if(bVHF && m_mode!="JT65" && !blocked) ui->sbTR->setValue (m_settings->value ("TRPeriod", 15).toInt()); // restore last used TRperiod
- on_sbTR_valueChanged (ui->sbTR->value());
- m_wideGraph->hide();
- m_fastGraph->showNormal();
- ui->TxFreqSpinBox->setValue(700);
- ui->RxFreqSpinBox->setValue(700);
- ui->lh_decodes_headings_label->setText(" UTC dB T Freq " + tr ("Message"));
- ui->rh_decodes_headings_label->setText(" UTC dB T Freq " + tr ("Message"));
- } else {
-// ui->cbAutoSeq->setChecked(false);
- if (m_mode != "FST4")
- {
- m_TRperiod=60.0;
- ui->lh_decodes_headings_label->setText("UTC dB DT Freq " + tr ("Message"));
- ui->rh_decodes_headings_label->setText("UTC dB DT Freq " + tr ("Message"));
- }
- }
- m_wideGraph->setPeriod(m_TRperiod,m_nsps);
- if (m_tci_audio && ui->bandComboBox->currentText()!="OOB")
- Q_EMIT m_config.transceiver_period(m_TRperiod);
- if (!m_tci_audio) {
- m_modulator->setTRPeriod(m_TRperiod); // TODO - not thread safe
- m_detector->setTRPeriod(m_TRperiod); // TODO - not thread safe
- }
- ui->lh_decodes_title_label->setText(tr ("Band Activity"));
- ui->rh_decodes_title_label->setText(tr ("Rx Frequency"));
- if(bVHF) {
- // 01234567890123456789012345678901234567
- displayWidgets(nWidgets("11111010110011111001000000010000000000"));
- } else {
- displayWidgets(nWidgets("11101000010011100001000000010000100000"));
- }
- fast_config(m_bFastMode);
-// ui->cbAutoSeq->setVisible(m_bFast9);
- ui->txFirstCheckBox->setEnabled(true);
- statusChanged();
-}
-
-void MainWindow::on_actionJT65_triggered()
-{
- QTimer::singleShot (50, [=] {
- ui->TxFreqSpinBox->setValue(m_settings->value("TxFreq_old",1500).toInt());
- ui->RxFreqSpinBox->setValue(m_settings->value("RxFreq_old",1500).toInt());
- });
- on_actionJT9_triggered();
- m_mode="JT65";
- if(m_specOp==SpecOp::HOUND) {
- m_config.setSpecial_None();
- m_specOp=m_config.special_op_id();
- }
- bool bVHF=m_config.enable_VHF_features();
- WSPR_config(false);
- switch_mode (Modes::JT65);
- m_TRperiod=60.0;
- if (m_tci_audio && ui->bandComboBox->currentText()!="OOB")
- Q_EMIT m_config.transceiver_period(m_TRperiod);
- if (!m_tci_audio) {
- m_modulator->setTRPeriod(m_TRperiod); // TODO - not thread safe
- m_detector->setTRPeriod(m_TRperiod); // TODO - not thread safe
- }
- m_nsps=6912; //For symspec only
- m_FFTSize = m_nsps / 2;
- if (m_tci_audio) Q_EMIT m_config.transceiver_blocksize (m_FFTSize);
- else Q_EMIT FFTSize (m_FFTSize);
- m_hsymStop=174;
- if(m_config.decode_at_52s()) m_hsymStop=183;
- m_toneSpacing=0.0;
- ui->actionJT65->setChecked(true);
- VHF_features_enabled(bVHF);
- m_wideGraph->setPeriod(m_TRperiod,m_nsps);
- m_wideGraph->setMode(m_mode);
- m_wideGraph->setRxFreq(ui->RxFreqSpinBox->value());
- m_wideGraph->setTol(ui->sbFtol->value());
- m_wideGraph->setTxFreq(ui->TxFreqSpinBox->value());
- setup_status_bar (bVHF);
- m_bFastMode=false;
- m_bFast9=false;
- ui->sbSubmode->setMaximum(2);
- if(bVHF) {
- // restore last used parameters
- ui->sbFtol->setValue (m_settings->value ("Ftol_JT65", 50).toInt());
- m_nSubMode=m_settings->value("SubMode_JT65",0).toInt();
- ui->sbSubmode->setValue(m_settings->value("SubMode_JT65",0).toInt());
- QTimer::singleShot (50, [=] {on_sbSubmode_valueChanged(ui->sbSubmode->value());});
- m_bShMsgs=m_settings->value("ShMsgs_JT65",false).toBool();
- ui->cbShMsgs->setChecked(m_bShMsgs);
- } else {
- ui->sbSubmode->setValue(0);
- ui->lh_decodes_title_label->setText(tr ("Band Activity"));
- ui->rh_decodes_title_label->setText(tr ("Rx Frequency"));
- }
- if(bVHF) {
- // 01234567890123456789012345678901234567
- displayWidgets(nWidgets("11111001010011011010110001010000000000"));
- } else {
- displayWidgets(nWidgets("11101000010011100001000000010000100000"));
- }
- fast_config(false);
-// if(ui->cbShMsgs->isChecked()) {
-// ui->cbAutoSeq->setChecked(false);
-// ui->cbAutoSeq->setVisible(false);
-// }
- if (m_config.decode_at_52s() && m_config.auto_astro() && !ui->actionAstronomical_data->isChecked())
- ui->actionAstronomical_data->setChecked (true);
- ui->txFirstCheckBox->setEnabled(true);
- statusChanged();
-}
-
-void MainWindow::on_actionQ65_triggered()
-{
- QTimer::singleShot (50, [=] {
- ui->TxFreqSpinBox->setValue(m_settings->value("TxFreq_old",1500).toInt());
- ui->RxFreqSpinBox->setValue(m_settings->value("RxFreq_old",1500).toInt());
- });
- m_mode="Q65";
- if(m_specOp==SpecOp::HOUND) {
- m_config.setSpecial_None();
- m_specOp=m_config.special_op_id();
- }
- ui->actionQ65->setChecked(true);
- switch_mode(Modes::Q65);
- ui->cbAutoSeq->setChecked(true);
- fast_config(false);
- WSPR_config(false);
- setup_status_bar(true);
- m_bFastMode=false;
- m_bFast9=false;
- m_nsps=6912; //For symspec only
- m_FFTSize = m_nsps / 2;
- if (m_tci_audio) Q_EMIT m_config.transceiver_blocksize (m_FFTSize);
- else Q_EMIT FFTSize (m_FFTSize);
- m_hsymStop=49;
- ui->sbTR->values ({15, 30, 60, 120, 300});
- // restore last used parameters
- ui->sbTR->setValue (m_settings->value ("TRPeriod_Q65", 30).toInt());
- ui->sbFtol->setValue (m_settings->value ("Ftol_Q65", 50).toInt());
- m_nSubMode=m_settings->value("SubMode_Q65",0).toInt();
- ui->sbSubmode->setValue(m_settings->value("SubMode_Q65",0).toInt());
- QTimer::singleShot (50, [=] {
- on_sbTR_valueChanged (ui->sbTR->value());
- on_sbSubmode_valueChanged(ui->sbSubmode->value());
- });
- m_bShMsgs=m_settings->value("ShMsgs_Q65",false).toBool();
- ui->cbShMsgs->setChecked(m_bShMsgs);
- QString fname {QDir::toNativeSeparators(m_config.temp_dir().absoluteFilePath ("red.dat"))};
- m_wideGraph->setRedFile(fname);
- m_wideGraph->setMode(m_mode);
- m_wideGraph->setPeriod(m_TRperiod,6912);
- m_wideGraph->setTol(ui->sbFtol->value());
- m_wideGraph->setRxFreq(ui->RxFreqSpinBox->value());
- m_wideGraph->setTxFreq(ui->TxFreqSpinBox->value());
- switch_mode (Modes::Q65);
-// 01234567890123456789012345678901234567
- displayWidgets(nWidgets("11111101011011010011100000010000000011"));
- ui->lh_decodes_headings_label->setText("UTC dB DT Freq " + tr ("Message"));
- ui->rh_decodes_headings_label->setText("UTC dB DT Freq " + tr ("Message"));
- if (m_tci_audio && ui->bandComboBox->currentText()!="OOB")
- Q_EMIT m_config.transceiver_period(m_TRperiod);
-
- m_specOp=m_config.special_op_id();
- if(m_specOp!=SpecOp::NONE and m_specOp!=SpecOp::FOX and m_specOp!=SpecOp::HOUND) {
- QString t0="";
- if(SpecOp::NA_VHF==m_specOp) t0="NA VHF";
- if(SpecOp::EU_VHF==m_specOp) t0="EU VHF";
- if(SpecOp::FIELD_DAY==m_specOp) t0="Field Day";
- if(SpecOp::RTTY==m_specOp) t0="FT RU";
- if(SpecOp::WW_DIGI==m_specOp) t0="WW Digi";
- if(SpecOp::ARRL_DIGI==m_specOp) t0="ARRL Digi";
- if(SpecOp::Q65_PILEUP==m_specOp) t0="Q65 Pileup";
- if(t0=="") {
- ui->labDXped->setVisible(false);
- } else {
- ui->labDXped->setVisible(true);
- ui->labDXped->setText(t0);
- }
- if(m_specOp!=SpecOp::Q65_PILEUP) {
- on_contest_log_action_triggered();
- } else {
- if(ui->txrb1->isChecked()) on_txb2_clicked();
- ui->tx1->setEnabled(true);
- ui->txb1->setEnabled(true);
- }
- }
- if (m_config.decode_at_52s() && m_config.auto_astro() && !ui->actionAstronomical_data->isChecked())
- ui->actionAstronomical_data->setChecked (true);
- ui->txFirstCheckBox->setEnabled(true);
- statusChanged();
-}
-
-void MainWindow::on_actionMSK144_triggered()
-{
- m_hsymStop=105;
- m_TRperiod=ui->sbTR->value();
- if(SpecOp::EU_VHF < m_specOp) {
-// We are rejecting the requested mode change, so re-check the old mode
- if("FT8"==m_mode) ui->actionFT8->setChecked(true);
- if("JT4"==m_mode) ui->actionJT4->setChecked(true);
- if("JT9"==m_mode) ui->actionJT9->setChecked(true);
- if("JT65"==m_mode) ui->actionJT65->setChecked(true);
- if("Q65"==m_mode) ui->actionQ65->setChecked(true);
- if("WSPR"==m_mode) ui->actionWSPR->setChecked(true);
- if("Echo"==m_mode) ui->actionEcho->setChecked(true);
- if("FreqCal"==m_mode) ui->actionFreqCal->setChecked(true);
- if("FST4"==m_mode) ui->actionFST4->setChecked(true);
- if("FST4W"==m_mode) ui->actionFST4W->setChecked(true);
-// Make sure that MSK144 is not checked.
- ui->actionMSK144->setChecked(false);
- MessageBox::warning_message (this, tr ("Improper mode"),
- "MSK144 not available if Fox, Hound, Field Day, FT Roundup, WW Digi. or ARRL Digi contest is selected.");
- return;
- }
- m_mode="MSK144";
- if(m_specOp==SpecOp::HOUND) {
- m_config.setSpecial_None();
- m_specOp=m_config.special_op_id();
- }
- ui->actionMSK144->setChecked(true);
- switch_mode (Modes::MSK144);
- m_nsps=6;
- m_FFTSize = 7 * 512;
- if (m_tci_audio) Q_EMIT m_config.transceiver_blocksize (m_FFTSize);
- else Q_EMIT FFTSize (m_FFTSize);
- setup_status_bar (true);
- m_toneSpacing=0.0;
- WSPR_config(false);
- VHF_features_enabled(true);
- ui->cbAutoSeq->setChecked(true);
- m_bFastMode=true;
- m_bFast9=false;
- ui->sbTR->values ({5, 10, 15, 30});
- // restore last used parameters
- if (!(m_currentBand=="6m" or m_currentBand=="4m" or m_currentBand=="2m")) ui->sbTR->setValue (m_settings->value ("TRPeriod_MSK144", 30).toInt());
- if (m_currentBand=="6m" or m_currentBand=="4m") ui->sbTR->setValue (m_settings->value ("TRPeriod_MSK144_6m", 15).toInt());
- if (m_currentBand=="2m") ui->sbTR->setValue (m_settings->value ("TRPeriod_MSK144_2m", 30).toInt());
- ui->txFirstCheckBox->setEnabled(true);
- QTimer::singleShot (50, [=] {on_sbTR_valueChanged (ui->sbTR->value());});
- ui->sbFtol->setValue (m_settings->value ("Ftol_MSK144", 50).toInt()); // restore last used parameter
- m_bShMsgs=m_settings->value("ShMsgs_MSK144",false).toBool();
- ui->cbShMsgs->setChecked(m_bShMsgs);
- m_wideGraph->hide();
- m_fastGraph->showNormal();
- ui->TxFreqSpinBox->setValue(1500);
- ui->RxFreqSpinBox->setValue(1500);
- ui->RxFreqSpinBox->setMinimum(1400);
- ui->RxFreqSpinBox->setMaximum(1600);
- ui->RxFreqSpinBox->setSingleStep(10);
- ui->lh_decodes_headings_label->setText(" UTC dB T Freq " + tr ("Message"));
- ui->rh_decodes_headings_label->setText(" UTC dB T Freq " + tr ("Message"));
- if (m_tci_audio && ui->bandComboBox->currentText()!="OOB")
- Q_EMIT m_config.transceiver_period(m_TRperiod);
- if (!m_tci_audio) {
- m_modulator->setTRPeriod(m_TRperiod); // TODO - not thread safe
- m_detector->setTRPeriod(m_TRperiod); // TODO - not thread safe
- }
- m_fastGraph->setTRPeriod(m_TRperiod);
- ui->lh_decodes_title_label->setText(tr ("Band Activity"));
- ui->rh_decodes_title_label->setText(tr ("Tx Messages"));
- ui->actionMSK144->setChecked(true);
- ui->rptSpinBox->setMinimum(-8);
- ui->rptSpinBox->setMaximum(24);
- ui->rptSpinBox->setValue(0);
- ui->rptSpinBox->setSingleStep(1);
- ui->sbFtol->values ({20, 50, 100, 150, 200, 250, 300, 350, 400, 450, 500});
- // 01234567890123456789012345678901234567
- displayWidgets(nWidgets("10111111010000000001000100011000000000"));
- fast_config(m_bFastMode);
- statusChanged();
-
- QString t0="";
- if(SpecOp::NA_VHF==m_specOp) t0="NA VHF";
- if(SpecOp::EU_VHF==m_specOp) t0="EU VHF";
- if(t0=="") {
- ui->labDXped->setVisible(false);
- } else {
- ui->labDXped->setVisible(true);
- ui->labDXped->setText(t0);
- on_contest_log_action_triggered();
- }
- if(!(programStart or m_freqNominal == 0)) m_msk144basefreq = m_freqNominal; // MSK144 QSY
-}
-
-void MainWindow::on_actionWSPR_triggered()
-{
- m_mode="WSPR";
- if(m_specOp==SpecOp::HOUND) {
- m_config.setSpecial_None();
- m_specOp=m_config.special_op_id();
- }
- WSPR_config(true);
- switch_mode (Modes::WSPR);
- m_TRperiod=120.0;
- if (m_tci_audio && ui->bandComboBox->currentText()!="OOB")
- Q_EMIT m_config.transceiver_period(m_TRperiod);
- if (!m_tci_audio) {
- m_modulator->setTRPeriod(m_TRperiod); // TODO - not thread safe
- m_detector->setTRPeriod(m_TRperiod); // TODO - not thread safe
- }
- m_nsps=6912; //For symspec only
- m_FFTSize = m_nsps / 2;
- if (m_tci_audio) Q_EMIT m_config.transceiver_blocksize (m_FFTSize);
- else Q_EMIT FFTSize (m_FFTSize);
- m_hsymStop=396;
- m_toneSpacing=12000.0/8192.0;
- setup_status_bar (false);
- ui->actionWSPR->setChecked(true);
- VHF_features_enabled(false);
- ui->WSPRfreqSpinBox->setMinimum(1400);
- ui->WSPRfreqSpinBox->setMaximum(1600);
- m_wideGraph->setPeriod(m_TRperiod,m_nsps);
- m_wideGraph->setMode(m_mode);
- m_bFastMode=false;
- m_bFast9=false;
- ui->TxFreqSpinBox->setValue(ui->WSPRfreqSpinBox->value());
- // 01234567890123456789012345678901234567
- displayWidgets(nWidgets("00000000000000000101000000000000000000"));
- fast_config(false);
- statusChanged();
-}
-
-void MainWindow::on_actionEcho_triggered()
-{
- int nd=int(m_ndepth&3);
- on_actionJT4_triggered();
- // Don't allow decoding depth to be changed just because Echo mode was entered:
- if(nd==1) ui->actionQuickDecode->setChecked (true);
- if(nd==2) ui->actionMediumDecode->setChecked (true);
- if(nd==3) ui->actionDeepestDecode->setChecked (true);
-
- m_mode="Echo";
- if(m_specOp==SpecOp::HOUND) {
- m_config.setSpecial_None();
- m_specOp=m_config.special_op_id();
- }
- ui->actionEcho->setChecked(true);
- m_TRperiod=3.0;
- if (m_tci_audio && ui->bandComboBox->currentText()!="OOB")
- Q_EMIT m_config.transceiver_period(m_TRperiod);
- if (!m_tci_audio) {
- m_modulator->setTRPeriod(m_TRperiod); // TODO - not thread safe
- m_detector->setTRPeriod(m_TRperiod); // TODO - not thread safe
- }
- m_nsps=6912; //For symspec only
- m_FFTSize = m_nsps / 2;
- if (m_tci_audio) Q_EMIT m_config.transceiver_blocksize (m_FFTSize);
- else Q_EMIT FFTSize (m_FFTSize);
- m_hsymStop=9;
- m_toneSpacing=1.0;
- switch_mode(Modes::Echo);
- setup_status_bar (true);
- m_wideGraph->setMode(m_mode);
- ui->TxFreqSpinBox->setValue(1500);
- ui->TxFreqSpinBox->setEnabled (false);
- if(!m_echoGraph->isVisible()) m_echoGraph->show();
- if (!ui->actionAstronomical_data->isChecked ()) {
- ui->actionAstronomical_data->setChecked (true);
- }
- m_bFastMode=false;
- m_bFast9=false;
- WSPR_config(true);
- ui->lh_decodes_headings_label->setText(" UTC Hour Level Doppler Width N Q DF SNR dBerr DT TS EchoMsg");
- // 01234567890123456789012345678901234567
- displayWidgets(nWidgets("00000000000000000010001000000000000000"));
- fast_config(false);
- ui->sbEchoAvg->values ({1, 2, 5, 10, 20, 50, 100});
- statusChanged();
- monitor(false); //Don't auto-start Monitor in Echo mode.
-
- // Ensure that the correct frequency is set and displayed
- QTimer::singleShot (500, [=] {
- auto const& row = m_config.frequencies ()->best_working_frequency (m_freqNominal);
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0) on_bandComboBox_activated (row);
- if (m_monitoring) ui->monitorButton->click();
- });
-}
-
-void MainWindow::on_actionFreqCal_triggered()
-{
- on_actionJT9_triggered();
- m_mode="FreqCal";
- if(m_specOp==SpecOp::HOUND) {
- m_config.setSpecial_None();
- m_specOp=m_config.special_op_id();
- }
- ui->actionFreqCal->setChecked(true);
- switch_mode(Modes::FreqCal);
- m_wideGraph->setMode(m_mode);
- ui->sbTR->values ({5, 10, 15, 30});
- on_sbTR_valueChanged (ui->sbTR->value());
- if (m_tci_audio && ui->bandComboBox->currentText()!="OOB")
- Q_EMIT m_config.transceiver_period(m_TRperiod);
- if (!m_tci_audio) {
- m_modulator->setTRPeriod(m_TRperiod); // TODO - not thread safe
- m_detector->setTRPeriod(m_TRperiod); // TODO - not thread safe
- }
- m_nsps=6912; //For symspec only
- m_FFTSize = m_nsps / 2;
- if (m_tci_audio) Q_EMIT m_config.transceiver_blocksize (m_FFTSize);
- else Q_EMIT FFTSize (m_FFTSize);
- m_hsymStop=((int(m_TRperiod/0.288))/8)*8;
- m_frequency_list_fcal_iter = m_config.frequencies ()->begin ();
- ui->RxFreqSpinBox->setValue(1500);
- setup_status_bar (true);
-// 18:15:47 0 1 1500 1550.349 0.100 3.5 10.2
- ui->lh_decodes_headings_label->setText(" UTC Freq CAL Offset fMeas DF Level S/N");
- ui->measure_check_box->setChecked (false);
- // 01234567890123456789012345678901234567
- displayWidgets(nWidgets("00110100000000000000000000000100000000"));
- statusChanged();
-}
-
-void MainWindow::switch_mode (Mode mode)
-{
- no_a7_decodes = true; // Don't allow a7 decodes during the first period because they can be leftovers from the previous mode
- msk144qsy = false; // MSK144 QSY
- QTimer::singleShot ((int(1500.0*m_TRperiod)), [=] {no_a7_decodes = false;});
- if (m_mode != "Q65" && m_specOp==SpecOp::Q65_PILEUP) {
- m_config.setSpecial_None();
- m_specOp=m_config.special_op_id();
- ui->tx1->setEnabled(true);
- ui->txb1->setEnabled(true);
- }
- m_fastGraph->setMode(m_mode);
- m_config.frequencies ()->filter (m_config.region (), mode, true); // filter on current time
- auto const& row = m_config.frequencies ()->best_working_frequency (m_freqNominal);
- if (!keep_frequency) {
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0 ) {
- on_bandComboBox_activated (row);
- }
- }
- ui->rptSpinBox->setSingleStep(1);
- ui->rptSpinBox->setMinimum(-50);
- ui->rptSpinBox->setMaximum(49);
- ui->sbFtol->values ({1, 2, 5, 10, 20, 50, 100, 150, 200, 250, 300, 350, 400, 450, 500, 600, 700, 800, 900, 1000});
- ui->sbFST4W_FTol->values({1, 2, 5, 10, 20, 50, 100});
- if(m_mode=="MSK144") {
- ui->RxFreqSpinBox->setMinimum(1400);
- ui->RxFreqSpinBox->setMaximum(1600);
- ui->RxFreqSpinBox->setSingleStep(25);
- } else {
- ui->RxFreqSpinBox->setMinimum(200); // UR 200->100
- ui->RxFreqSpinBox->setMaximum(5000);
- ui->RxFreqSpinBox->setSingleStep(1);
- }
- bool b=m_mode=="FreqCal";
- ui->tabWidget->setVisible(!b);
- if(b) {
- ui->DX_controls_widget->setVisible(false);
- ui->rh_decodes_widget->setVisible (false); // UR disable for AL + widescreen versions
- ui->lh_decodes_title_label->setVisible(false);
- }
- QTimer::singleShot (500, [=] {
- if (!(m_mode=="Echo" or ((m_mode=="Q65" or m_mode=="JT65") && m_config.decode_at_52s()))
- && ui->actionAstronomical_data->isChecked () && m_config.auto_astro()) ui->actionAstronomical_data->setChecked (false);
- });
- check_button_color();
-}
-
-void MainWindow::WSPR_config(bool b)
-{
- ui->rh_decodes_widget->setVisible(!b); // UR disable for AL + widescreen version
- ui->controls_stack_widget->setCurrentIndex (b && m_mode != "Echo" ? 1 : 0);
- if(m_mode=="Echo") ui->controls_stack_widget->setCurrentIndex(2);
- ui->QSO_controls_widget->setVisible (!b);
- ui->DX_controls_widget->setVisible (!b or (m_mode=="Echo"));
- ui->WSPR_controls_widget->setVisible (b);
- ui->lh_decodes_title_label->setVisible(!b and ui->cbMenus->isChecked());
- ui->logQSOButton->setVisible(!b);
- ui->DecodeButton->setEnabled(!b);
- bool bFST4W=(m_mode=="FST4W");
- ui->sbTxPercent->setEnabled(!bFST4W or (tr("Random") == ui->RoundRobin->currentText()));
- ui->band_hopping_group_box->setVisible(true);
- ui->RoundRobin->setVisible(bFST4W);
- ui->sbFST4W_RxFreq->setVisible(bFST4W);
- ui->sbFST4W_FTol->setVisible(bFST4W);
- ui->RoundRobin->lineEdit()->setAlignment(Qt::AlignCenter);
- if(b and m_mode!="Echo" and m_mode!="FST4W") {
- QString t="UTC dB DT Freq Drift Call Grid dBm ";
- if(m_config.miles()) t += " mi";
- if(!m_config.miles()) t += " km";
- ui->lh_decodes_headings_label->setText(t);
- if (m_config.is_transceiver_online ()) {
- m_config.transceiver_tx_frequency (0); // turn off split
- }
- m_bSimplex = true;
- } else
- {
- m_bSimplex = false;
- }
- enable_DXCC_entity (m_config.DXCC ()); // sets text window proportions and (re)inits the logbook
-}
-
-void MainWindow::fast_config(bool b)
-{
- m_bFastMode=b;
- ui->TxFreqSpinBox->setEnabled(!b);
- ui->sbTR->setVisible(b);
- if(b and (m_bFast9 or m_mode=="MSK144")) {
- m_wideGraph->hide();
- m_fastGraph->showNormal();
- } else {
- m_wideGraph->showNormal();
- m_fastGraph->hide();
- }
-}
-
-void MainWindow::on_TxFreqSpinBox_valueChanged(int n)
-{
- if (m_config.superFox() && m_specOp==SpecOp::FOX && n!=750) {
- ui->TxFreqSpinBox->setValue(750);
- m_wideGraph->setTxFreq(750);
- return;
- }
- m_config.transceiver_tune (false); // reset rig tuning
- m_wideGraph->setTxFreq(n);
-// if (ui->cbHoldTxFreq->isChecked ()) ui->RxFreqSpinBox->setValue(n);
- if(m_mode!="MSK144") {
- if (m_tci_audio) Q_EMIT m_config.transceiver_trfrequency(n - m_XIT);
- else Q_EMIT transmitFrequency (n - m_XIT);
- }
-
- if(m_mode=="Q65") {
- if(((m_nSubMode==5 && m_TRperiod==120.0) || (m_nSubMode==4 && m_TRperiod==60.0) || (m_nSubMode==3 && m_TRperiod==30.0) ||
- (m_nSubMode==2 && m_TRperiod==15.0)) && abs(ui->TxFreqSpinBox->value() - 700) > 15) {
- ui->TxFreqSpinBox->setStyleSheet("QSpinBox{background-color:red; color:white}");
- } else {
- ui->TxFreqSpinBox->setStyleSheet("");
- }
- }
- if (m_mode != "MSK144" && m_mode != "FST4W" && m_mode != "WSPR" && m_mode != "Echo" && m_mode != "FreqCal"
- && m_specOp!=SpecOp::FOX) {
- QTimer::singleShot (200, [=] {m_settings->setValue("TxFreq_old",ui->TxFreqSpinBox->value());});
- }
- if(m_specOp==SpecOp::FOX && !m_config.superFox()) QTimer::singleShot (50, [=] {m_TxFreqFox=n;});
- statusUpdate ();
-}
-
-void MainWindow::on_RxFreqSpinBox_valueChanged(int n)
-{
- if (m_config.superFox() && m_specOp==SpecOp::HOUND) {
- if (ui->RxFreqSpinBox->value() < 200) {
- ui->RxFreqSpinBox->setValue(200);
- return;
- }
- if (ui->RxFreqSpinBox->value() > 1400) {
- ui->RxFreqSpinBox->setValue(1400);
- return;
- }
- }
- m_wideGraph->setRxFreq(n);
- if (m_mode == "FreqCal") {
- setRig ();
- }
- if (m_mode != "MSK144" && m_mode != "FST4W" && m_mode != "WSPR" && m_mode != "Echo" && m_mode != "FreqCal"
- && !(SpecOp::HOUND == m_specOp && m_config.superFox())) {
- QTimer::singleShot (200, [=] {m_settings->setValue("RxFreq_old",ui->RxFreqSpinBox->value());});
- }
- statusUpdate ();
-}
-
-void MainWindow::on_sbF_Low_valueChanged(int n)
-{
- m_wideGraph->setFST4_FreqRange(n,ui->sbF_High->value());
- chk_FST4_freq_range();
-}
-
-void MainWindow::on_sbF_High_valueChanged(int n)
-{
- m_wideGraph->setFST4_FreqRange(ui->sbF_Low->value(),n);
- chk_FST4_freq_range();
-}
-
-void MainWindow::chk_FST4_freq_range()
-{
- if(!m_bOK_to_chk) return;
- if(ui->sbF_Low->value() < m_wideGraph->nStartFreq()) ui->sbF_Low->setValue(m_wideGraph->nStartFreq());
- if(ui->sbF_High->value() > m_wideGraph->Fmax()) {
- int n=m_wideGraph->Fmax()/100;
- ui->sbF_High->setValue(100*n);
- }
- int maxDiff=2000;
- if(m_TRperiod==120) maxDiff=1000;
- if(m_TRperiod==300) maxDiff=400;
- if(m_TRperiod>=900) maxDiff=200;
- int diff=ui->sbF_High->value() - ui->sbF_Low->value();
-
- if(diff<100 or diff>maxDiff) {
- ui->sbF_Low->setStyleSheet("QSpinBox { color: white; background-color: red; }");
- ui->sbF_High->setStyleSheet("QSpinBox { color: white; background-color: red; }");
- } else {
- ui->sbF_Low->setStyleSheet("");
- ui->sbF_High->setStyleSheet("");
- }
-}
-
-//ft8md
-void MainWindow::on_actionDecFT8cycles1_triggered() { m_nFT8Cycles=1; ui->actionDecFT8cycles1->setChecked(true); }
-void MainWindow::on_actionDecFT8cycles2_triggered() { m_nFT8Cycles=2; ui->actionDecFT8cycles2->setChecked(true); }
-void MainWindow::on_actionDecFT8cycles3_triggered() { m_nFT8Cycles=3; ui->actionDecFT8cycles3->setChecked(true); }
-
-void MainWindow::on_actionRXfLow_triggered() { m_nFT8RXfSens=1; ui->actionRXfLow->setChecked(true); }
-void MainWindow::on_actionRXfMedium_triggered() { m_nFT8RXfSens=2; ui->actionRXfMedium->setChecked(true); }
-void MainWindow::on_actionRXfHigh_triggered() { m_nFT8RXfSens=3; ui->actionRXfHigh->setChecked(true); }
-
-void MainWindow::on_actionMTAuto_triggered() { m_ft8threads=0; }
-void MainWindow::on_actionMT1_triggered() { m_ft8threads=1; }
-void MainWindow::on_actionMT2_triggered() { m_ft8threads=2; }
-void MainWindow::on_actionMT3_triggered() { m_ft8threads=3; }
-void MainWindow::on_actionMT4_triggered() { m_ft8threads=4; }
-void MainWindow::on_actionMT5_triggered() { m_ft8threads=5; }
-void MainWindow::on_actionMT6_triggered() { m_ft8threads=6; }
-void MainWindow::on_actionMT7_triggered() { m_ft8threads=7; }
-void MainWindow::on_actionMT8_triggered() { m_ft8threads=8; }
-void MainWindow::on_actionMT9_triggered() { m_ft8threads=9; }
-void MainWindow::on_actionMT10_triggered() { m_ft8threads=10; }
-void MainWindow::on_actionMT11_triggered() { m_ft8threads=11; }
-void MainWindow::on_actionMT12_triggered() { m_ft8threads=12; }
-
-void MainWindow::on_actionFT8SensMin_toggled(bool checked) { if(checked) m_ft8Sensitivity=1; }
-void MainWindow::on_actionlowFT8thresholds_toggled(bool checked) { if(checked) m_ft8Sensitivity=2; }
-void MainWindow::on_actionFT8subpass_toggled(bool checked) { if(checked) m_ft8Sensitivity=3; }
-void MainWindow::on_actionStartTwoStage_toggled(bool checked) { if(checked) m_ft8DecoderStart=0; }
-void MainWindow::on_actionStartThreeStage_toggled(bool checked) { if(checked) m_ft8DecoderStart=1; }
-void MainWindow::on_actionStartEarly_toggled(bool checked) { if(checked) m_ft8DecoderStart=2; }
-void MainWindow::on_actionStartNormal_toggled(bool checked) { if(checked) m_ft8DecoderStart=3; }
-void MainWindow::on_actionStartLate_toggled(bool checked) { if(checked) m_ft8DecoderStart=4; }
-void MainWindow::on_actionFT8WidebandDXCallSearch_toggled(bool checked) { m_FT8WideDxCallSearch=checked; }
-void MainWindow::on_actionUse_multithreaded_FT8_decoder_triggered(bool checked)
-{
- m_multithreadFT8 = checked;
- dec_data.params.lmultift8 = m_multithreadFT8;
- qDebug() << "m_multithreadFT8 is" << m_multithreadFT8;
- qDebug() << "dec_data.params.lmultift8 is" << dec_data.params.lmultift8;
- if (checked && !(m_specOp==SpecOp::HOUND && m_config.superFox())) {
- if (m_ft8DecoderStart==0) m_hsymStop=49;
- else if (m_ft8DecoderStart==1) {
- m_hsymStop=50;
- m_earlyDecode2=46;
- }
- else if (m_ft8DecoderStart==2) m_hsymStop=48;
- else if (m_ft8DecoderStart==3) m_hsymStop=49;
- else if (m_ft8DecoderStart==4) m_hsymStop=50;
- } else {
- m_hsymStop=50;
- m_earlyDecode2=47;
- }
-}
-//ft8md
-
-void MainWindow::on_actionQuickDecode_toggled (bool checked)
-{
- m_ndepth ^= (-checked ^ m_ndepth) & 0x00000001;
-}
-
-void MainWindow::on_actionMediumDecode_toggled (bool checked)
-{
- m_ndepth ^= (-checked ^ m_ndepth) & 0x00000002;
-}
-
-void MainWindow::on_actionDeepestDecode_toggled (bool checked)
-{
- m_ndepth ^= (-checked ^ m_ndepth) & 0x00000003;
-}
-
-void MainWindow::on_actionInclude_averaging_toggled (bool checked)
-{
- m_ndepth ^= (-checked ^ m_ndepth) & 0x00000010;
- statusChanged();
-}
-
-void MainWindow::on_actionInclude_correlation_toggled (bool checked)
-{
- m_ndepth ^= (-checked ^ m_ndepth) & 0x00000020;
-}
-
-void MainWindow::on_actionEnable_AP_DXcall_toggled (bool checked)
-{
- m_ndepth ^= (-checked ^ m_ndepth) & 0x00000040;
-}
-
-void MainWindow::on_actionAuto_Clear_Avg_toggled (bool checked)
-{
- m_ndepth ^= (-checked ^ m_ndepth) & 0x00000080;
-}
-
-void MainWindow::on_actionErase_ALL_TXT_triggered() //Erase ALL.TXT
-{
- int ret = MessageBox::query_message (this, tr ("Confirm Erase"),
- tr ("Are you sure you want to erase file ALL.TXT?"));
- if(ret==MessageBox::Yes) {
- QFile f {m_config.writeable_data_dir ().absoluteFilePath ("ALL.TXT")};
- f.remove();
- m_RxLog=1;
- }
-}
-
-void MainWindow::on_actionErase_list_of_Q65_callers_triggered()
-{
- int ret = MessageBox::query_message (this, tr ("Confirm Erase"),
- tr ("Are you sure you want to erase the list of Q65 callers?"));
- if(ret==MessageBox::Yes) {
- QFile f {m_config.writeable_data_dir ().absoluteFilePath ("tsil.3q")};
- f.remove();
- }
-}
-
-void MainWindow::on_reset_cabrillo_log_action_triggered ()
-{
- if (MessageBox::Yes == MessageBox::query_message (this, tr ("Confirm Reset"),
- tr ("Are you sure you want to erase your contest log?"),
- tr ("Doing this will remove all QSO records for the current contest. "
- "They will be kept in the ADIF log file but will not be available "
- "for export in your Cabrillo log.")))
- {
- if(m_config.RTTY_Exchange()!="SCC") ui->sbSerialNumber->setValue(1);
- m_logBook.contest_log ()->reset ();
- m_activeCall.clear(); //Erase the QMap of active calls
- m_EMECall.clear(); //ditto for EME calls
- m_score=0;
- if (m_ActiveStationsWidget) {
- m_ActiveStationsWidget->setScore(0);
- if(m_mode=="Q65") m_ActiveStationsWidget->setRate(0);
- }
- }
-}
-
-void MainWindow::on_actionExport_Cabrillo_log_triggered()
-{
- if (QDialog::Accepted == ExportCabrillo {m_settings, &m_config, m_logBook.contest_log ()}.exec())
- {
- MessageBox::information_message (this, tr ("Cabrillo Log saved"));
- }
-}
-
-
-void MainWindow::on_actionErase_wsjtx_log_adi_triggered()
-{
- int ret = MessageBox::query_message (this, tr ("Confirm Erase"),
- tr ("Are you sure you want to erase file wsjtx_log.adi?"));
- if(ret==MessageBox::Yes) {
- QFile f {m_config.writeable_data_dir ().absoluteFilePath ("wsjtx_log.adi")};
- f.remove();
- }
-}
-
-void MainWindow::on_actionErase_WSPR_hashtable_triggered()
-{
- int ret = MessageBox::query_message(this, tr ("Confirm Erase"),
- tr ("Are you sure you want to erase the WSPR hashtable?"));
- if(ret==MessageBox::Yes) {
- QFile f {m_config.writeable_data_dir().absoluteFilePath("hashtable.txt")};
- f.remove();
- }
-}
-
-
-void MainWindow::on_actionOpen_log_directory_triggered ()
-{
- QDesktopServices::openUrl (QUrl::fromLocalFile (m_config.writeable_data_dir ().absolutePath ()));
-}
-
-void MainWindow::on_bandComboBox_currentIndexChanged (int index)
-{
- auto const& frequencies = m_config.frequencies ();
- auto const& source_index = frequencies->mapToSource (frequencies->index (index, FrequencyList_v2_101::frequency_column));
- Frequency frequency {m_freqNominal};
- if (source_index.isValid ())
- {
- frequency = frequencies->frequency_list ()[source_index.row ()].frequency_;
- }
-
- // Lookup band
- auto const& band = m_config.bands ()->find (frequency);
- ui->bandComboBox->setCurrentText (band.size () ? band : m_config.bands ()->oob ());
- setXIT (ui->TxFreqSpinBox->value ());
- displayDialFrequency ();
-}
-
-void MainWindow::on_bandComboBox_editTextChanged (QString const& text)
-{
- if (text.size () && m_config.bands ()->oob () != text)
- {
- ui->bandComboBox->lineEdit ()->setStyleSheet ({});
- }
- else
- {
- ui->bandComboBox->lineEdit ()->setStyleSheet ("QLineEdit {color: yellow; background-color : red;}");
- }
-}
-
-void MainWindow::on_bandComboBox_activated (int index)
-{
- auto const& frequencies = m_config.frequencies ();
- auto const& source_index = frequencies->mapToSource (frequencies->index (index, FrequencyList_v2_101::frequency_column));
- Frequency frequency {m_freqNominal};
- if (source_index.isValid ())
- {
- frequency = frequencies->frequency_list ()[source_index.row ()].frequency_;
- }
- m_bandEdited = true;
- band_changed (frequency);
- m_wideGraph->setRxBand (m_config.bands ()->find (frequency));
-// m_specOp=m_config.special_op_id();
-// if (m_specOp==SpecOp::HOUND) auto_tx_mode(false); // only required if RETURN intiates TXing
-}
-
-void MainWindow::band_changed (Frequency f)
-{
- msk144qsy = false; // MSK144 QSY
- QTimer::singleShot (900, [=] {
- if (m_mode=="MSK144" && (!(m_currentBand=="6m" or m_currentBand=="4m" or m_currentBand=="2m")))
- ui->sbTR->setValue (m_settings->value ("TRPeriod_MSK144", 30).toInt());
- if (m_mode=="MSK144" && (m_currentBand=="6m" or m_currentBand=="4m"))
- ui->sbTR->setValue (m_settings->value ("TRPeriod_MSK144_6m", 15).toInt());
- if (m_mode=="MSK144" && m_currentBand=="2m")
- ui->sbTR->setValue (m_settings->value ("TRPeriod_MSK144_2m", 30).toInt());
- });
- // Don't allow a7 decodes during the first period because they can be leftovers from the previous band
- no_a7_decodes = true;
- QTimer::singleShot ((int(1500.0*m_TRperiod)), [=] {no_a7_decodes = false;});
-
- // Set the attenuation value if options are checked
- if (m_config.pwrBandTxMemory() && !m_tune) {
- auto const&curBand = ui->bandComboBox->currentText();
- if (m_pwrBandTxMemory.contains(curBand)) {
- ui->outAttenuation->setValue(m_pwrBandTxMemory[curBand].toInt());
- }
- else {
- m_pwrBandTxMemory[curBand] = ui->outAttenuation->value();
- }
- }
-
- if (m_bandEdited && !keep_frequency) {
- if (m_mode!="WSPR" && !ui->pbBandHopping->isChecked() && !ui->DX_Call_Button->isChecked()) { // preserves auto Tx
- if (f + m_wideGraph->nStartFreq () > m_freqNominal + ui->TxFreqSpinBox->value ()
- || f + m_wideGraph->nStartFreq () + m_wideGraph->fSpan () <=
- m_freqNominal + ui->TxFreqSpinBox->value ()) {
-// qDebug () << "start f:" << m_wideGraph->nStartFreq () << "span:" << m_wideGraph->fSpan () << "DF:" << ui->TxFreqSpinBox->value ();
- // disable auto Tx if "blind" QSY outside of waterfall
- ui->stopTxButton->click (); // halt any transmission
- auto_tx_mode (false); // disable auto Tx
-// m_send_RR73 = false; // force user to reassess on new band
- }
- }
- m_lastBand.clear ();
- m_bandEdited = false;
- if (m_config.spot_to_psk_reporter ())
- {
- // Upload any queued spots before changing band
- m_psk_Reporter.sendReport();
- }
- if (!m_transmitting) monitor (true);
- if ("FreqCal" == m_mode)
- {
- m_frequency_list_fcal_iter = m_config.frequencies ()->find (f);
- }
- if(m_tci) {
- m_freqNominal = f;
- m_freqTxNominal = m_freqNominal;
- }
- setRig (f);
- setXIT (ui->TxFreqSpinBox->value ());
- m_specOp=m_config.special_op_id();
- if (m_specOp==SpecOp::FOX) FoxReset("BandChange"); // when changing bands, don't preserve the Fox queues
- m_lastloggedcall.clear(); //ft8md
- if(m_mode=="MSK144" && !(programStart or m_freqNominal == 0)) m_msk144basefreq = m_freqNominal; // MSK144 QSY
- }
-
- // Erase the decodedTextBrowsers only if the band really changed
- static QString band_save;
- if (m_config.bands()->find(f) == band_save) return; // band didn't change
- band_save = m_config.bands()->find(f);
- m_band_changed = true;
-/*
- //ft8md
- qint64 ms = QDateTime::currentMSecsSinceEpoch() % 86400000;
- int nsec=ms/1000;
- double TRperiod=60.0; // TR period is the only reliable way in this point of code at the mode change
- if(m_mode=="FT8") TRperiod=15.0;
- else if(m_mode=="FT4") TRperiod=7.5;
- int nseqmod = fmod(double(nsec),TRperiod);
- m_nsecBandChanged=nseqmod;
- dec_data.params.nsecbandchanged=m_nsecBandChanged;
- //ft8md end
-*/
- if (m_config.erase_BandActivity () && !not_erase) {
- ui->decodedTextBrowser->erase (); // Mod for WD5DHK
- ui->decodedTextBrowser2->erase ();
- }
- if (m_mode=="Echo" && m_monitoring) ui->monitorButton->click();
-}
-
-void MainWindow::enable_DXCC_entity (bool on)
-{
- if (on and m_mode!="WSPR" and m_mode!="FST4W" and m_mode!="Echo") {
- //m_logBook.init(); // re-read the log and cty.dat files
-// ui->gridLayout->setColumnStretch(0,55); // adjust proportions of text displays
-// ui->gridLayout->setColumnStretch(1,45);
- } else {
-// ui->gridLayout->setColumnStretch(0,0);
-// ui->gridLayout->setColumnStretch(1,0);
- }
- updateGeometry ();
-}
-
-void MainWindow::on_rptSpinBox_valueChanged(int n)
-{
- int step=ui->rptSpinBox->singleStep();
- if(n%step !=0) {
- n++;
- ui->rptSpinBox->setValue(n);
- }
- m_rpt=QString::number(n);
- int ntx0=m_ntx;
- genStdMsgs(m_rpt);
- m_ntx=ntx0;
- if(m_ntx==1) ui->txrb1->setChecked(true);
- if(m_ntx==2) ui->txrb2->setChecked(true);
- if(m_ntx==3) ui->txrb3->setChecked(true);
- if(m_ntx==4) ui->txrb4->setChecked(true);
- if(m_ntx==5) ui->txrb5->setChecked(true);
- if(m_ntx==6) ui->txrb6->setChecked(true);
- statusChanged();
-}
-
-void MainWindow::on_tuneButton_clicked (bool checked)
-{
- ui->pbBandHopping->setChecked(false); // disable band hopping
- // prevent tuning on top of a SuperFox message
- if (SpecOp::HOUND==m_specOp && m_config.superFox() && !m_tune) {
- QDateTime now = QDateTime::currentDateTimeUtc();
- int s = now.time().toString("ss").toInt();
- if ((s >= 0 && s < 15) || (s >= 30 && s < 45)) {
- ui->tuneButton->setChecked (false);
- m_config.transceiver_tune (false); // reset rig tuning
- return;
- }
- }
- m_config.transceiver_tune (false); // reset rig tuning
- if (blocked) return;
- if (m_auto && !(m_mode=="WSPR" || m_mode=="FST4W")) ui->autoButton->click(); // stop any other transmission
- stopWRTimer.stop(); // stop any Wait & Reply timeout
- stopWCTimer.stop(); // stop any Wait & Call timeout
- if (checked && m_config.tune_watchdog() && !(m_mode=="WSPR" || m_mode=="FST4W")) {
- tuneATU_Timer.start (m_config.tune_watchdog_time()*1000); // tune watchdog
- }
- if (!checked) {
- tuneATU_Timer.stop (); // stop tune watchdog when stopping Tune manually
- ui->tuneButton->setText("Tune");
- }
- static bool lastChecked = false;
- if (lastChecked == checked) return;
- lastChecked = checked;
- if (checked && m_tune==false) { // we're starting tuning so remember Tx and change pwr to Tune value
- if (m_config.pwrBandTuneMemory ()) {
- auto const& curBand = ui->bandComboBox->currentText();
- m_pwrBandTxMemory[curBand] = ui->outAttenuation->value(); // remember our Tx pwr
- m_PwrBandSetOK = false;
- if (m_pwrBandTuneMemory.contains(curBand)) {
- ui->outAttenuation->setValue(m_pwrBandTuneMemory[curBand].toInt()); // set to Tune pwr
- }
- m_PwrBandSetOK = true;
- }
- }
- if (m_tune) {
- tuneButtonTimer.start(250);
- } else {
- m_sentFirst73=false;
- itone[0]=0;
- on_monitorButton_clicked (true);
- m_tune=true;
- }
- if (m_tci_audio) Q_EMIT m_config.transceiver_tune(checked);
- else Q_EMIT tune (checked);
-}
-
-
-void MainWindow::end_tuning ()
-{
- tuneATU_Timer.stop (); // stop tune watchdog when stopping Tune manually
- on_stopTxButton_clicked ();
- // we're turning off so remember our Tune pwr setting and reset to Tx pwr
- if (m_config.pwrBandTuneMemory() || m_config.pwrBandTxMemory()) {
- auto const& curBand = ui->bandComboBox->currentText();
- m_pwrBandTuneMemory[curBand] = ui->outAttenuation->value(); // remember our Tune pwr
- m_PwrBandSetOK = false;
- ui->outAttenuation->setValue(m_pwrBandTxMemory[curBand].toInt()); // set to Tx pwr
- m_PwrBandSetOK = true;
- }
-}
-
-void MainWindow::stop_tuning ()
-{
- tuneATU_Timer.stop (); // stop tune watchdog when stopping Tune manually
- on_tuneButton_clicked(false);
- ui->tuneButton->setChecked (false);
- m_bTxTime=false;
- m_tune=false;
-}
-
-void MainWindow::stopTuneATU()
-{
- tuneATU_Timer.stop (); // stop tune watchdog when stopping Tune manually
- on_tuneButton_clicked(false);
- m_bTxTime=false;
- ui->tuneButton->setText("Tune");
-}
-
-void MainWindow::on_stopTxButton_clicked() // Stop Tx
-{
- ui->pbBandHopping->setChecked(false); // disable band hopping
- if (m_tune) stop_tuning ();
- if (m_auto and !m_tuneup) auto_tx_mode (false);
- m_btxok=false;
- m_bCallingCQ = false;
- m_bAutoReply = false; // ready for next
- m_maxPoints=-1;
- if (ui->DX_Call_Button->isChecked()) ui->DX_Call_Button->click ();
- stopWRTimer.stop(); // Stop any Wait & Reply timeout
- stopWCTimer.stop(); // Stop any Wait & Call timeout
- tuneATU_Timer.stop (); // stop tune watchdog when stopping Tune manually
- no_wait_and_call = false;
- m_specOp=m_config.special_op_id();
- if (ui->respondComboBox->isVisible() && ui->respondComboBox->currentText() != "CQ: None") {
- Dpoints=0; // reset points
- maxDPoints=0; // reset points
- dBpoints=-28; // reset points
- dBpoints2=99; // reset points
- maxdBPoints=-28; // reset points
- mindBPoints=99; // reset points
- }
- pounce = false;
- ui->autoButton->setChecked(false); // ensure auoButton is unchecked
- filtered = false;
- ignored = false;
- m_muted = false;
- check_button_color();
-}
-
-void MainWindow::rigOpen ()
-{
- update_dynamic_property (ui->readFreq, "state", "warning");
- ui->readFreq->setText ("");
- ui->readFreq->setEnabled (true);
- m_config.transceiver_online ();
- m_config.sync_transceiver (true, true);
-}
-
-void MainWindow::on_pbR2T_clicked()
-{
- ui->TxFreqSpinBox->setValue(ui->RxFreqSpinBox->value ());
-}
-
-void MainWindow::on_pbT2R_clicked()
-{
- if (ui->RxFreqSpinBox->isEnabled ())
- {
- ui->RxFreqSpinBox->setValue (ui->TxFreqSpinBox->value ());
- }
-}
-
-
-void MainWindow::on_readFreq_clicked()
-{
- if (m_transmitting) return;
-
- if (m_config.transceiver_online ())
- {
- m_config.sync_transceiver (true, true);
- }
-}
-
-void MainWindow::setXIT(int n, Frequency base)
-{
- if (m_transmitting && !m_config.tx_QSY_allowed ()) return;
- // If "CQ nnn ..." feature is active, set the proper Tx frequency
- if(m_config.split_mode () && ui->cbCQTx->isEnabled () && ui->cbCQTx->isVisible () &&
- ui->cbCQTx->isChecked())
- {
- if (6 == m_ntx || (7 == m_ntx && m_gen_message_is_cq))
- {
- // All conditions are met, use calling frequency
- base = m_freqNominal / 1000000 * 1000000 + 1000 * ui->sbCQTxFreq->value () + m_XIT;
- }
- }
- if (!base) base = m_freqNominal;
- m_XIT = 0;
- if (!(m_bSimplex || (SpecOp::FOX==m_specOp && m_config.superFox()))) {
- // m_bSimplex is false, so we can use split mode if requested
- if (m_config.split_mode () && (!m_config.enable_VHF_features () ||
- m_mode=="FT4" || m_mode == "FT8" || m_mode=="FST4")) {
- // Don't use XIT for VHF & up
- m_XIT=(n/500)*500 - 1500;
- }
-
- if ((m_monitoring || m_transmitting)
- && m_config.is_transceiver_online ()
- && m_config.split_mode ())
- {
- // All conditions are met, reset the transceiver Tx dial
- // frequency
- m_freqTxNominal = base + m_XIT;
- if (m_astroWidget) m_astroWidget->nominal_frequency (m_freqNominal, m_freqTxNominal);
- m_config.transceiver_tx_frequency (m_freqTxNominal + m_astroCorrection.tx);
- }
- }
- if (SpecOp::FOX==m_specOp && m_config.superFox()
- && (m_monitoring || m_transmitting)
- && m_config.is_transceiver_online ())
- {
- // the transceiver Tx dial frequency must be consistent with
- // zero m_XIT for SuperFox
- m_freqTxNominal = base;
- if (m_astroWidget) m_astroWidget->nominal_frequency (m_freqNominal, m_freqTxNominal);
- m_config.transceiver_tx_frequency (m_freqTxNominal + m_astroCorrection.tx);
- }
-
- //Now set the audio Tx freq
- if (m_tci_audio) Q_EMIT m_config.transceiver_trfrequency(ui->TxFreqSpinBox->value () - m_XIT);
- else Q_EMIT transmitFrequency (ui->TxFreqSpinBox->value () - m_XIT);
-}
-
-void MainWindow::setFreq4(int rxFreq, int txFreq)
-{
- if (m_mode=="Q65" && ui->actionDisable_clicks_on_waterfall->isVisible() && ui->actionDisable_clicks_on_waterfall->isChecked()
- && !(Qt::AltModifier & QApplication::keyboardModifiers ())) return;
- if (m_mode=="ECHO") return; // we do not adjust rx/tx for echo mode -- always 1500Hz
- if (ui->RxFreqSpinBox->isEnabled () && !(SpecOp::HOUND==m_specOp && m_config.superFox() &&
- (rxFreq < 700 or rxFreq > 800))) ui->RxFreqSpinBox->setValue(rxFreq);
- if(m_mode=="WSPR" or m_mode=="FST4W") {
- ui->WSPRfreqSpinBox->setValue(txFreq);
- } else {
- if (ui->TxFreqSpinBox->isEnabled ()) {
- ui->TxFreqSpinBox->setValue(txFreq);
- if ("FT8" == m_mode || "FT4" == m_mode || m_mode=="FST4")
- {
- // we need to regenerate the current transmit waveform for
- // GFSK modulated modes
- if (m_transmitting) m_restart = true;
- }
- }
- else if (m_config.enable_VHF_features ()
- && (Qt::ControlModifier & QApplication::keyboardModifiers ())) {
- // for VHF & up we adjust Tx dial frequency to equalize Tx to Rx
- // when user CTRL+clicks on waterfall
- auto temp = ui->TxFreqSpinBox->value ();
- ui->RxFreqSpinBox->setValue (temp);
- setRig (m_freqNominal + txFreq - temp);
- setXIT (ui->TxFreqSpinBox->value ());
- }
- }
-}
-
-void MainWindow::handle_transceiver_update (Transceiver::TransceiverState const& s)
-{
- Transceiver::TransceiverState old_state {m_rigState};
- //transmitDisplay (s.ptt ());
- if (s.ptt () // && !m_rigState.ptt ()
- ) { // safe to start audio
- // (caveat - DX Lab Suite Commander)
- if (m_tx_when_ready && g_iptt) { // waiting to Tx and still needed
- int ms_delay=1000*m_config.txDelay();
- if(m_mode=="FT4") ms_delay=20;
- ptt1Timer.start(ms_delay); //Start-of-transmission sequencer delay
- m_tx_when_ready = false;
- }
- }
-
- // Display PWR and SWR
- if(m_config.PWR_and_SWR()) {
- if (!band_hopping_label.isVisible ()) {
- statusBar ()->addWidget (&band_hopping_label);
- band_hopping_label.setMinimumSize (QSize {80, 18});
- band_hopping_label.show();
- }
- if (m_rigState.power() != s.power() && m_transmitting) {
- ui->label->setText(QString {tr("%1 W")}.arg (round(s.power()/1000.)));
- if (round(s.power()/1000.) >= 100) {
- qreal pointSize = m_config.text_font().pointSizeF();
-
- ui->label->setMinimumWidth (2.8*pointSize + 16);
- ui->outAttenuation->setMinimumWidth (2.8*pointSize + 16);
- }
- } else {
- ui->label->setText("Pwr");
- }
- if (m_rigState.swr() != s.swr()) {
- static bool s_alreadyShowingSWRAlert = false;
- if (s.swr() > 0) {
- if (s.swr()>150) band_hopping_label.setStyleSheet ("QLabel{color: #000000; background-color: #ffff00}");
- if (s.swr()>200) band_hopping_label.setStyleSheet ("QLabel{color: #ffffff; background-color: #ff0000}");
- if (s.swr()>250 && m_config.check_SWR()) {
- if (!s_alreadyShowingSWRAlert) { // avoid recursion
- on_stopTxButton_clicked();
- s_alreadyShowingSWRAlert = true;
- MessageBox::warning_message (this, tr ("SWR > 2.5 !!!\n\n"
- "Transmission was stopped\n\n"
- "Check your antenna"));
- s_alreadyShowingSWRAlert = false;
- }
- }
- if (s.swr()<1000) {
- band_hopping_label.setText(QString {"SWR: %1"}.arg (s.swr()/100.,0,'f',2));
- } else {
- band_hopping_label.setText(QString {"SWR: %1"}.arg (s.swr()/100.,0,'f',1));
- }
- } else {
- if (!s_alreadyShowingSWRAlert) { // retain value and color if SWR was > 2.5
- band_hopping_label.setText("");
- band_hopping_label.setStyleSheet("");
- }
- }
- }
- }
-
- m_rigState = s;
- auto old_freqNominal = m_freqNominal;
- if (!old_freqNominal)
- {
- // always take initial rig frequency to avoid start up problems
- // with bogus Tx frequencies
- m_freqNominal = s.frequency ();
- }
- if (old_state.online () == false && s.online () == true)
- {
- // initializing
- on_monitorButton_clicked (!(m_config.monitor_off_at_startup() or m_mode=="Echo"));
- }
- if (s.frequency () != old_state.frequency () || s.split () != m_splitMode)
- {
- m_splitMode = s.split ();
- if (!s.ptt ())
- {
- m_freqNominal = s.frequency () - m_astroCorrection.rx;
- if (old_freqNominal != m_freqNominal)
- {
- m_freqTxNominal = m_freqNominal;
- genCQMsg ();
- }
-
- if (m_monitoring)
- {
- m_lastMonitoredFrequency = m_freqNominal;
- }
- if (m_lastDialFreq != m_freqNominal &&
- (m_mode != "MSK144"
- || !(ui->cbCQTx->isEnabled () && ui->cbCQTx->isVisible () && ui->cbCQTx->isChecked()))) {
-
- if (m_lastDialFreq != m_freqNominal and m_ActiveStationsWidget != NULL) {
- m_recentCall.clear();
- if(m_mode!="Q65") m_ActiveStationsWidget->erase();
- }
-
- m_lastDialFreq = m_freqNominal;
- m_secBandChanged=QDateTime::currentMSecsSinceEpoch()/1000;
-// pskSetLocal (); // better be done after a band change
- statusChanged();
- m_wideGraph->setDialFreq(m_freqNominal / 1.e6);
- }
- } else {
- m_freqTxNominal = s.split () ? s.tx_frequency () - m_astroCorrection.tx : s.frequency ();
- }
- if (m_astroWidget) m_astroWidget->nominal_frequency (m_freqNominal, m_freqTxNominal);
- }
- // ensure frequency display is correct
- if (m_astroWidget && old_state.ptt () != s.ptt ()) setRig ();
-
- displayDialFrequency ();
- update_dynamic_property (ui->readFreq, "state", "ok");
- ui->readFreq->setEnabled (false);
- ui->readFreq->setText (s.split () ? "S" : "");
-}
-
-void MainWindow::handle_transceiver_failure (QString const& reason)
-{
- update_dynamic_property (ui->readFreq, "state", "error");
- ui->readFreq->setEnabled (true);
- on_stopTxButton_clicked ();
- qDebug() << "MainWindow::handle_transceiver_failure fired";
- rigFailure (reason);
- rigFailed = true;
-}
-
-void MainWindow::rigFailure (QString const& reason)
-{
- if (m_first_error)
- {
- // one automatic retry
- QTimer::singleShot (0, this, SLOT (rigOpen ()));
- m_first_error = false;
- }
- else
- {
- if (m_splash && m_splash->isVisible ()) m_splash->hide ();
- m_rigErrorMessageBox.setDetailedText (reason + "\n\nTimestamp: "
-#if QT_VERSION >= QT_VERSION_CHECK (5, 8, 0)
- + QDateTime::currentDateTimeUtc ().toString (Qt::ISODateWithMs)
-#else
- + QDateTime::currentDateTimeUtc ().toString ("yyyy-MM-ddTHH:mm:ss.zzzZ")
-#endif
- );
-
- // don't call slot functions directly to avoid recursion
- m_rigErrorMessageBox.exec ();
- auto const clicked_button = m_rigErrorMessageBox.clickedButton ();
- if (clicked_button == m_configurations_button)
- {
- ui->menuConfig->exec (QCursor::pos ());
- }
- else
- {
- switch (m_rigErrorMessageBox.standardButton (clicked_button))
- {
- case MessageBox::Ok:
- m_config.select_tab (1);
- QTimer::singleShot (0, this, SLOT (on_actionSettings_triggered ()));
- break;
-
- case MessageBox::Retry:
- QTimer::singleShot (0, this, SLOT (rigOpen ()));
- break;
-
- case MessageBox::Cancel:
- QTimer::singleShot (0, this, SLOT (close ()));
- break;
-
- default: break; // squashing compile warnings
- }
- }
- m_first_error = true; // reset
- }
-}
-
-void MainWindow::transmit (double snr)
-{
- double toneSpacing=0.0;
- if (m_mode == "JT65") {
- if(m_nSubMode==0) toneSpacing=11025.0/4096.0;
- if(m_nSubMode==1) toneSpacing=2*11025.0/4096.0;
- if(m_nSubMode==2) toneSpacing=4*11025.0/4096.0;
- if (m_tci_audio) {
- Q_EMIT m_config.transceiver_modulator_start(m_mode, NUM_JT65_SYMBOLS,
- 4096.0*12000.0/11025.0, ui->TxFreqSpinBox->value () - m_XIT,
- toneSpacing,true,false,snr,m_TRperiod);
- } else {
- Q_EMIT sendMessage (m_mode, NUM_JT65_SYMBOLS,
- 4096.0*12000.0/11025.0, ui->TxFreqSpinBox->value () - m_XIT,
- toneSpacing, m_soundOutput, m_config.audio_output_channel (),
- true, false, snr, m_TRperiod);
- }
- }
-
- if((m_mode=="FT4" or m_mode=="FT8") and m_maxPoints>0 and SpecOp::ARRL_DIGI==m_specOp) {
- ui->dxCallEntry->setText(m_deCall);
- ui->dxGridEntry->setText(m_deGrid);
- genStdMsgs("-10");
- }
-
- if (m_mode == "FT8") {
-// toneSpacing=12000.0/1920.0;
- toneSpacing=-3;
- if(m_config.x2ToneSpacing()) toneSpacing=2*12000.0/1920.0;
- if(m_config.x4ToneSpacing()) toneSpacing=4*12000.0/1920.0;
- if(SpecOp::FOX==m_specOp and !m_tune) toneSpacing=-1;
- if(SpecOp::FOX==m_specOp and m_config.superFox()) {
- if (m_tci_audio) {
- Q_EMIT m_config.transceiver_modulator_start(m_mode, NUM_SUPERFOX_SYMBOLS,
- 1024.0,ui->TxFreqSpinBox->value()-m_XIT,
- toneSpacing,true,false,snr,m_TRperiod);
- } else {
- Q_EMIT sendMessage (m_mode, NUM_SUPERFOX_SYMBOLS,
- 1024.0, ui->TxFreqSpinBox->value () - m_XIT,
- toneSpacing, m_soundOutput, m_config.audio_output_channel (),
- true, false, snr, m_TRperiod);
- }
- } else {
- if (m_tci_audio) {
- Q_EMIT m_config.transceiver_modulator_start(m_mode, NUM_FT8_SYMBOLS,
- 1920.0,ui->TxFreqSpinBox->value()-m_XIT,
- toneSpacing,true,false,snr,m_TRperiod);
- } else {
- Q_EMIT sendMessage (m_mode, NUM_FT8_SYMBOLS,
- 1920.0, ui->TxFreqSpinBox->value () - m_XIT,
- toneSpacing, m_soundOutput, m_config.audio_output_channel (),
- true, false, snr, m_TRperiod);
- }
- }
- }
-
- if (m_mode == "FT4") {
- m_dateTimeSentTx3=QDateTime::currentDateTimeUtc();
- toneSpacing=-2.0; //Transmit a pre-computed, filtered waveform.
- if (m_tci_audio) {
- Q_EMIT m_config.transceiver_modulator_start(m_mode, NUM_FT4_SYMBOLS,
- 576.0,ui->TxFreqSpinBox->value()-m_XIT,
- toneSpacing,true,false,snr,m_TRperiod);
- } else {
- Q_EMIT sendMessage (m_mode, NUM_FT4_SYMBOLS,
- 576.0, ui->TxFreqSpinBox->value() - m_XIT,
- toneSpacing, m_soundOutput, m_config.audio_output_channel(),
- true, false, snr, m_TRperiod);
- }
- }
-
- if (m_mode == "FST4" or m_mode == "FST4W") {
- m_dateTimeSentTx3=QDateTime::currentDateTimeUtc();
- toneSpacing=-2.0; //Transmit a pre-computed, filtered waveform.
- int nsps=720;
- if(m_TRperiod==30) nsps=1680;
- if(m_TRperiod==60) nsps=3888;
- if(m_TRperiod==120) nsps=8200;
- if(m_TRperiod==300) nsps=21504;
- if(m_TRperiod==900) nsps=66560;
- if(m_TRperiod==1800) nsps=134400;
- int hmod=1;
- if(m_config.x2ToneSpacing()) hmod=2;
- if(m_config.x4ToneSpacing()) hmod=4;
- double dfreq=hmod*12000.0/nsps;
- double f0=ui->WSPRfreqSpinBox->value() - m_XIT;
- if(m_mode=="FST4") f0=ui->TxFreqSpinBox->value() - m_XIT;
- if(!m_tune) f0 += 1.5*dfreq;
- if (m_tci_audio) {
- Q_EMIT m_config.transceiver_modulator_start(m_mode, NUM_FST4_SYMBOLS,double(nsps),f0,toneSpacing,
- true,false,snr,m_TRperiod);
- } else {
- Q_EMIT sendMessage (m_mode, NUM_FST4_SYMBOLS,double(nsps),f0,toneSpacing,
- m_soundOutput,m_config.audio_output_channel(),
- true, false, snr, m_TRperiod);
- }
- }
-
- if (m_mode == "Q65") {
- int nsps=1800;
- if(m_TRperiod==30) nsps=3600;
- if(m_TRperiod==60) nsps=7200;
- if(m_TRperiod==120) nsps=16000;
- if(m_TRperiod==300) nsps=41472;
- int mode65=pow(2.0,double(m_nSubMode));
- toneSpacing=mode65*12000.0/nsps;
-// toneSpacing=-4.0;
- if (m_tci_audio) {
- Q_EMIT m_config.transceiver_modulator_start(m_mode, NUM_Q65_SYMBOLS,
- double(nsps),ui->TxFreqSpinBox->value()-m_XIT,
- toneSpacing,true,false,snr,m_TRperiod);
- } else {
- Q_EMIT sendMessage (m_mode, NUM_Q65_SYMBOLS,
- double(nsps), ui->TxFreqSpinBox->value () - m_XIT,
- toneSpacing, m_soundOutput, m_config.audio_output_channel (),
- true, false, snr, m_TRperiod);
- }
- }
-
- if (m_mode == "JT9") {
- int nsub=pow(2,m_nSubMode);
- int nsps[]={480,240,120,60};
- double sps=m_nsps;
- m_toneSpacing=nsub*12000.0/6912.0;
- if(m_config.x2ToneSpacing()) m_toneSpacing=2.0*m_toneSpacing;
- if(m_config.x4ToneSpacing()) m_toneSpacing=4.0*m_toneSpacing;
- bool fastmode=false;
- if(m_bFast9 and (m_nSubMode>=4)) {
- fastmode=true;
- sps=nsps[m_nSubMode-4];
- m_toneSpacing=12000.0/sps;
- }
- if (m_tci_audio) {
- Q_EMIT m_config.transceiver_modulator_start(m_mode, NUM_JT9_SYMBOLS,sps,
- ui->TxFreqSpinBox->value()-m_XIT,
- m_toneSpacing,true,fastmode,snr,m_TRperiod);
- } else {
- Q_EMIT sendMessage (m_mode, NUM_JT9_SYMBOLS, sps,
- ui->TxFreqSpinBox->value() - m_XIT, m_toneSpacing,
- m_soundOutput, m_config.audio_output_channel (),
- true, fastmode, snr, m_TRperiod);
- }
- }
-
- if (m_mode == "MSK144") {
- m_nsps=6;
- double f0=1000.0;
- if(!m_bFastMode) {
- m_nsps=192;
- f0=ui->TxFreqSpinBox->value () - m_XIT - 0.5*m_toneSpacing;
- }
- m_toneSpacing=6000.0/m_nsps;
- m_FFTSize = 7 * 512;
- if (m_tci_audio) Q_EMIT m_config.transceiver_blocksize (m_FFTSize);
- else Q_EMIT FFTSize (m_FFTSize);
- int nsym;
- nsym=NUM_MSK144_SYMBOLS;
- if(itone[40] < 0) nsym=40;
- if (m_tci_audio) {
- Q_EMIT m_config.transceiver_modulator_start(m_mode, nsym,double(m_nsps),f0, m_toneSpacing,
- true,true,snr,m_TRperiod);
- } else {
- Q_EMIT sendMessage (m_mode, nsym, double(m_nsps), f0, m_toneSpacing,
- m_soundOutput, m_config.audio_output_channel (),
- true, true, snr, m_TRperiod);
- }
- }
-
- if (m_mode == "JT4") {
- if(m_nSubMode==0) toneSpacing=4.375;
- if(m_nSubMode==1) toneSpacing=2*4.375;
- if(m_nSubMode==2) toneSpacing=4*4.375;
- if(m_nSubMode==3) toneSpacing=9*4.375;
- if(m_nSubMode==4) toneSpacing=18*4.375;
- if(m_nSubMode==5) toneSpacing=36*4.375;
- if(m_nSubMode==6) toneSpacing=72*4.375;
- if (m_tci_audio) {
- Q_EMIT m_config.transceiver_modulator_start(m_mode, NUM_JT4_SYMBOLS,
- 2520.0*12000.0/11025.0,ui->TxFreqSpinBox->value()-m_XIT,
- toneSpacing,true,false,snr,m_TRperiod);
- } else {
- Q_EMIT sendMessage (m_mode, NUM_JT4_SYMBOLS,
- 2520.0*12000.0/11025.0, ui->TxFreqSpinBox->value () - m_XIT,
- toneSpacing, m_soundOutput, m_config.audio_output_channel (),
- true, false, snr, m_TRperiod);
- }
- }
-
- if (m_mode=="WSPR") {
- int nToneSpacing=1;
- if(m_config.x2ToneSpacing()) nToneSpacing=2;
- if(m_config.x4ToneSpacing()) nToneSpacing=4;
- if (m_tci_audio) {
- Q_EMIT m_config.transceiver_modulator_start(m_mode, NUM_WSPR_SYMBOLS,8192.0,
- ui->TxFreqSpinBox->value() - 1.5 * 12000 / 8192,
- m_toneSpacing*nToneSpacing,true,false,snr,
- m_TRperiod);
- } else {
- Q_EMIT sendMessage (m_mode, NUM_WSPR_SYMBOLS, 8192.0,
- ui->TxFreqSpinBox->value() - 1.5 * 12000 / 8192,
- m_toneSpacing*nToneSpacing, m_soundOutput,
- m_config.audio_output_channel(),true, false, snr,
- m_TRperiod);
- }
- }
-
- if(m_mode=="Echo") {
- m_fDither=0.;
-#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0)
- if(m_astroWidget && m_astroWidget->bDither()) m_fDither = QRandomGenerator::global()->bounded(20.0) - 10.0; //Dither by +/- 10 Hz
-#else
- if(m_astroWidget && m_astroWidget->bDither()) m_fDither = 20.0*(double(qrand())/RAND_MAX) - 10.0; //Dither by +/- 10 Hz
-#endif
-
- unsigned int numEchoSymbols=6;
- double framesPerSymbol=4096;
- double freq=1500.0+m_fDither;
- double toneSpacing=0.0;
-
- if(ui->rbEchoMessage->isChecked() or ui->rbEchoCW->isChecked()) {
-
- if(ui->rbEchoCW->isChecked()) {
- freq=1500.0;
- int ifreq=freq;
- int n=ui->leEchoMessage->text().length();
- gen_cw_wave_(const_cast<char *> (ui->leEchoMessage->text().toLatin1().constData()), &ifreq,
- foxcom_.wave, (FCL)n);
- } else {
- toneSpacing=ui->sbToneSpacing->value();
- int nsps4=4*framesPerSymbol; //48000 Hz sampling
- int nsym=numEchoSymbols;
- float fsample=48000.0;
- int nwave=nsym*nsps4;
- int icmplx=0;
- float f0=freq;
- genwave_(const_cast<int *>(itone),&nsym,&nsps4,&nwave,
- &fsample,&toneSpacing,&f0,&icmplx,foxcom_.wave,foxcom_.wave);
- }
- toneSpacing=-5.0; //Flag Modulator to use precomputed foxcom_.wave[].
- }
-
- m_msEchoTxStart=QDateTime::currentMSecsSinceEpoch();
- if (m_tci_audio) {
- Q_EMIT m_config.transceiver_modulator_start(m_mode,numEchoSymbols,framesPerSymbol,freq,toneSpacing,
- false,false,snr,m_TRperiod);
- } else {
- Q_EMIT sendMessage (m_mode,numEchoSymbols,framesPerSymbol,freq,toneSpacing,m_soundOutput,
- m_config.audio_output_channel(), false, false, snr, m_TRperiod);
- }
- }
-
-// In auto-sequencing mode, stop after 5 transmissions of "73" message.
- if (m_bFastMode || m_bFast9) {
- if (ui->cbAutoSeq->isVisible () && ui->cbAutoSeq->isEnabled () && ui->cbAutoSeq->isChecked ()) {
- if(m_ntx==5) {
- m_nTx73 += 1;
- } else {
- m_nTx73=0;
- }
- }
- }
-}
-
-void MainWindow::on_outAttenuation_valueChanged (int a)
-{
- QString tt_str;
- qreal dBAttn {a / 10.}; // slider interpreted as dB / 100
- if (m_tune && m_config.pwrBandTuneMemory()) {
- tt_str = tr ("Tune digital gain ");
- } else {
- tt_str = tr ("Transmit digital gain ");
- }
- tt_str += (a ? QString::number (-dBAttn, 'f', 1) : "0") + "dB";
- if (ui->outAttenuation->hasFocus() && !m_block_pwr_tooltip) {
- QToolTip::showText (QCursor::pos (), tt_str, ui->outAttenuation);
- }
- QString curBand = ui->bandComboBox->currentText();
- if (m_PwrBandSetOK && !m_tune && m_config.pwrBandTxMemory ()) {
- m_pwrBandTxMemory[curBand] = a; // remember our Tx pwr
- }
- if (m_PwrBandSetOK && m_tune && m_config.pwrBandTuneMemory()) {
- m_pwrBandTuneMemory[curBand] = a; // remember our Tune pwr
- }
- // Updating attenuation for tuning is done in stop_tuning
- if (m_tci_audio) {
- Q_EMIT m_config.transceiver_txvolume(dBAttn);
- } else {
- Q_EMIT outAttenuationChanged (dBAttn);
- }
-}
-
-void MainWindow::on_actionShort_list_of_add_on_prefixes_and_suffixes_triggered()
-{
- if (!m_prefixes) {
- m_prefixes.reset (new HelpTextWindow {tr ("Prefixes")
- , R"(Type 1 Prefixes:
-
- 1A 1S 3A 3B6 3B8 3B9 3C 3C0 3D2 3D2C 3D2R 3DA 3V 3W 3X
- 3Y 3YB 3YP 4J 4L 4S 4U1I 4U1U 4W 4X 5A 5B 5H 5N 5R
- 5T 5U 5V 5W 5X 5Z 6W 6Y 7O 7P 7Q 7X 8P 8Q 8R
- 9A 9G 9H 9J 9K 9L 9M2 9M6 9N 9Q 9U 9V 9X 9Y A2
- A3 A4 A5 A6 A7 A9 AP BS7 BV BV9 BY C2 C3 C5 C6
- C9 CE CE0X CE0Y CE0Z CE9 CM CN CP CT CT3 CU CX CY0 CY9
- D2 D4 D6 DL DU E3 E4 EA EA6 EA8 EA9 EI EK EL EP
- ER ES ET EU EX EY EZ F FG FH FJ FK FKC FM FO
- FOA FOC FOM FP FR FRG FRJ FRT FT5W FT5X FT5Z FW FY M MD
- MI MJ MM MU MW H4 H40 HA HB HB0 HC HC8 HH HI HK
- HK0A HK0M HL HM HP HR HS HV HZ I IS IS0 J2 J3 J5
- J6 J7 J8 JA JDM JDO JT JW JX JY K KG4 KH0 KH1 KH2
- KH3 KH4 KH5 KH5K KH6 KH7 KH8 KH9 KL KP1 KP2 KP4 KP5 LA LU
- LX LY LZ OA OD OE OH OH0 OJ0 OK OM ON OX OY OZ
- P2 P4 PA PJ2 PJ7 PY PY0F PT0S PY0T PZ R1F R1M S0 S2 S5
- S7 S9 SM SP ST SU SV SVA SV5 SV9 T2 T30 T31 T32 T33
- T5 T7 T8 T9 TA TF TG TI TI9 TJ TK TL TN TR TT
- TU TY TZ UA UA2 UA9 UK UN UR V2 V3 V4 V5 V6 V7
- V8 VE VK VK0H VK0M VK9C VK9L VK9M VK9N VK9W VK9X VP2E VP2M VP2V VP5
- VP6 VP6D VP8 VP8G VP8H VP8O VP8S VP9 VQ9 VR VU VU4 VU7 XE XF4
- XT XU XW XX9 XZ YA YB YI YJ YK YL YN YO YS YU
- YV YV0 Z2 Z3 ZA ZB ZC4 ZD7 ZD8 ZD9 ZF ZK1N ZK1S ZK2 ZK3
- ZL ZL7 ZL8 ZL9 ZP ZS ZS8 KC4 E5
-
-Type 1 Suffixes: /0 /1 /2 /3 /4 /5 /6 /7 /8 /9 /A /P)", {"Courier", 10}});
- }
- m_prefixes->showNormal();
- m_prefixes->raise ();
-}
-
-bool MainWindow::shortList(QString callsign) const
-{
- int n=callsign.length();
- int i1=callsign.indexOf("/");
- Q_ASSERT(i1>0 and i1<n);
- QString t1=callsign.mid(0,i1);
- QString t2=callsign.mid(i1+1,n-i1-1);
- bool b=(m_pfx.contains(t1) or m_sfx.contains(t2));
- return b;
-}
-
-void MainWindow::pskSetLocal ()
-{
- if (!m_config.spot_to_psk_reporter ()) return;
-
- // find the station row, if any, that matches the band we are on
- auto stations = m_config.stations ();
- auto matches = stations->match (stations->index (0, StationList::band_column)
- , Qt::DisplayRole
- , ui->bandComboBox->currentText ()
- , 1
- , Qt::MatchExactly);
- QString antenna_description;
- if (!matches.isEmpty ()) {
- antenna_description = stations->index (matches.first ().row ()
- , StationList::description_column).data ().toString ();
- }
- // qDebug() << "To PSKreporter: local station details";
- QString rig_information = m_config.rig_name();
- if (rig_information == "None") rig_information = "No CAT control";
- if (rig_information == "Ham Radio Deluxe") rig_information = "N/A (HRD)";
- if (rig_information == "DX Lab Suite Commander") rig_information = "N/A (DXLab)";
- if (rig_information.contains("OmniRig")) rig_information = "N/A (OmniRig)";
- if (rig_information == "FLRig") rig_information = "N/A (FLRig)";
- if (rig_information.contains("TCI Cli")) rig_information = "N/A (TCI)";
- m_psk_Reporter.setLocalStation(m_config.my_callsign (), m_config.my_grid (), antenna_description, rig_information);
-}
-
-void MainWindow::transmitDisplay (bool transmitting)
-{
- if (transmitting == m_transmitting) {
- if (transmitting) {
- ui->signal_meter_widget->setValue(0,0);
- if (m_monitoring && !ui->actionFull_Duplex_Mode->isChecked()) monitor (false);
- m_txing=true;
- QTimer::singleShot ((int(1000.0*m_TRperiod)), [=] {m_txing=false;});
- m_btxok=true;
- }
-
- auto QSY_allowed = !transmitting or m_config.tx_QSY_allowed () or
- !m_config.split_mode ();
- if (ui->cbHoldTxFreq->isChecked ()) {
- ui->TxFreqSpinBox->setEnabled (QSY_allowed);
- ui->pbT2R->setEnabled (QSY_allowed);
- }
-
- if (m_mode!="WSPR" and m_mode!="FST4W") {
- if(m_config.enable_VHF_features ()) {
- ui->TxFreqSpinBox->setEnabled (true);
- } else {
- ui->TxFreqSpinBox->setEnabled (QSY_allowed and !m_bFastMode);
- ui->pbR2T->setEnabled (QSY_allowed);
- ui->cbHoldTxFreq->setEnabled (QSY_allowed);
- }
- }
-
- // the following are always disallowed in transmit
- ui->menuMode->setEnabled (!transmitting);
- }
-}
-
-void MainWindow::on_sbFtol_valueChanged(int value)
-{
- if (m_config.superFox() && m_specOp==SpecOp::HOUND && ui->sbFtol->value() > 100) {
- ui->sbFtol->setValue(100);
- return;
- }
- m_wideGraph->setTol (value);
- statusUpdate ();
- // save last used parameters
- QTimer::singleShot (200, [=] {
- if (m_mode=="FT8") m_settings->setValue ("Ftol_SF", ui->sbFtol->value());
- if (m_mode=="Q65") m_settings->setValue ("Ftol_Q65", ui->sbFtol->value());
- if (m_mode=="MSK144") m_settings->setValue ("Ftol_MSK144", ui->sbFtol->value());
- if (m_mode=="JT65") m_settings->setValue ("Ftol_JT65", ui->sbFtol->value ());
- if (m_mode=="JT4") m_settings->setValue ("Ftol_JT4", ui->sbFtol->value());
- if (m_mode=="JT9") m_settings->setValue ("Ftol_JT9", ui->sbFtol->value ());
- });
-}
-
-void::MainWindow::VHF_features_enabled(bool b)
-{
- if(m_mode!="JT4" and m_mode!="JT65" and m_mode!="Q65") b=false;
- if(b and m_mode!="Q65" and (ui->actionInclude_averaging->isChecked() or
- ui->actionInclude_correlation->isChecked())) {
- ui->actionDeepestDecode->setChecked (true);
- }
- ui->actionInclude_averaging->setVisible (b);
- ui->actionInclude_correlation->setVisible (b && m_mode!="Q65");
- ui->actionMessage_averaging->setEnabled(b && (m_mode=="JT4" or m_mode=="JT65"));
- ui->actionEnable_AP_JT65->setVisible (b && m_mode=="JT65");
-
- if(!b && m_msgAvgWidget and (SpecOp::FOX != m_specOp) and !m_config.autoLog()) {
- if(m_msgAvgWidget->isVisible() and m_mode!="JT4" and m_mode!="JT9" and m_mode!="JT65") {
- m_msgAvgWidget->close();
- }
- }
-}
-
-void MainWindow::on_sbTR_valueChanged(int value)
-{
- // if(!m_bFastMode and n>m_nSubMode) m_MinW=m_nSubMode;
- if(m_bFastMode or m_mode=="FreqCal" or m_mode=="FST4" or m_mode=="FST4W" or m_mode=="Q65") {
- m_TRperiod = value;
- if (m_mode == "FST4" || m_mode == "FST4W" || m_mode=="Q65")
- {
- if (m_TRperiod < 60)
- {
- ui->lh_decodes_headings_label->setText(" UTC dB DT Freq " + tr ("Message"));
- if (m_mode != "FST4W")
- {
- ui->rh_decodes_headings_label->setText(" UTC dB DT Freq " + tr ("Message"));
- }
- }
- else
- {
- ui->lh_decodes_headings_label->setText("UTC dB DT Freq " + tr ("Message"));
- if (m_mode != "FST4W")
- {
- ui->rh_decodes_headings_label->setText("UTC dB DT Freq " + tr ("Message"));
- }
- }
-
- if ("Q65" == m_mode)
- {
- switch (value)
- {
- case 15: ui->sbSubmode->setMaximum (2); break;
- case 30: ui->sbSubmode->setMaximum (3); break;
- case 120: ui->sbSubmode->setMaximum (5); break;
- default: ui->sbSubmode->setMaximum (4); break;
- }
- }
- }
- m_fastGraph->setTRPeriod (value);
- if (m_tci_audio && ui->bandComboBox->currentText()!="OOB")
- Q_EMIT m_config.transceiver_period(m_TRperiod);
- if (!m_tci_audio) {
- m_modulator->setTRPeriod(m_TRperiod); // TODO - not thread safe
- m_detector->setTRPeriod(m_TRperiod); // TODO - not thread safe
- }
- m_wideGraph->setPeriod (value, m_nsps);
- progressBar.setMaximum (value);
- }
- // if(m_transmitting) on_stopTxButton_clicked(); //### Is this needed or desirable? ###
- if (m_mode=="FST4") chk_FST4_freq_range();
- on_sbSubmode_valueChanged(ui->sbSubmode->value());
- statusUpdate ();
- check_button_color();
- // save last used parameters
- if (!programStart) QTimer::singleShot (1000, [=] {
- if (m_mode=="Q65") m_settings->setValue ("TRPeriod_Q65", ui->sbTR->value ());
- if (m_mode=="MSK144" && (!(m_currentBand=="6m" or m_currentBand=="4m" or m_currentBand=="2m"))) {
- m_settings->setValue ("TRPeriod_MSK144", ui->sbTR->value ());
- }
- if (m_mode=="MSK144" && (m_currentBand=="6m" or m_currentBand=="4m")) {
- m_settings->setValue ("TRPeriod_MSK144_6m", ui->sbTR->value ());
- }
- if (m_mode=="MSK144" && m_currentBand=="2m") {
- m_settings->setValue ("TRPeriod_MSK144_2m", ui->sbTR->value ());
- }
- if (m_mode=="FST4") m_settings->setValue ("TRPeriod_FST4", ui->sbTR->value ());
- if (m_mode=="JT9") m_settings->setValue ("TRPeriod", ui->sbTR->value ());
- });
-}
-
-void MainWindow::on_sbTR_FST4W_valueChanged(int value)
-{
- on_sbTR_valueChanged(value);
-}
-
-QChar MainWindow::current_submode () const
-{
- QChar submode {0};
- if (m_mode.contains (QRegularExpression {R"(^(JT65|JT9|JT4|Q65)$)"})
- && (m_config.enable_VHF_features () || "JT4" == m_mode))
- {
- submode = m_nSubMode + 65;
- }
- return submode;
-}
-
-void MainWindow::on_sbSubmode_valueChanged(int n)
-{
- m_nSubMode=n;
- m_wideGraph->setSubMode(m_nSubMode);
- auto submode = current_submode ();
- if (submode != QChar::Null) {
- QString t{m_mode + " " + submode};
- if(m_mode=="Q65") t=m_mode + "-" + QString::number(m_TRperiod) + submode;
- mode_label.setText (t);
- } else {
- mode_label.setText (m_mode);
- }
- if(m_mode=="Q65") {
- if(((m_nSubMode==5 && m_TRperiod==120.0) || (m_nSubMode==4 && m_TRperiod==60.0) || (m_nSubMode==3 && m_TRperiod==30.0) ||
- (m_nSubMode==2 && m_TRperiod==15.0)) && abs(ui->TxFreqSpinBox->value() - 700) > 15) {
- ui->TxFreqSpinBox->setStyleSheet("QSpinBox{background-color:red; color:white}");
- } else {
- ui->TxFreqSpinBox->setStyleSheet("");
- }
- }
- if(m_mode=="JT9") {
- if(m_nSubMode<4) {
- ui->cbFast9->setChecked(false);
- on_cbFast9_clicked(false);
- ui->cbFast9->setEnabled(false);
- ui->sbTR->setVisible(false);
- m_TRperiod=60.0;
- } else {
- if(!blocked) ui->cbFast9->setEnabled(true);
- }
- ui->sbTR->setVisible(m_bFast9);
- if(m_bFast9) ui->TxFreqSpinBox->setValue(700);
- }
- if(m_transmitting and m_bFast9 and m_nSubMode>=4) transmit (99.0);
- if (m_mode !="Q65") ui->TxFreqSpinBox->setStyleSheet("");
- statusUpdate ();
- check_button_color();
- // save last used parameters
- QTimer::singleShot (200, [=] {
- if (m_mode=="Q65") m_settings->setValue("SubMode_Q65",ui->sbSubmode->value());
- if (m_mode=="JT65") m_settings->setValue("SubMode_JT65",ui->sbSubmode->value());
- if (m_mode=="JT4") m_settings->setValue("SubMode_JT4",ui->sbSubmode->value());
- if (m_mode=="JT9") m_settings->setValue("SubMode",ui->sbSubmode->value());
- });
-}
-
-void MainWindow::on_cbFast9_clicked(bool b)
-{
- if(m_mode=="JT9") {
- m_bFast9=b;
-// ui->cbAutoSeq->setVisible(b);
- blocked=true; // needed to prevent a loop
- on_actionJT9_triggered();
- QTimer::singleShot (50, [=] {blocked = false;}); // needed to prevent a loop
- QTimer::singleShot (200, [=] {
- if(m_mode=="JT9") m_settings->setValue("JT9_Fast",m_bFast9);
- });
- }
-
- if(b) {
- m_TRperiod = ui->sbTR->value ();
- } else {
- m_TRperiod=60.0;
- }
- progressBar.setMaximum(int(m_TRperiod));
- m_wideGraph->setPeriod(m_TRperiod,m_nsps);
- fast_config(b);
- statusChanged ();
-}
-
-void MainWindow::on_cbSendMsg_toggled(bool b)
-{
- if (!(m_config.superFox() && m_specOp==SpecOp::FOX))
- return; // don't do anything with slot values unless SuperFox mode
- if(b) {
- ui->sbNslots->setValue(2);
- m_Nslots=2;
- } else {
- ui->sbNslots->setValue(5);
- m_Nslots=5;
- }
-}
-
-void MainWindow::on_cbShMsgs_toggled(bool b)
-{
- ui->cbTx6->setEnabled(b);
- m_bShMsgs=b;
- if(b) ui->cbSWL->setChecked(false);
- if(m_bShMsgs and (m_mode=="MSK144")) ui->rptSpinBox->setValue(1);
- int it0=itone[0];
- int ntx=m_ntx;
- m_lastCallsign.clear (); // ensure Tx5 gets updated
- genStdMsgs(m_rpt);
- itone[0]=it0;
- if(ntx==1) ui->txrb1->setChecked(true);
- if(ntx==2) ui->txrb2->setChecked(true);
- if(ntx==3) ui->txrb3->setChecked(true);
- if(ntx==4) ui->txrb4->setChecked(true);
- if(ntx==5) ui->txrb5->setChecked(true);
- if(ntx==6) ui->txrb6->setChecked(true);
- QTimer::singleShot (200, [=] {
- if(m_mode=="MSK144") m_settings->setValue("ShMsgs_MSK144",m_bShMsgs);
- if(m_mode=="Q65") m_settings->setValue("ShMsgs_Q65",m_bShMsgs);
- if(m_mode=="JT65") m_settings->setValue("ShMsgs_JT65",m_bShMsgs);
- if(m_mode=="JT4") m_settings->setValue("ShMsgs_JT4",m_bShMsgs);
- });
-}
-
-void MainWindow::on_cbSWL_toggled(bool b)
-{
- if(b) ui->cbShMsgs->setChecked(false);
-}
-
-void MainWindow::on_cbTx6_toggled(bool)
-{
- genCQMsg ();
-}
-
-void MainWindow::on_rbFixedTone_toggled(bool b)
-{
- ui->leEchoMessage->setEnabled(!b);
- ui->sbToneSpacing->setEnabled(!b);
-}
-
-void MainWindow::on_rbEchoMessage_toggled(bool b)
-{
- ui->sbToneSpacing->setEnabled(b);
-}
-
-void MainWindow::on_rbEchoCW_toggled(bool b)
-{
- ui->sbToneSpacing->setEnabled(!b);
-}
-
-void MainWindow::on_leEchoMessage_textChanged()
-{
- QString t=ui->leEchoMessage->text().toUpper();
- ui->leEchoMessage->setText(t);
-}
-
-
-// Takes a decoded CQ line and sets it up for reply
-void MainWindow::replyToCQ (QTime time, qint32 snr, float delta_time, quint32 delta_frequency
- , QString const& mode, QString const& message_text
- , bool /*low_confidence*/, quint8 modifiers)
-{
- QString format_string {"%1 %2 %3 %4 %5 %6"};
- auto const& time_string = time.toString ("~" == mode || "&" == mode || "+" == mode
- || (m_TRperiod < 60. && ("`" == mode || ":" == mode))
- ? "hhmmss" : "hhmm");
- auto text = message_text;
- auto ap_pos = text.lastIndexOf (QRegularExpression {R"((?:\?\s)?(?:a[0-9]|q[0-9][0-9]?)$)"});
- if (ap_pos >= 0)
- {
- // beware of decodes ending on shorter version of wanted call so
- // add a space
- text = text.left (ap_pos).trimmed () + ' ';
- }
- auto message_line = format_string
- .arg (time_string)
- .arg (snr, 3)
- .arg (delta_time, 4, 'f', 1)
- .arg (delta_frequency, 4)
- .arg (mode, -2)
- .arg (text);
- QTextCursor start {ui->decodedTextBrowser->document ()};
- start.movePosition (QTextCursor::End);
- auto cursor = ui->decodedTextBrowser->document ()->find (message_line, start, QTextDocument::FindBackward);
- if (cursor.isNull ())
- {
- // try again with with -0.0 delta time
- cursor = ui->decodedTextBrowser->document ()->find (format_string
- .arg (time_string)
- .arg (snr, 3)
- .arg ('-' + QString::number (delta_time, 'f', 1), 4)
- .arg (delta_frequency, 4)
- .arg (mode, -2)
- .arg (text), start, QTextDocument::FindBackward);
- }
- if (!cursor.isNull ())
- {
- if (m_config.udpWindowToFront ())
- {
- show ();
- raise ();
- activateWindow ();
- }
- if (m_config.udpWindowRestore () && isMinimized ())
- {
- showNormal ();
- raise ();
- }
- if ((text.contains (QRegularExpression {R"(^(CQ |CQDX |QRZ ))"}))
- || text.contains("73 ") || (ui->cbHoldTxFreq->isChecked ())) {
- // a message we are willing to accept and auto reply to
- m_bDoubleClicked = true;
- }
- DecodedText message {message_line};
- Qt::KeyboardModifiers kbmod {modifiers << 24};
- processMessage (message, kbmod);
- tx_watchdog (false);
- QApplication::alert (this);
- }
- else
- {
- qDebug () << "process reply message ignored, decode not found:" << message_line;
- }
-}
-
-void MainWindow::locationChange (QString const& location)
-{
- QString grid {location.trimmed ()};
- int len;
-
- // string 6 chars or fewer, interpret as a grid, or use with a 'GRID:' prefix
- if (grid.size () > 6) {
- if (grid.toUpper ().startsWith ("GRID:")) {
- grid = grid.mid (5).trimmed ();
- }
- else {
- // TODO - support any other formats, e.g. latlong? Or have that conversion done external to wsjtx
- return;
- }
- }
- if (MaidenheadLocatorValidator::Acceptable == MaidenheadLocatorValidator ().validate (grid, len)) {
- qDebug() << "locationChange: Grid supplied is " << grid;
- if (m_config.my_grid () != grid) {
- m_config.set_location (grid);
- genStdMsgs (m_rpt, false);
- pskSetLocal ();
- statusUpdate ();
- }
- } else {
- qDebug() << "locationChange: Invalid grid " << grid;
- }
-}
-
-void MainWindow::replayDecodes ()
-{
- // we accept this request even if the setting to accept UDP requests
- // is not checked
-
- // attempt to parse the decoded text
- for (QTextBlock block = ui->decodedTextBrowser->document ()->firstBlock (); block.isValid (); block = block.next ())
- {
- auto message = block.text ();
- message = message.left (message.indexOf (QChar::Nbsp)); // discard
- // any
- // appended info
- if (message.size() >= 4 && message.left (4) != "----")
- {
- auto const& parts = message.split (' ', SkipEmptyParts);
- if (parts.size () >= 5 && parts[3].contains ('.')) {
- postWSPRDecode (false, parts);
- } else {
- postDecode (false, message);
- }
- }
- }
- statusChanged ();
-}
-
-void MainWindow::postDecode (bool is_new, QString const& message)
-{
- if (no_decodes_to_UDP) return; // Don't send decoded messages to messageClient after a band change
- if (filtered) return; // Don't send filtered messages to messageClient
- if (message.contains("$VERIFY$")) return; // Don't send SuperFox OTP messages to messageClient
- auto const& decode = message.trimmed ();
- auto const& parts = decode.left (22).split (' ', SkipEmptyParts);
- if (parts.size () >= 5)
- {
- auto has_seconds = parts[0].size () > 4;
- m_messageClient->decode (is_new
- , QTime::fromString (parts[0], has_seconds ? "hhmmss" : "hhmm")
- , parts[1].toInt ()
- , parts[2].toFloat (), parts[3].toUInt (), parts[4]
- , decode.mid (has_seconds ? 24 : 22)
- , QChar {'?'} == decode.mid (has_seconds ? 24 + 36 : 22 + 36, 1)
- , m_diskData);
- }
-}
-
-void MainWindow::postWSPRDecode (bool is_new, QStringList parts)
-{
- if (parts.size () < 8)
- {
- parts.insert (6, "");
- }
- m_messageClient->WSPR_decode (is_new, QTime::fromString (parts[0], "hhmm"), parts[1].toInt ()
- , parts[2].toFloat (), Radio::frequency (parts[3].toFloat (), 6)
- , parts[4].toInt (), parts[5], parts[6], parts[7].toInt ()
- , m_diskData);
-}
-
-void MainWindow::networkError (QString const& e)
-{
- if (m_splash && m_splash->isVisible ()) m_splash->hide ();
- if (MessageBox::Retry == MessageBox::warning_message (this, tr ("Network Error")
- , tr ("Error: %1\nUDP server %2:%3")
- .arg (e)
- .arg (m_config.udp_server_name ())
- .arg (m_config.udp_server_port ())
- , QString {}
- , MessageBox::Cancel | MessageBox::Retry
- , MessageBox::Cancel))
- {
- // retry server lookup
- m_messageClient->set_server (m_config.udp_server_name (), m_config.udp_interface_names ());
- }
-}
-
-void MainWindow::on_syncSpinBox_valueChanged(int n)
-{
- m_minSync=n;
-}
-
-void MainWindow::p1ReadFromStdout() //p1readFromStdout
-{
- QString t1;
- while(p1.canReadLine()) {
- QString t(p1.readLine());
- if(ui->cbNoOwnCall->isChecked()) {
- if(t.contains(" " + m_config.my_callsign() + " ")) continue;
- if(t.contains(" <" + m_config.my_callsign() + "> ")) continue;
- }
- if(t.indexOf("<DecodeFinished>") >= 0) {
- m_bDecoded = m_nWSPRdecodes > 0;
- if(!m_diskData) {
- WSPR_history(m_dialFreqRxWSPR, m_nWSPRdecodes);
- if(m_nWSPRdecodes==0 and ui->band_hopping_group_box->isChecked()) {
- t = " " + tr ("Receiving") + " " + m_mode + " ----------------------- " +
- m_config.bands ()->find (m_dialFreqRxWSPR);
- t=beacon_start_time (-m_TRperiod / 2) + ' ' + t.rightJustified (66, '-');
- ui->decodedTextBrowser->insertText(t);
- }
- killFileTimer.start (45*1000); //Kill in 45s (for slow modes)
- }
- ndecodes_label.setText(QString::number(m_nWSPRdecodes));
- m_nWSPRdecodes=0;
- ui->DecodeButton->setChecked (false);
- if(m_uploadWSPRSpots && m_config.is_transceiver_online()) { // need working rig control
-#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0)
- uploadTimer.start(QRandomGenerator::global ()->bounded (0, 20000)); // Upload delay
-#else
- uploadTimer.start(20000 * qrand()/((double)RAND_MAX + 1.0)); // Upload delay
-#endif
- } else {
- QFile f {QDir::toNativeSeparators (m_config.writeable_data_dir ().absoluteFilePath ("wspr_spots.txt"))};
- if (f.exists ()) f.remove ();
- }
- m_RxLog=0;
- m_startAnother=m_loopall;
- m_decoderBusy = false;
- statusUpdate ();
- } else {
- int n=t.length();
- t=t.mid(0,n-2) + " ";
- t.remove(QRegExp("\\s+$"));
- QStringList rxFields = t.split(QRegExp("\\s+"));
- QString rxLine;
- QString grid="";
- if ( rxFields.count() == 8 ) {
- rxLine = QString("%1 %2 %3 %4 %5 %6 %7 %8")
- .arg(rxFields.at(0), 4)
- .arg(rxFields.at(1), 4)
- .arg(rxFields.at(2), 5)
- .arg(rxFields.at(3), 11)
- .arg(rxFields.at(4), 4)
- .arg(rxFields.at(5).leftJustified (12))
- .arg(rxFields.at(6), -6)
- .arg(rxFields.at(7), 3);
- postWSPRDecode (true, rxFields);
- grid = rxFields.at(6);
- } else if ( rxFields.count() == 7 ) { // Type 2 message
- rxLine = QString("%1 %2 %3 %4 %5 %6 %7 %8")
- .arg(rxFields.at(0), 4)
- .arg(rxFields.at(1), 4)
- .arg(rxFields.at(2), 5)
- .arg(rxFields.at(3), 11)
- .arg(rxFields.at(4), 4)
- .arg(rxFields.at(5).leftJustified (12))
- .arg("", -6)
- .arg(rxFields.at(6), 3);
- postWSPRDecode (true, rxFields);
- } else {
- rxLine = t;
- }
- if(grid!="") {
- double utch=0.0;
- int nAz,nEl,nDmiles,nDkm,nHotAz,nHotABetter;
- azdist_(const_cast <char *> ((m_config.my_grid () + " ").left (6).toLatin1 ().constData ()),
- const_cast <char *> ((grid + " ").left (6).toLatin1 ().constData ()),&utch,
- &nAz,&nEl,&nDmiles,&nDkm,&nHotAz,&nHotABetter,(FCL)6,(FCL)6);
- QString t1;
- if(m_config.miles()) {
- t1 = t1.asprintf("%7d",nDmiles);
- } else {
- t1 = t1.asprintf("%7d",nDkm);
- }
- rxLine += t1;
- }
-
- if (rxLine.left (4) != m_tBlankLine) {
- ui->decodedTextBrowser->new_period ();
- if (m_config.insert_blank ()) {
- QString band;
- Frequency f=1000000.0*rxFields.at(3).toDouble()+0.5;
- band = ' ' + m_config.bands ()->find (f);
- ui->decodedTextBrowser->insertText(band.rightJustified (71, '-'));
- }
- m_tBlankLine = rxLine.left(4);
- }
- m_nWSPRdecodes += 1;
- ui->decodedTextBrowser->insertText(rxLine);
- }
- if(m_position != 0) ui->decodedTextBrowser->horizontalScrollBar()->setValue(m_position);
- }
-}
-
-QString MainWindow::beacon_start_time (int n)
-{
- auto bt = qt_truncate_date_time_to (QDateTime::currentDateTimeUtc ().addSecs (n), m_TRperiod * 1.e3);
- if (m_TRperiod < 60.)
- {
- return bt.toString ("HHmmss");
- }
- else
- {
- return bt.toString ("HHmm");
- }
-}
-
-void MainWindow::WSPR_history(Frequency dialFreq, int ndecodes)
-{
- QDateTime t=QDateTime::currentDateTimeUtc().addSecs(-60);
- QString t1=t.toString("yyMMdd");
- QString t2=beacon_start_time (-m_TRperiod / 2);
- QString t3;
- t3 = t3.asprintf("%13.6f",0.000001*dialFreq);
- if(ndecodes<0) {
- t1=t1 + " " + t2 + t3 + " T";
- } else {
- QString t4;
- t4 = t4.asprintf("%4d",ndecodes);
- t1=t1 + " " + t2 + t3 + " R" + t4;
- }
- QFile f {m_config.writeable_data_dir ().absoluteFilePath ("WSPR_history.txt")};
- if (f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append)) {
- QTextStream out(&f);
- out << t1
-#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0)
- << Qt::endl
-#else
- << endl
-#endif
- ;
- f.close();
- } else {
- MessageBox::warning_message (this, tr ("File Error")
- , tr ("Cannot open \"%1\" for append: %2")
- .arg (f.fileName ()).arg (f.errorString ()));
- }
-}
-
-void MainWindow::uploadWSPRSpots (bool direct_post, QString const& decode_text)
-{
- // do not spot if disabled, replays, or if rig control not working
- if(!m_uploadWSPRSpots || m_diskData || !m_config.is_transceiver_online ()) return;
- if(m_uploading && !decode_text.size ()) {
- qDebug() << "Previous upload has not completed, spots were lost";
- wsprNet->abortOutstandingRequests ();
- m_uploading = false;
- }
- QString rfreq = QString("%1").arg((m_dialFreqRxWSPR + 1500) / 1e6, 0, 'f', 6);
- QString tfreq = QString("%1").arg((m_dialFreqRxWSPR +
- ui->TxFreqSpinBox->value()) / 1e6, 0, 'f', 6);
- auto pct = QString::number (ui->autoButton->isChecked () ? ui->sbTxPercent->value () : 0);
- if (direct_post)
- {
- // queues one FST4W spot
- wsprNet->post (m_config.my_callsign (), m_config.my_grid (), rfreq, tfreq,
- m_mode, m_TRperiod, pct,
- QString::number (m_dBm), version (), decode_text);
- }
- else
- {
- // queues spots for each decode in wspr_spots.txt
- wsprNet->upload (m_config.my_callsign (), m_config.my_grid (), rfreq, tfreq,
- m_mode, m_TRperiod, pct,
- QString::number (m_dBm), version (),
- m_config.writeable_data_dir ().absoluteFilePath ("wspr_spots.txt"));
- }
- // trigger upload of any queued spots
- if (!decode_text.size ())
- {
- m_uploading = true;
- }
-}
-
-void MainWindow::uploadResponse(QString const& response)
-{
- if (response == "done") {
- m_uploading=false;
- } else {
- if (response.startsWith ("Upload Failed")) {
- m_uploading=false;
- }
- qDebug () << "WSPRnet.org status:" << response;
- }
-}
-
-void MainWindow::on_TxPowerComboBox_currentIndexChanged(int index)
-{
- m_dBm = ui->TxPowerComboBox->itemData (index).toInt ();
-}
-
-void MainWindow::on_cbUploadWSPR_Spots_toggled(bool b)
-{
- m_uploadWSPRSpots=b;
-}
-
-void MainWindow::on_WSPRfreqSpinBox_valueChanged(int n)
-{
- ui->TxFreqSpinBox->setValue(n);
-}
-
-void MainWindow::on_sbFST4W_RxFreq_valueChanged(int n)
-{
- m_wideGraph->setRxFreq(n);
- statusUpdate ();
-}
-
-void MainWindow::on_sbFST4W_FTol_valueChanged(int n)
-{
- ui->sbFST4W_RxFreq->setSingleStep(n);
- m_wideGraph->setTol(n);
- statusUpdate ();
-}
-
-void MainWindow::on_pbTxNext_clicked(bool b)
-{
- if (b && !ui->autoButton->isChecked ())
- {
- ui->autoButton->click (); // make sure Tx is possible
- }
-}
-
-void MainWindow::WSPR_scheduling ()
-{
- if (ui->pbTxNext->isEnabled () && ui->pbTxNext->isChecked ())
- {
- // Tx Next button overrides all scheduling
- m_WSPR_tx_next = true;
- return;
- }
- QString t=ui->RoundRobin->currentText();
- if(m_mode=="FST4W" and t != tr ("Random")) {
- bool ok;
- int i=t.left (1).toInt (&ok) - 1;
- if (!ok) return;
- int n=t.right (1).toInt (&ok);
- if (!ok || 0 == n) return;
-
- qint64 ms = QDateTime::currentMSecsSinceEpoch() % 86400000;
- int nsec=ms/1000;
- int ntr=m_TRperiod;
- int j=((nsec+ntr-1) % (n*ntr))/ntr;
- m_WSPR_tx_next = i == j;
- return;
- }
- m_WSPR_tx_next = false;
- if (!ui->sbTxPercent->isEnabled ())
- {
- return; // don't schedule if %age disabled
- }
- if (m_config.is_transceiver_online () // need working rig control for hopping
- && !m_config.is_dummy_rig ()
- && ui->band_hopping_group_box->isChecked ()) {
- auto hop_data = m_WSPR_band_hopping.next_hop (m_auto);
- qDebug () << "hop data: period:" << hop_data.period_name_
- << "frequencies index:" << hop_data.frequencies_index_
- << "tune:" << hop_data.tune_required_
- << "tx:" << hop_data.tx_next_;
- m_WSPR_tx_next = hop_data.tx_next_;
- if (hop_data.frequencies_index_ >= 0) { // new band
- ui->bandComboBox->setCurrentIndex (hop_data.frequencies_index_);
- on_bandComboBox_activated (hop_data.frequencies_index_);
- // Execute user's hardware controller
- auto band = m_config.bands ()->find (m_freqNominal).remove ('m');
-#if defined(Q_OS_WIN)
- // On windows we use CMD.EXE to find and execute the
- // user_hardware executable. This means that the first matching
- // file extension on the PATHEXT environment variable found on
- // the PATH environment variable path list. This give maximum
- // flexibility for users to write user_hardware in their
- // language of choice, and place the file anywhere on the PATH
- // environment variable. Equivalent to typing user_hardware
- // without any path or extension at the CMD.EXE prompt.
- p3.start("CMD", QStringList {"/C", "user_hardware", band});
-#else
- // On non-Windows systems we expect the user_hardware executable
- // to be anywhere in the paths specified in the PATH environment
- // variable path list, and executable. Equivalent to typing
- // user_hardware without any path at the shell prompt.
- p3.start("/bin/sh", QStringList {"-c", "user_hardware " + band});
-#endif
-
- // Produce a short tuneup signal
- m_tuneup = false;
- if (hop_data.tune_required_) {
- m_tuneup = true;
- on_tuneButton_clicked (true);
- tuneATU_Timer.start (2500);
- }
- }
-
- // Display grayline status
- band_hopping_label.setText (hop_data.period_name_);
- }
- else {
- m_WSPR_tx_next = m_WSPR_band_hopping.next_is_tx(m_mode=="FST4W");
- }
-}
-
-void MainWindow::astroUpdate ()
-{
- if (m_astroWidget) {
- // no Doppler correction while CTRL pressed allows manual tuning
- if (Qt::ControlModifier & QApplication::queryKeyboardModifiers ()) return;
- if (m_tci && (ui->bandComboBox->currentText()=="OOB")) {
- qDebug() << "TCI Mode and OOB so MainWindow::setRig returning at top\n";
- return;
- }
-
- auto correction = m_astroWidget->astroUpdate(QDateTime::currentDateTimeUtc (),
- m_config.my_grid(), m_hisGrid,m_freqNominal,"Echo" == m_mode,
- m_transmitting,m_auto,!m_config.tx_QSY_allowed (),m_TRperiod);
- m_fDop=correction.dop;
- m_fSpread=correction.width;
- m_tEcho=correction.techo;
-
- if (m_transmitting && !m_config.tx_QSY_allowed ()) return; // No Tx Doppler correction if rig can't do it
- if (!m_astroWidget->doppler_tracking() or m_astroWidget->DopplerMethod()==0) {
- // We are not using RF Doppler correction
- m_fAudioShift=m_fDop;
- return;
- } else if (m_astroWidget->DopplerMethod()==10) { // else if added for enableShift fx
- // We are not using RF Doppler correction
- m_fAudioShift=m_fDop;
- }
-
- if ((m_monitoring || m_transmitting)
- && m_freqNominal >= 21000000 // No Doppler correction below 15m
- && m_config.split_mode ()) // Doppler correcion needs split mode
- {
- // adjust for rig resolution
- if (m_config.transceiver_resolution () > 2)
- {
- correction.rx = (correction.rx + 50) / 100 * 100;
- correction.tx = (correction.tx + 50) / 100 * 100;
- }
- else if (m_config.transceiver_resolution () > 1)
- {
- correction.rx = (correction.rx + 10) / 20 * 20;
- correction.tx = (correction.tx + 10) / 20 * 20;
- }
- else if (m_config.transceiver_resolution () > 0)
- {
- correction.rx = (correction.rx + 5) / 10 * 10;
- correction.tx = (correction.tx + 5) / 10 * 10;
- }
- else if (m_config.transceiver_resolution () < -2)
- {
- correction.rx = correction.rx / 100 * 100;
- correction.tx = correction.tx / 100 * 100;
- }
- else if (m_config.transceiver_resolution () < -1)
- {
- correction.rx = correction.rx / 20 * 20;
- correction.tx = correction.tx / 20 * 20;
- }
- else if (m_config.transceiver_resolution () < 0)
- {
- correction.rx = correction.rx / 10 * 10;
- correction.tx = correction.tx / 10 * 10;
- }
- m_astroCorrection = correction;
- if (m_reverse_Doppler) m_astroCorrection.reverse ();
- } else {
- m_astroCorrection = {};
- }
- if(!(m_tci && inSettings)) setRig ();
- m_fAudioShift=m_fDop - correction.rx;
- }
-}
-
-void MainWindow::setRig (Frequency f)
-{
- if (f)
- {
- m_freqNominal = f;
- genCQMsg ();
- m_freqTxNominal = m_freqNominal;
- if (m_astroWidget) m_astroWidget->nominal_frequency (m_freqNominal, m_freqTxNominal);
- }
- if (m_mode == "FreqCal"
- && m_frequency_list_fcal_iter != m_config.frequencies ()->end ()) {
- m_freqNominal = m_frequency_list_fcal_iter->frequency_ - ui->RxFreqSpinBox->value ();
- }
- if(m_transmitting && !m_config.tx_QSY_allowed ()) return;
- if ((m_monitoring || m_transmitting) && m_config.transceiver_online ())
- {
- if (m_transmitting && m_config.split_mode () && !(m_config.superFox() && m_specOp==SpecOp::FOX))
- {
- m_config.transceiver_tx_frequency (m_freqTxNominal + m_astroCorrection.tx);
- }
- else
- {
- m_config.transceiver_frequency (m_freqNominal + m_astroCorrection.rx);
- }
- }
-}
-
-void MainWindow::fastPick(int x0, int x1, int y)
-{
- float pixPerSecond=12000.0/512.0;
- if(m_TRperiod<30.0) pixPerSecond=12000.0/256.0;
- if(m_mode!="MSK144") return;
- if(!m_decoderBusy) {
- dec_data.params.newdat=0;
- dec_data.params.nagain=1;
- m_nPick=1;
- if(y > 120) m_nPick=2;
- m_t0Pick=x0/pixPerSecond;
- m_t1Pick=x1/pixPerSecond;
- m_dataAvailable=true;
- decode();
- }
-}
-
-void MainWindow::on_actionMeasure_reference_spectrum_triggered()
-{
- if(!m_monitoring) on_monitorButton_clicked (true);
- m_bRefSpec=true;
-}
-
-void MainWindow::on_actionMeasure_phase_response_triggered()
-{
- if(m_bTrain) {
- m_bTrain=false;
- MessageBox::information_message (this, tr ("Phase Training Disabled"));
- } else {
- m_bTrain=true;
- MessageBox::information_message (this, tr ("Phase Training Enabled"));
- }
-}
-
-void MainWindow::on_actionErase_reference_spectrum_triggered()
-{
- m_bClearRefSpec=true;
-}
-
-void MainWindow::freqCalStep()
-{
- if (m_frequency_list_fcal_iter == m_config.frequencies ()->end ()
- || ++m_frequency_list_fcal_iter == m_config.frequencies ()->end ()) {
- m_frequency_list_fcal_iter = m_config.frequencies ()->begin ();
- }
-
- // allow for empty list
- if (m_frequency_list_fcal_iter != m_config.frequencies ()->end ()) {
- setRig (m_frequency_list_fcal_iter->frequency_ - ui->RxFreqSpinBox->value ());
- }
-}
-
-void MainWindow::on_sbCQTxFreq_valueChanged(int)
-{
- setXIT (ui->TxFreqSpinBox->value ());
-}
-
-void MainWindow::on_cbCQTx_toggled(bool b)
-{
- ui->sbCQTxFreq->setEnabled(b);
- genCQMsg();
- if(b) {
- ui->txrb6->setChecked(true);
- m_ntx=6;
- m_QSOProgress = CALLING;
- }
- setRig ();
- setXIT (ui->TxFreqSpinBox->value ());
-}
-
-void MainWindow::statusUpdate () const
-{
- if (!ui || m_block_udp_status_updates) return;
- auto submode = current_submode ();
- auto ftol = ui->sbFtol->value ();
- if ("FST4W" == m_mode)
- {
- ftol = ui->sbFST4W_FTol->value ();
- }
- else if (!(ui->sbFtol->isVisible () && ui->sbFtol->isEnabled ()))
- {
- ftol = quint32_max;
- }
- auto tr_period = ui->sbTR->value ();
- auto rx_frequency = ui->RxFreqSpinBox->value ();
- if ("FST4W" == m_mode)
- {
- tr_period = ui->sbTR_FST4W->value ();
- rx_frequency = ui->sbFST4W_RxFreq->value ();
- }
- else if (!(ui->sbTR->isVisible () && ui->sbTR->isEnabled ()))
- {
- tr_period = quint32_max;
- }
- m_messageClient->status_update (m_freqNominal, m_mode, m_hisCall,
- QString::number (ui->rptSpinBox->value ()),
- m_mode, ui->autoButton->isChecked (),
- m_transmitting, m_decoderBusy,
- rx_frequency, ui->TxFreqSpinBox->value (),
- m_config.my_callsign (), m_config.my_grid (),
- m_hisGrid, m_tx_watchdog,
- submode != QChar::Null ? QString {submode} : QString {}, m_bFastMode,
- static_cast<quint8> (m_specOp),
- ftol, tr_period, m_multi_settings->configuration_name (),
- m_currentMessage);
-}
-
-void MainWindow::childEvent (QChildEvent * e)
-{
- if (e->child ()->isWidgetType ())
- {
- switch (e->type ())
- {
- case QEvent::ChildAdded: add_child_to_event_filter (e->child ()); break;
- case QEvent::ChildRemoved: remove_child_from_event_filter (e->child ()); break;
- default: break;
- }
- }
- QMainWindow::childEvent (e);
-}
-
-// add widget and any child widgets to our event filter so that we can
-// take action on key press ad mouse press events anywhere in the main window
-void MainWindow::add_child_to_event_filter (QObject * target)
-{
- if (target && target->isWidgetType ())
- {
- target->installEventFilter (this);
- }
- auto const& children = target->children ();
- for (auto iter = children.begin (); iter != children.end (); ++iter)
- {
- add_child_to_event_filter (*iter);
- }
-}
-
-// recursively remove widget and any child widgets from our event filter
-void MainWindow::remove_child_from_event_filter (QObject * target)
-{
- auto const& children = target->children ();
- for (auto iter = children.begin (); iter != children.end (); ++iter)
- {
- remove_child_from_event_filter (*iter);
- }
- if (target && target->isWidgetType ())
- {
- target->removeEventFilter (this);
- }
-}
-
-void MainWindow::tx_watchdog (bool triggered)
-{
- auto prior = m_tx_watchdog;
- m_tx_watchdog = triggered;
- if (triggered)
- {
- m_bTxTime=false;
- if (m_tune) stop_tuning ();
- if (m_auto) auto_tx_mode (false);
- // Highlight watchdog label red when watchdog stops TXing, and keep the value
- if ((m_config.watchdog () && m_mode!="WSPR" && m_mode!="FST4W") && !m_config.button_coloring_disabled()) {
- watchdog_label.setStyleSheet ("QLabel{color: #ffffff; background-color: #ff0000}");
- watchdog_label.setText (tr (" WD:0m "));
- }
- tx_status_label.setStyleSheet ("QLabel{color: #ffffff; background-color: #ff0000}");
- tx_status_label.setText (tr (" Runaway Tx watchdog "));
- QApplication::alert (this);
- if (SpecOp::HOUND == m_specOp) ui->txrb1->click (); // Go back to Tx1
- }
- else
- {
- m_idleMinutes = 0;
- update_watchdog_label ();
- }
- if (prior != triggered) statusUpdate ();
-}
-
-void MainWindow::update_watchdog_label ()
-{
- if (!m_auto) m_idleMinutes = 0; // No countdown unless Enable Tx is active (important for Wait & Call)
- if (m_config.watchdog () && m_mode!="WSPR" && m_mode!="FST4W")
- {
- watchdog_label.setText (tr (" WD:%1m ").arg (m_config.watchdog () - m_idleMinutes));
- watchdog_label.setVisible (true);
- // Highlight watchdog label yellow when there is less than one minute left
- if ((m_config.watchdog() - m_idleMinutes == 1) && (m_auto or m_tune))
- watchdog_label.setStyleSheet ("QLabel{color: #000000; background-color: #ffff00}");
- if (m_config.watchdog() - m_idleMinutes > 1) watchdog_label.setStyleSheet ("");
- }
- else
- {
- watchdog_label.setText (QString {});
- watchdog_label.setVisible (false);
- }
-}
-
-void MainWindow::on_cbMenus_toggled(bool b)
-{
- select_geometry (!b ? 2 : ui->actionSWL_Mode->isChecked () ? 1 : 0);
-}
-
-void MainWindow::on_cbCQonly_toggled(bool)
-{ //Fix this -- no decode here?
- to_jt9(m_ihsym,1,-1); //Send m_ihsym to jt9[.exe] and start decoding
- decodeBusy(true);
-}
-
-void MainWindow::on_cbAutoSeq_toggled(bool b)
-{
- ui->respondComboBox->setVisible((m_mode=="FT8" or m_mode=="FT4" or m_mode=="FST4"
- or m_mode=="Q65" or m_mode=="MSK144" or m_mode=="JT65" or m_mode=="JT9") and b);
- check_button_color();
-}
-
-void MainWindow::on_measure_check_box_stateChanged (int state)
-{
- m_config.enable_calibration (Qt::Checked != state);
-}
-
-void MainWindow::write_transmit_entry (QString const& file_name)
-{
- QFile f {m_config.writeable_data_dir ().absoluteFilePath (file_name)};
- if (f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append))
- {
- QTextStream out(&f);
- auto time = QDateTime::currentDateTimeUtc ();
- time = time.addSecs (-fmod(double(time.time().second()),m_TRperiod));
- out << time.toString("yyMMdd_hhmmss")
- << " Transmitting " << qSetRealNumberPrecision (12) << (m_freqNominal / 1.e6)
- << " MHz " << m_mode
- << ": " << m_currentMessage
-#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0)
- << Qt::endl
-#else
- << endl
-#endif
- ;
- f.close();
- }
- else
- {
- auto const& message = tr ("Cannot open \"%1\" for append: %2")
- .arg (f.fileName ()).arg (f.errorString ());
- QTimer::singleShot (0, [=] { // don't block guiUpdate
- MessageBox::warning_message (this, tr ("Log File Error"), message);
- });
- }
-}
-
-void MainWindow::readWidebandDecodes()
-{
- if(m_ActiveStationsWidget==NULL) return;
- int nhr=0;
- int nmin=0;
- int nsec=0;
- int nsnr=0;
- while(m_fetched < qmapcom.ndecodes) {
- // Recover and parse each decoded line.
- QString line=QString::fromLatin1(qmapcom.result[m_fetched]);
- m_fetched++;
- nhr=line.mid(0,2).toInt();
- nmin=line.mid(2,2).toInt();
- nsec=line.mid(4,2).toInt();
- double frx=line.mid(6,9).toDouble();
- double fsked=line.mid(16,7).toDouble();
- QString submode=line.mid(36,3);
- QString msg=line.mid(41,-1);
- int i1=msg.indexOf(" ");
- int i2=i1 +1 + msg.mid(i1+1,-1).indexOf(" ");
- QString dxcall=msg.mid(i1+1,i2-i1-1);
- if(stdCall(dxcall)) {
- QString w3=msg.mid(i2+1,-1);
- nsnr=line.mid(31,3).toInt();
- m_EMECall[dxcall].frx=frx;
- m_EMECall[dxcall].fsked=fsked;
- m_EMECall[dxcall].nsnr=nsnr;
- m_EMECall[dxcall].t=3600*nhr + 60*nmin + nsec;
- m_EMECall[dxcall].submode=submode;
- if(w3.contains(grid_regexp)) m_EMECall[dxcall].grid4=w3;
- bool bCQ=line.contains(" CQ ");
-// m_EMECall[dxcall].ready2call=(bCQ or line.contains(" 73") or line.contains(" RR73"));
- m_EMECall[dxcall].ready2call=(bCQ);
- Frequency frequency = (m_freqNominal/1000000) * 1000000 + int(fsked*1000.0);
- bool bFromDisk=qmapcom.nQDecoderDone==2;
- if(!bFromDisk and (m_EMECall[dxcall].grid4.contains(grid_regexp) or bCQ)) {
- qDebug() << "To PSKreporter:" << dxcall << m_EMECall[dxcall].grid4 << frequency << m_mode << nsnr;
- if (!m_psk_Reporter.addRemoteStation (dxcall, m_EMECall[dxcall].grid4, frequency, m_mode, nsnr)) {
- showStatusMessage (tr ("Spotting to PSK Reporter unavailable"));
- }
- }
- }
- }
-
- if (m_config.spot_to_psk_reporter ()) {
- m_psk_Reporter.sendReport(); // Upload any queued spots
- }
-
-// Update "m_wEMECall" by reading qmap_decodes.txt
- QMap<QString,EMECall>::iterator i;
- QString t="";
- QString t1;
- QString dxcall;
- QString dxgrid4;
- QStringList list;
- float f[100];
- int indx[100];
- int maxAge=m_ActiveStationsWidget->maxAge();
-
- m_ActiveStationsWidget->setClickOK(false);
- int k=0;
-
- for(i=m_EMECall.begin(); i!=m_EMECall.end(); i++) {
- bool bSkip=false;
- if(m_ActiveStationsWidget->wantedOnly() and m_EMEworked[i.key()]) bSkip=true;
- if(m_ActiveStationsWidget->readyOnly() and !i->ready2call) bSkip=true;
- if(!bSkip) {
- int snr=i->nsnr;
- QString submode=i->submode;
- int odd=0;
- if(submode.left(2)=="30" and (i->t%60)==0) odd=1;
- if(submode.left(2)=="60" and (i->t%120)==0) odd=1;
- int age=(3600*nhr + 60*nmin + nsec - (i->t))/60;
- char c2[3]={32,32,0};
- if(age<0) age += 1440;
- if(age<=maxAge) {
- dxcall=(i.key()+" ").left(8);
- dxgrid4=(i->grid4+"... ").left(4);
- if(!m_EMEworked[dxcall.trimmed()]) c2[0]=35; //# for not in log
- if(i->ready2call) c2[1]=42; //* for ready to call
- t1=t1.asprintf("%7.3f %5.1f %+03d %3s %8s %4s %3d %3d %2s\n",i->frx,i->fsked,snr,
- submode.toLatin1().constData(),dxcall.toLatin1().constData(),
- dxgrid4.toLatin1().constData(),odd,age,c2);
- f[k]=i->fsked;
- list.append(t1);
- k++;
- }
- m_ActiveStationsWidget->setClickOK(true);
- }
- }
-
- if(k>0) {
- t1="";
- int kz=k;
- indexx_(f,&kz,indx);
- for(int k=0; k<kz; k++) {
- int j=indx[k]-1;
- t1=t1.asprintf("%2d. ",k+1);
- t1+=list[j];
- m_ready2call[k]=list[j];
- t+=t1;
- }
- }
-
- if(m_ActiveStationsWidget != NULL) {
- m_ActiveStationsWidget->erase();
- m_ActiveStationsWidget->displayRecentStations(m_mode,t);
- m_ActiveStationsWidget->setClickOK(true);
- }
- if(ipc_qmap[2]!=0) {
- m_fetched=0;
- ipc_qmap[0]=0;
- ipc_qmap[2]=0;
- }
-}
-
-// -------------------------- Code for FT8 DXpedition Mode ---------------------------
-
-void MainWindow::hound_reply ()
-{
- if (!m_tune) {
- // Select Tx3, set TxFreq to FoxFreq, and Force Auto ON.
- ui->txrb3->setChecked (true);
- m_nSentFoxRrpt = 1;
- ui->rptSpinBox->setValue(m_rptSent.toInt());
- if (!m_auto) auto_tx_mode(true);
- if (!m_config.superFox()) ui->TxFreqSpinBox->setValue (m_nFoxFreq);
- stopWRTimer.start(int(11000.0*m_TRperiod)); // Tx3 timeout when in Hound mode
- }
-}
-
-void MainWindow::on_sbNlist_valueChanged(int n)
-{
- m_Nlist=n;
-}
-
-void MainWindow::on_sbNslots_valueChanged(int n)
-{
- if(m_specOp!=SpecOp::FOX) return;
- if(m_config.superFox()) return; // Don't allow setting m_Nslots manually in SF mode
- m_Nslots=n;
- if(m_specOp!=SpecOp::FOX) return;
- QString t;
- t = t.asprintf(" NSlots %d",m_Nslots);
- writeFoxQSO(t);
- if(!m_config.superFox()) m_Nslots0=n;
-}
-
-void MainWindow::FoxReset(QString reason="")
-{
- QFile f(m_config.temp_dir().absoluteFilePath("houndcallers.txt"));
- f.remove();
- ui->decodedTextBrowser->setText("");
- ui->houndQueueTextBrowser->setText("");
- ui->foxTxListTextBrowser->setText("");
-
- m_houndQueue.clear();
- m_foxQSO.clear();
- m_foxQSOinProgress.clear();
- m_discard_decoded_hounds_this_cycle = true; // discard decoded messages until the next cycle
- if (reason != "") writeFoxQSO(" " + reason);
- writeFoxQSO(" Reset");
-}
-
-void MainWindow::on_pbFoxReset_clicked()
-{
- if(m_specOp!=SpecOp::FOX) return;
- auto button = MessageBox::query_message (this, tr ("Confirm Reset"),
- tr ("Are you sure you want to clear the QSO queues?"));
- if(button == MessageBox::Yes) {
- FoxReset();
- }
-}
-
-void MainWindow::on_pbFreeText_clicked()
-{
- bool ok;
- if(m_config.superFox()) {
- m_freeTextMsg = QInputDialog::getText (this, tr("Free Text Message"),
- tr("Message:"), QLineEdit::Normal, m_freeTextMsg0, &ok).left(26);
- } else {
- m_freeTextMsg = QInputDialog::getText (this, tr("Free Text Message"),
- tr("Message:"), QLineEdit::Normal, m_freeTextMsg0, &ok).left(13);
- }
- if(ok) {
- m_freeTextMsg=m_freeTextMsg.toUpper();
- m_freeTextMsg0=m_freeTextMsg;
- }
-}
-
-void MainWindow::on_comboBoxHoundSort_activated(int index)
-{
- if(index!=-99) houndCallers(); //Silence compiler warning
-}
-
-void MainWindow::on_comboBoxCQ_activated()
-{
- if(m_config.superFox()) {
- ui->comboBoxCQ->setCurrentIndex(0); // No directional calls supported yet for SuperFox mode
- QTimer::singleShot (0, [=] { // don't block guiUpdate
- MessageBox::information_message(this, tr ("Directional calls not yet supported in SuperFox mode"));
- });
- }
-}
-
-#ifdef FOX_OTP
-QString MainWindow::foxOTPcode()
-{
- QString code;
- if (!m_config.OTPSeed().isEmpty())
- {
-
- OTPGenerator totp;
- QDateTime dateTime = dateTime.currentDateTime();
- code = totp.generateTOTP(m_config.OTPSeed(), dateTime, 6);
- LOG_INFO(QString("foxOTPcode: code is %1").arg(code));
- } else
- {
- code = "000000";
- showStatusMessage(tr("TOTP: No seed entered in fox configuration to generate verification code."));
- LOG_INFO(QString("foxOTPcode: No seed entered in fox configuration to generate verification code."));
- }
- return code;
-}
-#endif
-
-//------------------------------------------------------------------------------
-QString MainWindow::sortHoundCalls(QString t, int isort, int max_dB)
-{
-/* Called from "houndCallers()" to sort the list of calling stations by
- * specified criteria.
- *
- * QString "t" contains a list of Hound callers read from file "houndcallers.txt".
- * isort=0: random (shuffled order)
- * 1: Call
- * 2: Grid
- * 3: SNR (reverse order)
- * 4: Distance (reverse order)
- * 5: Age (reverse order)
- * 6: Continent
- * 7: User defined (reverse order)
- *
-*/
-
- QMap<QString,QString> map;
- QStringList lines,lines2;
- QString msg,houndCall,t1;
- QString ABC{"ABCDEFGHIJKLMNOPQRSTUVWXYZ _"};
- QList<int> reverse_sorted{3,4,5,6};
- QString Continents{" AF AN AS EU NA OC SA UN "}; // matches what we get from AD1C's country list
- QList<int> list;
- int i,j,k,n,nlines;
- bool bReverse = reverse_sorted.contains(isort);
-
- isort=qAbs(isort);
-// Save only the most recent transmission from each caller.
- lines = t.split("\n");
- nlines=lines.length()-1;
- for(i=0; i<nlines; i++) {
- msg=lines.at(i); //key = callsign
- if(msg.mid(13,1)==" ") msg=msg.mid(0,13) + "...." + msg.mid(17);
- houndCall=msg.split(" ").at(0); //value = "call grid snr freq dist age continent user-defined
- map[houndCall]=msg;
- }
-
- j=0;
- t="";
- for(auto a: map.keys()) {
- t1=map[a].split(" ",SkipEmptyParts).at(2);
- // add the user-defined value to the end of the line. Example:
- // JJ0NCC PM97 15 2724 7580 2 AS 67
- // PY7ZZ HI21 -13 1673 10549 1 SA -
-
- QString annotated_value_s{" - "}; // default
- qint32 annotated_value = 0;
-
- if (m_annotated_callsigns.contains(a)) {
- annotated_value = m_annotated_callsigns.value(a);
- annotated_value_s = QString::number(annotated_value);
- }
-
- map[a] += QString(" %1").arg(annotated_value_s, 8);
- int nsnr=t1.toInt(); // get snr
- if(nsnr <= max_dB) { // keep only if snr in specified range
- if(isort==1) t += map[a] + "\n";
- if (isort==3 or isort==4 or isort==5) { // numeric ones: snr, distance, age
- if (isort==3)
- i=2; // sort Hound calls by snr
- else
- i=isort; // part of the line that we want
- t1=map[a].split(" ",SkipEmptyParts).at(i);
- int isort_value = t1.toInt();
- if (isort==5) { // sort by age ascending
- isort_value = (100 < isort_value ? 100 : 100-isort_value);
- }
- n=1000*(isort_value+100) + j; // pack (snr or dist or age) and index j into n
- list.insert(j,n); // add n to list at [j]
- }
- if (isort == 6) { // sort by continent
- i = 6;
- QStringList parts = map[a].split(" ", SkipEmptyParts);
- if (parts.size() <= i + 1) {
- n = j;
- } else {
- QString cont = map[a].split(" ", SkipEmptyParts).at(i);
- int cont_n = Continents.indexOf(" " + cont + " ");
- n = 1000 + 1000 * cont_n + j; // index may return -1, so add 1000 to make it positive
- }
- list.insert(j, n);
- }
-
- if(isort==2) { // sort Hound calls by grid
- t1=map[a].split(" ",SkipEmptyParts).at(1);
- if(t1=="....") t1="ZZ99";
- int i1=ABC.indexOf(t1.mid(0,1));
- int i2=ABC.indexOf(t1.mid(1,1));
- n=100*(26*i1+i2)+t1.mid(2,2).toInt();
- n=1000*n + j; // pack ngrid and index j into n
- list.insert(j,n); // add n to list at [j]
- }
-
- if(isort==7) { // annotated value provided by external app
- n = 1000 + 1000 * std::max((qint32) 0, annotated_value) + j;
- list.insert(j, n);
- }
-
- lines2.insert(j,map[a]); // add map[a] to lines2 at [j]
- j++;
- }
- }
-
- if(isort>1) {
- if(bReverse) {
- std::sort (list.begin (), list.end (), std::greater<int> ());
- } else {
- std::sort (list.begin (), list.end ());
- }
- }
-
- if(isort>1) {
- for(i=0; i<j; i++) {
- k=list[i]%1000;
- n=list[i]/1000 - 100;
- t += lines2.at(k) + "\n";
- }
- }
-
- int nn=lines2.length();
- if(isort==0) { // shuffle Hound calls to random order
- int a[nn];
- for(i=0; i<nn; i++) {
- a[i]=i;
- }
- for(i=nn-1; i>-1; i--) {
-#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0)
- j = (i + 1) * QRandomGenerator::global ()->generateDouble ();
-#else
- j=(i+1)*double(qrand())/RAND_MAX;
-#endif
- std::swap (a[j], a[i]);
- t += lines2.at(a[i]) + "\n";
- }
- }
-
- int i0=t.indexOf("\n") + 1;
- m_nSortedHounds=0;
- if(i0 > 0) {
- m_nSortedHounds=qMin(t.length(),m_Nlist*i0)/i0; // Number of sorted & displayed Hounds
- }
- m_houndCallers=t.mid(0,m_Nlist*i0);
-
- return m_houndCallers;
-}
-
-void MainWindow::removeHoundFromCallingList(QString callsign)
-{
- QString text = m_houndCallers;
- QRegularExpression re = QRegularExpression("^" + callsign + "[^\\n]+\\n", QRegularExpression::MultilineOption);
- text.remove(re);
- if (text != m_houndCallers) {
- m_nSortedHounds--;
- m_houndCallers = text;
- ui->decodedTextBrowser->setHighlightedHoundText(m_houndCallers);
- }
-}
-//------------------------------------------------------------------------------
-void MainWindow::selectHound(QString line, bool bTopQueue)
-{
-/* Called from doubleClickOnCall() in DXpedition Fox mode.
- * QString "line" is a user-selected line from left text window.
- * The line may be selected by double-clicking; alternatively, hitting
- * <Enter> is equivalent to double-clicking on the top-most line.
-*/
- if(line.simplified().isEmpty()) return;
- if(line.length() < 6) return;
- QString houndCall=line.split(" ",SkipEmptyParts).at(0);
-
-// Don't add a call already enqueued or in QSO
- if(ui->houndQueueTextBrowser->toPlainText().indexOf(houndCall) >= 0) return;
-
- QString houndGrid=line.split(" ",SkipEmptyParts).at(1); // Hound caller's grid
- QString rpt=line.split(" ",SkipEmptyParts).at(2); // Hound SNR
-
- m_houndCallers=m_houndCallers.remove(line+"\n"); // Remove t from sorted Hound list
- m_nSortedHounds--;
- ui->decodedTextBrowser->setHighlightedHoundText(m_houndCallers); // Populate left window with Hound callers
- QString t1=houndCall + " ";
- QString t2=rpt;
- QString t1_with_grid;
- if(rpt.mid(0,1) != "-" and rpt.mid(0,1) != "+") t2="+" + rpt;
- if(t2.length()==2) t2=t2.mid(0,1) + "0" + t2.mid(1,1);
- t1=t1.mid(0,12) + t2;
- // display the callers, highlighting calls if necessary
- ui->houndQueueTextBrowser->insertText(bTopQueue ? t1 + "\n" : t1, QColor{}, QColor{}, houndCall, "", bTopQueue ? QTextCursor::Start : QTextCursor::End);
- t1_with_grid=t1 + " " + houndGrid; // Append the grid
- if (bTopQueue) {
- m_houndQueue.prepend(t1_with_grid); // Put this hound into the queue at the top
- } else {
- m_houndQueue.enqueue(t1_with_grid); // Put this hound into the queue
- }
- writeFoxQSO(" Sel: " + t1_with_grid);
- QTextCursor cursor = ui->houndQueueTextBrowser->textCursor();
- cursor.setPosition(0); // Scroll to top of list
- ui->houndQueueTextBrowser->setTextCursor(cursor);
- cursor = ui->decodedTextBrowser->textCursor();
- cursor.setPosition(0); // Highlighting happens in the forward direction
- ui->decodedTextBrowser->setTextCursor(cursor);
-}
-
-//------------------------------------------------------------------------------
-void MainWindow::houndCallers()
-{
-/* Called from decodeDone(), in DXpedition Fox mode. Reads decodes from file
- * "houndcallers.txt", ignoring any that are not addressed to MyCall, are already
- * in the stack, or with whom a QSO has been started. Others are considered to
- * be Hounds eager for a QSO. We add caller information (Call, Grid, SNR, Freq,
- * Distance, Age, and Continent) to a list, sort the list by specified criteria,
- * and display the top N_Hounds entries in the left text window.
-*/
- // if frequency was changed in the middle of an interval, there's a flag set to ignore the decodes. Reset it here
- //
-
- if (m_discard_decoded_hounds_this_cycle)
- {
- m_discard_decoded_hounds_this_cycle = false; //
- return; // don't use these decodes
- }
-
-// Read decodes of the current period
- QFile d(m_config.temp_dir().absoluteFilePath("decoded.txt"));
- QTextStream ds(&d);
- QString decoded="";
- if(d.open(QIODevice::ReadOnly | QIODevice::Text)) {
- while (!ds.atEnd()) {
- decoded = ds.readAll();
- }
- ds.flush();
- d.close();
- }
-
- QFile f(m_config.temp_dir().absoluteFilePath("houndcallers.txt"));
- if(f.open(QIODevice::ReadOnly | QIODevice::Text)) {
- QTextStream s(&f);
- QString t="";
- QString line,houndCall,paddedHoundCall;
- m_nHoundsCalling=0;
- int nTotal=0; //Total number of decoded Hounds calling Fox in 4 most recent Rx sequences
-
-// Read and process the file of Hound callers.
- while(!s.atEnd()) {
- line=s.readLine();
- nTotal++;
- int i0=line.indexOf(" ");
- houndCall=line.mid(0,i0);
- paddedHoundCall=houndCall + " ";
- //Don't list a hound already in the queue
- if(!ui->houndQueueTextBrowser->toPlainText().contains(paddedHoundCall)) {
- if(ui->cbWorkDupes->isChecked()) {
- if(m_loggedByFox[houndCall].contains(m_lastBand)
- and !decoded.contains(paddedHoundCall)) continue; // don't display old messages again of stations already logged
- }
- if(m_foxQSOinProgress.contains(houndCall) || m_foxQSO.contains(houndCall))
- {
- continue;
- } // still in the QSO map, or was (very) recently worked
-
- if(m_foxQSO.contains(houndCall) && !ui->cbRxAll->isChecked()) {
- continue;
- } // already worked
- auto const& entity = m_logBook.countries ()->lookup (houndCall);
- auto const& continent = AD1CCty::continent (entity.continent);
-
-// If we are using a directed CQ, ignore Hound calls that do not comply.
- QString CQtext=ui->comboBoxCQ->currentText();
- if(CQtext.length()==5 and (continent!=CQtext.mid(3,2))) continue;
- int nCallArea=-1;
- if(CQtext.length()==4) {
- for(int i=houndCall.length()-1; i>0; i--) {
- if(houndCall.mid(i,1).toInt() > 0) nCallArea=houndCall.mid(i,1).toInt();
- if(houndCall.mid(i,1)=="0") nCallArea=0;
- if(nCallArea>=0) break;
- }
- if(nCallArea!=CQtext.mid(3,1).toInt()) continue;
- }
-// This houndCall passes all tests, add it to the list.
- t = t + line + " " + continent + "\n";
- m_nHoundsCalling++; // Number of accepted Hounds to be sorted
- }
- }
- if(m_foxLogWindow) m_foxLogWindow->callers (nTotal);
-
-// Sort and display accumulated list of Hound callers
- if(t.length()>30) {
- m_isort=ui->comboBoxHoundSort->currentIndex();
- QString t1=sortHoundCalls(t,m_isort,m_max_dB);
- ui->decodedTextBrowser->setHighlightedHoundText(t1);
- }
- QTextCursor cursor = ui->decodedTextBrowser->textCursor();
- cursor.setPosition(0); // Set scroll at top, in preparation for highlighting messages
- ui->decodedTextBrowser->setTextCursor(cursor);
- f.close();
- }
-}
-
-void MainWindow::foxRxSequencer(QString msg, QString houndCall, QString rptRcvd)
-{
-/* Called from "readFromStdOut()" to process decoded messages of the form
- * "myCall houndCall R+rpt".
- *
- * If houndCall matches a callsign in one of our active QSO slots, we
- * prepare to send "houndCall RR73" to that caller.
-*/
- if(m_foxQSO.contains(houndCall)) {
- m_foxQSO[houndCall].rcvd=rptRcvd.mid(1); //Save report Rcvd, for the log
- m_foxQSO[houndCall].tFoxRrpt=m_tFoxTx; //Save time R+rpt was received
- writeFoxQSO(" Rx: " + msg.trimmed());
- } else {
- for(QString hc: m_foxQSO.keys()) { //Check for a matching compound call
- if(hc.contains("/"+houndCall) or hc.contains(houndCall+"/")) {
- m_foxQSO[hc].rcvd=rptRcvd.mid(1); //Save report Rcvd, for the log
- m_foxQSO[hc].tFoxRrpt=m_tFoxTx; //Save time R+rpt was received
- writeFoxQSO(" Rx: " + msg.trimmed());
- }
- }
- }
-}
-
-void MainWindow::updateFoxQSOsInProgressDisplay()
-{
-
- ui->foxTxListTextBrowser->clear();
- for (int i = 0; i < m_foxQSOinProgress.count(); i++)
- {
- //First do those for QSOs in progress
- QString hc = m_foxQSOinProgress.at(i);
- QString status = m_foxQSO[hc].ncall > m_maxStrikes ? QString(" (rx) ") : QString(" ");
- QString str = (hc + " ").left(13) + QString::number(m_foxQSO[hc].ncall) + status;
- ui->foxTxListTextBrowser->insertText(str, QColor{}, QColor{}, hc, "", QTextCursor::End);
- }
-}
-
-void MainWindow::foxTxSequencer()
-{
-/* Called from guiUpdate at the point where an FT8 Fox-mode transmission
- * is to be started.
- *
- * Determine what the Tx message(s) will be for each active slot, call
- * foxgen() to generate and accumulate the corresponding waveform.
-*/
-
- qint64 now=QDateTime::currentMSecsSinceEpoch()/1000;
- QStringList list1; //Up to NSlots Hound calls to be sent RR73
- QStringList list2; //Up to NSlots Hound calls to be sent a report
- QString fm; //Fox message to be transmitted
- QString hc,hc1,hc2; //Hound calls
- QString t,rpt;
- qint32 islot=0;
- qint32 ncalls_sent=0;
- qint32 n1,n2,n3;
- int nMaxRemainingSlots=0;
- static unsigned int m_tFoxTxSinceOTP=99;
-
- m_tFoxTxSinceOTP++;
- m_tFoxTx++; //Increment Fox Tx cycle counter
-
- // Is it time for a stand-alone CQ?
- if(m_tFoxTxSinceCQ >= m_foxCQtime and ui->cbMoreCQs->isChecked()) {
- fm=ui->comboBoxCQ->currentText() + " " + m_config.my_callsign();
- if(!fm.contains("/")) {
- //If Fox is not a compound callsign, add grid to the CQ message.
- fm += " " + m_config.my_grid().mid(0,4);
- m_fullFoxCallTime=now;
- }
- m_tFoxTx0=m_tFoxTx; //Remember when we sent a CQ
- islot++;
- foxGenWaveform(islot-1,fm);
- goto Transmit;
- }
-
- // Maybe send out the freetext message?
- if (!m_config.superFox() && ui->cbSendMsg->isChecked() && (islot < m_Nslots)) {
- fm = m_freeTextMsg;
- islot++;
- foxGenWaveform(islot - 1, fm);
- }
-
-#ifdef FOX_OTP
- // Send OTP message maybe for regular fox mode
- if (!m_config.superFox() && m_config.OTPEnabled() && (islot < m_Nslots) && (m_tFoxTxSinceOTP >= m_config.OTPinterval()))
- {
- // truncated callsign + OTP code (to be under 13 character limit of free text)
- QString trunc_call=m_config.my_callsign().left(6).split("/").at(0); // truncate callsign to 6 characters
- fm = trunc_call + "." + foxOTPcode(); // N5J-> N5J.123456, W1AW/7 -> W1AW.123456, 4U1IARU -> 4U1IAR.123456
- m_tFoxTxSinceOTP = 0; //Remember when we sent a Tx5
- islot++;
- foxGenWaveform(islot - 1, fm);
- }
-#endif
-
-//Compile list1: up to NSLots Hound calls to be sent RR73
- for(QString hc: m_foxQSO.keys()) { //Check all Hound calls: First priority
- if(m_foxQSO[hc].tFoxRrpt<0) continue;
- if(m_foxQSO[hc].tFoxRrpt - m_foxQSO[hc].tFoxTxRR73 > 3) {
- //Has been a long time since we sent RR73
- if(list1.size()>=(m_Nslots - islot)) goto list1Done;
- list1 << hc; //Add to list1
- m_foxQSO[hc].tFoxTxRR73 = m_tFoxTx; //Time RR73 is sent
- m_foxQSO[hc].nRR73++; //Increment RR73 counter
- }
- }
-
- for(QString hc: m_foxQSO.keys()) { //Check all Hound calls: Second priority
- if(m_foxQSO[hc].tFoxRrpt<0) continue;
- if(m_foxQSO[hc].tFoxTxRR73 < 0) {
- //Have not yet sent RR73
- if(list1.size()>=(m_Nslots - islot)) goto list1Done;
- list1 << hc; //Add to list1
- m_foxQSO[hc].tFoxTxRR73 = m_tFoxTx; //Time RR73 is sent
- m_foxQSO[hc].nRR73++; //Increment RR73 counter
- }
- }
-
- for(QString hc: m_foxQSO.keys()) { //Check all Hound calls: Third priority
- if(m_foxQSO[hc].tFoxRrpt<0) continue;
- if(m_foxQSO[hc].tFoxTxRR73 <= m_foxQSO[hc].tFoxRrpt) {
- //We received R+rpt more recently than we sent RR73
- if(list1.size()>=(m_Nslots - islot)) goto list1Done;
- list1 << hc; //Add to list1
- m_foxQSO[hc].tFoxTxRR73 = m_tFoxTx; //Time RR73 is sent
- m_foxQSO[hc].nRR73++; //Increment RR73 counter
- }
- }
-
-list1Done:
-//Compile list2: Up to Nslots Hound calls to be sent a report.
-// For Superfox, up to 5 RR73, but only 4 callsigns with reports. m_NSlots should be 5 for SF.
- nMaxRemainingSlots = (m_config.superFox()) ? m_Nslots - 1 : m_Nslots;
- if(m_config.superFox() and ui->cbSendMsg->isChecked()) nMaxRemainingSlots=4;
- for(int i=0; i<m_foxQSOinProgress.count(); i++) {
- //First do those for QSOs in progress
- hc=m_foxQSOinProgress.at(i);
- if((m_foxQSO[hc].tFoxRrpt < 0) and (m_foxQSO[hc].ncall < m_maxStrikes)) {
- //Sent him a report and have not received R+rpt: call him again
- if(list2.size()>=(nMaxRemainingSlots - islot)) goto list2Done;
- list2 << hc; //Add to list2
- if(list2.size() == nMaxRemainingSlots) goto list2Done;
- }
- }
-
- while(!m_houndQueue.isEmpty()) {
- //Start QSO with a new Hound
- if (list2.size() == (nMaxRemainingSlots - islot))
- {
- break;
- }
- t=m_houndQueue.dequeue(); //Fetch new hound from queue
- int i0=t.indexOf(" ");
- hc=t.mid(0,i0); //hound call
- list2 << hc; //Add new Hound to list2
- m_foxQSOinProgress.enqueue(hc); //Put him in the QSO queue
- m_foxQSO[hc].grid=t.mid(16,4); //Hound grid
- rpt=t.mid(12,3); //report to send Hound
- m_foxQSO[hc].sent=rpt; //Report to send him
- m_foxQSO[hc].ncall=0; //Start a new Hound
- m_foxQSO[hc].nRR73 = 0; //Have not sent RR73
- m_foxQSO[hc].rcvd = -99; //Have not received R+rpt
- m_foxQSO[hc].tFoxRrpt = -1; //Have not received R+rpt
- m_foxQSO[hc].tFoxTxRR73 = -1; //Have not sent RR73
- refreshHoundQueueDisplay();
- }
-
-list2Done:
-
- n1=list1.size();
- n2=list2.size();
- n3=qMax(n1,n2);
- if(n3>m_Nslots) n3=m_Nslots;
- for(int i=0; i<n3; i++) {
- hc1="";
- fm="";
- if(i<n1 and i<n2) {
- hc1=list1.at(i);
- hc2=list2.at(i);
- m_foxQSO[hc2].ncall++;
- fm = Radio::base_callsign(hc1) + " RR73; " + Radio::base_callsign(hc2) +
- " <" + m_config.my_callsign() + "> " + m_foxQSO[hc2].sent;
- }
- if(i<n1 and i>=n2) {
- hc1=list1.at(i);
- fm = Radio::base_callsign(hc1) + " " + m_baseCall + " RR73"; //Standard FT8 message
- }
-
- if(hc1!="") {
- auto already_logged = m_loggedByFox[hc1].contains(m_lastBand + " "); // already logged this call on this band?
-
- if (!already_logged) { // Log this QSO!
- auto QSO_time = QDateTime::currentDateTimeUtc ();
- m_hisCall=hc1;
- m_hisGrid=m_foxQSO[hc1].grid;
- m_rptSent=m_foxQSO[hc1].sent;
- m_rptRcvd=m_foxQSO[hc1].rcvd;
- if (!m_foxLogWindow) on_fox_log_action_triggered ();
- if (m_logBook.fox_log ()->add_QSO (QSO_time, m_hisCall, m_hisGrid, m_rptSent, m_rptRcvd, m_lastBand))
- {
- writeFoxQSO (QString {" Log: %1 %2 %3 %4 %5"}.arg (m_hisCall).arg (m_hisGrid)
- .arg (m_rptSent).arg (m_rptRcvd).arg (m_lastBand));
- on_logQSOButton_clicked ();
- QTimer::singleShot (13000, [=] {
- m_foxQSOinProgress.removeOne(hc1); //Remove from In Progress window
- updateFoxQSOsInProgressDisplay(); //Update InProgress display after Tx is complete
- });
- }
- m_loggedByFox[hc1] += (m_lastBand + " ");
- }
- else
- {
- // note that this is a duplicate
- writeFoxQSO(QString{" Dup: %1 %2 %3 %4 %5"}.arg(m_hisCall).arg(m_hisGrid)
- .arg(m_rptSent).arg(m_rptRcvd).arg(m_lastBand));
- }
- }
-
- if(i<n2 and fm=="") {
- hc2=list2.at(i);
- m_foxQSO[hc2].ncall++;
- fm = Radio::base_callsign(hc2) + " " + m_baseCall + " " + m_foxQSO[hc2].sent; //Standard FT8 message
- }
- islot++;
- ncalls_sent++;
- foxGenWaveform(islot-1,fm); //Generate tx waveform
- }
-
- if(islot < m_Nslots) {
- //At least one slot is still open
- if(ncalls_sent==0 or ((m_tFoxTx-m_tFoxTx0>=4) and ui->cbMoreCQs->isChecked())) {
- //Roughly every 4th Tx sequence, put a CQ message in an otherwise empty slot
- fm=ui->comboBoxCQ->currentText() + " " + m_config.my_callsign();
- if(!fm.contains("/")) {
- fm += " " + m_config.my_grid().mid(0,4);
- m_tFoxTx0=m_tFoxTx; //Remember when we send a CQ
- m_fullFoxCallTime=now;
- }
- islot++;
- foxGenWaveform(islot-1,fm);
- }
- }
-
-Transmit:
- foxcom_.nslots=islot;
- foxcom_.nfreq=ui->TxFreqSpinBox->value();
- if(m_config.split_mode()) foxcom_.nfreq = foxcom_.nfreq - m_XIT; //Fox Tx freq
- QString foxCall=m_config.my_callsign() + " ";
- ::memcpy(foxcom_.mycall, foxCall.toLatin1(),sizeof foxcom_.mycall); //Copy Fox callsign into foxcom_
- bool bSuperFox=m_config.superFox();
- foxcom_.bMoreCQs=ui->cbMoreCQs->isChecked();
- foxcom_.bSendMsg=ui->cbSendMsg->isChecked();
- ::memcpy(foxcom_.textMsg, m_freeTextMsg0.leftJustified(26,' ').toLatin1(),26);
- auto fname {QDir::toNativeSeparators(m_config.writeable_data_dir().absoluteFilePath("sfox_1.dat")).toLocal8Bit()};
- foxgen_(&bSuperFox, fname.constData(), (FCL)fname.size());
- if(bSuperFox) {
- writeFoxTxMsgs();
- sfox_tx();
- }
- m_tFoxTxSinceCQ++;
-
- for(QString hc: m_foxQSO.keys()) { //Check for strikeout or timeout
- if(m_foxQSO[hc].ncall>=m_maxStrikes) m_foxQSO[hc].ncall++;
- bool b1=((m_tFoxTx - m_foxQSO[hc].tFoxRrpt) > 2*m_maxFoxWait) and
- (m_foxQSO[hc].tFoxRrpt > 0);
- bool b2=((m_tFoxTx - m_foxQSO[hc].tFoxTxRR73) > m_maxFoxWait) and
- (m_foxQSO[hc].tFoxTxRR73>0);
- bool b3=(m_foxQSO[hc].ncall >= m_maxStrikes+m_maxFoxWait);
- bool b4=(m_foxQSO[hc].nRR73 >= m_maxStrikes);
- if(b1 or b2 or b3 or b4) {
- m_foxQSO.remove(hc);
- m_foxQSOinProgress.removeOne(hc);
- }
- }
-
- if (m_foxLogWindow)
- {
- update_foxLogWindow_rate();
- m_foxLogWindow->queued (m_foxQSOinProgress.count ());
- }
- updateFoxQSOsInProgressDisplay();
-}
-
-void MainWindow::update_foxLogWindow_rate()
-{
- if (m_foxLogWindow) {
- m_foxLogWindow->rate(m_logBook.fox_log()->rate());
- }
-}
-
-void MainWindow::refreshHoundQueueDisplay()
-{
- ui->houndQueueTextBrowser->clear();
- for (QString line: m_houndQueue) {
- auto hc = line.mid(0, 12).trimmed();
- ui->houndQueueTextBrowser->insertText(line, QColor{}, QColor{}, hc, "", QTextCursor::End);
- }
-}
-
-void MainWindow::doubleClickOnFoxQueue(Qt::KeyboardModifiers modifiers)
-{
- if(modifiers==9999) return; //Silence compiler warning
- QTextCursor cursor=ui->houndQueueTextBrowser->textCursor();
- cursor.setPosition(cursor.selectionStart());
- QString houndLine=cursor.block().text();
- QString houndCall=houndLine.mid(0,12).trimmed();
-
- if (modifiers == (Qt::AltModifier))
- {
- //Alt-click on a Fox queue entry - put on top of queue
- // remove
- for(auto i=0; i<m_houndQueue.size(); i++) {
- QString t = m_houndQueue[i];
- QString hc = t.mid(0, 12).trimmed();
- if (hc == houndCall) {
- m_houndQueue.removeAt(i);
- break;
- }
- }
- m_houndQueue.prepend(houndLine);
- refreshHoundQueueDisplay();
- } else
- {
- writeFoxQSO(" Del: " + houndCall);
- QQueue <QString> tmpQueue;
- while (!m_houndQueue.isEmpty())
- {
- QString t = m_houndQueue.dequeue();
- QString hc = t.mid(0, 12).trimmed();
- if (hc != houndCall) tmpQueue.enqueue(t);
- }
- m_houndQueue.swap(tmpQueue);
- refreshHoundQueueDisplay();
- }
-}
-
-void MainWindow::doubleClickOnFoxInProgress(Qt::KeyboardModifiers modifiers)
-{
- if (modifiers == 9999) return; //Silence compiler warning
- QTextCursor cursor = ui->foxTxListTextBrowser->textCursor();
- cursor.setPosition(cursor.selectionStart());
- QString houndLine = cursor.block().text();
- QString houndCall = houndLine.mid(0, 12).trimmed();
-
- if (modifiers == 0)
- {
- m_foxQSO[houndCall].ncall = m_maxStrikes + 1; // time them out
- updateFoxQSOsInProgressDisplay();
- }
-}
-
-void MainWindow::foxQueueTopCallCommand()
-{
- m_decodedText2 = true;
- if(SpecOp::FOX==m_specOp && m_decodedText2 && m_houndQueue.count() < MAX_HOUNDS_IN_QUEUE)
- {
-
- QTextCursor cursor = ui->decodedTextBrowser->textCursor();
- cursor.setPosition(cursor.selectionStart());
- QString houndCallLine = cursor.block().text();
-
- writeFoxQSO(" QTop: " + houndCallLine);
- selectHound(houndCallLine, true); // alt double-click gets put at top of queue
- }
-}
-
-void MainWindow::foxGenWaveform(int i,QString fm)
-{
-//Generate and accumulate the Tx waveform
- fm += " ";
- fm=fm.mid(0,40);
- if(fm.mid(0,3)=="CQ ") m_tFoxTxSinceCQ=-1;
-
- QString txModeArg;
- txModeArg = txModeArg.asprintf("FT8fox %d",i+1);
- int nfreq=ui->TxFreqSpinBox->value()+60*i;
-
- if(m_config.superFox() && SpecOp::FOX==m_specOp) {
- nfreq=750;
- if(i==0 && ui->cbSendMsg->isChecked()) {
- ui->decodedTextBrowser2->displayTransmittedText(m_freeTextMsg0, txModeArg,
- nfreq,m_bFastMode,m_TRperiod,m_config.superFox());
- }
- }
-
- ui->decodedTextBrowser2->displayTransmittedText(fm.trimmed(), txModeArg,
- nfreq,m_bFastMode,m_TRperiod,m_config.superFox());
- foxcom_.i3bit[i]=0;
- if(fm.indexOf("<")>0) foxcom_.i3bit[i]=1;
- strncpy(&foxcom_.cmsg[i][0],fm.toLatin1(),40); //Copy this message into cmsg[i]
- if(i==0) m_fm1=fm;
- QString t;
- t = t.asprintf(" Tx%d: ",i+1);
- writeFoxQSO(t + fm.trimmed());
-}
-
-void MainWindow::writeFoxTxMsgs() {
- // references extern struct foxcom_
- QString t;
- for (int i = 0; i < 5; i++) {
- t = QString::fromLatin1(foxcom_.cmsg[i]).left(40);
- if (t.length() > 0) {
- write_all("Tx", t);
- }
- }
- t = QString::fromLatin1(foxcom_.textMsg).left(38);
- if (foxcom_.bSendMsg) {
- write_all("Tx", "-Free Text- "+t);
- }
- if (foxcom_.bMoreCQs) {
- write_all("Tx", "-MoreCQs- ");
- }
-}
- void MainWindow::writeFoxQSO(QString const& msg)
-{
- QString t;
- t = t.asprintf("%3d%3d%3d",m_houndQueue.count(),m_foxQSOinProgress.count(),m_foxQSO.count());
- QFile f {m_config.writeable_data_dir ().absoluteFilePath ("FoxQSO.txt")};
- if (f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append)) {
- QTextStream out(&f);
- out << QDateTime::currentDateTimeUtc().toString("yyyy-MM-dd hh:mm:ss") << " "
-#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0)
- << Qt::fixed
-#else
- << fixed
-#endif
- << qSetRealNumberPrecision (3) << (m_freqNominal/1.e6)
- << t << msg
-#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0)
- << Qt::endl
-#else
- << endl
-#endif
- ;
- f.close();
- } else {
- MessageBox::warning_message (this, tr("File Open Error"),
- tr("Cannot open \"%1\" for append: %2").arg(f.fileName()).arg(f.errorString()));
- }
-}
-
-/*################################################################################### */
-void MainWindow::foxTest()
-{
- QString curdir = QDir::currentPath();
- bool b_hounds_written = false;
-
- QFile fdiag(m_config.writeable_data_dir ().absoluteFilePath("diag.txt"));
- if(!fdiag.open(QIODevice::WriteOnly | QIODevice::Text)) return;
-
- QFile f(m_config.writeable_data_dir ().absoluteFilePath("steps.txt"));
- if(!f.open(QIODevice::ReadOnly | QIODevice::Text)) {
- fdiag.write("Cannot open steps.txt");
- return;
- }
-
- QTextStream s(&f);
- QTextStream sdiag(&fdiag);
-
- QFile fhounds(m_config.temp_dir().absoluteFilePath("houndcallers.txt"));
- if(!fhounds.open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Text))
- {
- sdiag << "can't write to houndcallers.txt";
- return;
- }
- QTextStream houndstream(&fhounds);
-
- QString line;
- QString t;
- QString msg;
- QString hc1;
- QString rptRcvd;
- qint32 n=0;
-
- while(!s.atEnd()) {
- line=s.readLine();
- if(line.length()==0) continue;
- if(line.mid(0,4).toInt()==0) line=" " + line;
- if(line.contains("NSlots")) {
- n=line.mid(44,1).toInt();
- ui->sbNslots->setValue(n);
- }
- if(line.contains("Sel:")) {
- t=line.mid(43,6) + " " + line.mid(54,4) + " " + line.mid(50,3);
- selectHound(t, false);
- }
- auto line_trimmed = line.trimmed();
- if(line_trimmed.startsWith("Hound:")) {
- t=line_trimmed.mid(6,-1).trimmed();
- b_hounds_written = true;
- houndstream << t
-#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0)
- << Qt::endl
-#else
- << endl
-#endif
- ;
- }
-
- if(line.contains("Del:")) {
- int i0=line.indexOf("Del:");
- hc1=line.mid(i0+6);
- int i1=hc1.indexOf(" ");
- hc1=hc1.mid(0,i1);
-
- writeFoxQSO(" Del: " + hc1);
- QQueue<QString> tmpQueue;
- while(!m_houndQueue.isEmpty()) {
- t=m_houndQueue.dequeue();
- QString hc=t.mid(0,6).trimmed();
- if(hc != hc1) tmpQueue.enqueue(t);
- }
- m_houndQueue.swap(tmpQueue);
- refreshHoundQueueDisplay();
- }
- if(line.contains("Rx:")) {
- msg=line.mid(37+6);
- t=msg.mid(24);
- int i0=t.indexOf(" ");
- hc1=t.mid(i0+1);
- int i1=hc1.indexOf(" ");
- hc1=hc1.mid(0,i1);
- int i2=qMax(msg.indexOf("R+"),msg.indexOf("R-"));
- if(i2>10) {
- rptRcvd=msg.mid(i2,4);
- foxRxSequencer(msg,hc1,rptRcvd);
- }
- }
- if(line.contains("Tx1:")) {
- foxTxSequencer();
- } else {
- t = t.asprintf("%3d %3d %3d %3d %5d ",m_houndQueue.count(),
- m_foxQSOinProgress.count(),m_foxQSO.count(),
- m_loggedByFox.count(),m_tFoxTx);
- sdiag << t << line.mid(37).trimmed() << "\n";
- }
- }
- if (b_hounds_written)
- {
- fhounds.close();
- houndCallers();
- }
-}
-
-void MainWindow::write_all(QString txRx, QString message)
-{
- if (!(ui->actionDisable_writing_of_ALL_TXT->isChecked())) {
- QString line;
- QString t;
- QString msg;
- QString mode_string;
- QString file_name="ALL.TXT";
- QRegularExpression verified_call_regex {"[A-Z0-9/]+\\sverified\\s*"};
-
- if(m_mode!="Echo") {
- if (message.size () > 5 && message[4]==' ') {
- msg=message.mid(4,-1);
- } else {
- msg=message.mid(6,-1);
- }
-
- if (message.size () > 19 && message[19]=='#') {
- mode_string="JT65 ";
- } else if (message.size () > 19 && message[19]=='@') {
- mode_string="JT9 ";
- } else if(m_mode=="Q65") {
- mode_string=mode_label.text();
- } else {
- mode_string=m_mode.leftJustified(6,' ');
- }
-
- if(mode_string=="FT8 " and txRx=="Tx" and m_config.superFox() and
- m_specOp==SpecOp::FOX) mode_string="FT8_SF";
-
- if(mode_string=="FT8 " and m_config.superFox() and
- m_specOp==SpecOp::HOUND) mode_string="FT8_SH";
-
- if (mode_string == "FT8_SH" && verified_call_regex.match(message).hasMatch()) {
- msg = " "+message;
- } else {
- msg = msg.mid(0, 15) + msg.mid(18, -1);
- }
-
- t = t.asprintf("%5d",ui->TxFreqSpinBox->value());
- if (txRx=="Tx") msg=" 0 0.0" + t + " " + message;
- auto time = QDateTime::currentDateTimeUtc ();
- if( (txRx=="Rx" || txRx=="Ck") && !m_bFastMode ) time=m_dateTimeSeqStart;
-
- if (txRx=="Rx") {
- t = t.asprintf("%10.3f ",m_freqNominalPeriod/1.e6); // prevent writing of wrong frequencies
- } else {
- t = t.asprintf("%10.3f ",m_freqNominal/1.e6);
- }
- if (m_diskData) {
- if (m_fileDateTime.size()==11) {
- line=m_fileDateTime + " " + t + txRx + " " + mode_string + msg;
- } else {
- line=m_fileDateTime + t + txRx + " " + mode_string + msg;
- }
- } else {
- line=time.toString("yyMMdd_hhmmss") + t + txRx + " " + mode_string + msg;
- }
-
- if (ui->actionSplit_ALL_TXT_yearly->isChecked()) file_name=(time.toString("yyyy") + "-" + "ALL.TXT");
- if (ui->actionSplit_ALL_TXT_monthly->isChecked()) file_name=(time.toString("yyyy-MM") + "-" + "ALL.TXT");
- if (m_mode=="WSPR") file_name="ALL_WSPR.TXT";
- } else {
- file_name="all_echo.txt";
- line=message;
- }
-
- QFile f{m_config.writeable_data_dir().absoluteFilePath(file_name)};
- if (f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append)) {
- QTextStream out(&f);
- out << line.trimmed()
-#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0)
- << Qt::endl
-#else
- << endl
-#endif
- ;
- f.close();
- } else {
- auto const& message2 = tr ("Cannot open \"%1\" for append: %2")
- .arg (f.fileName ()).arg (f.errorString ());
- QTimer::singleShot (0, [=] { // don't block guiUpdate
- MessageBox::warning_message(this, tr ("Log File Error"), message2); });
- }
- }
-}
-
-void MainWindow::chkFT4()
-{
- if(m_mode!="FT4") return;
- ui->cbAutoSeq->setEnabled(true);
- ui->respondComboBox->setVisible(true);
- ui->respondComboBox->setEnabled(true);
- ui->labDXped->setVisible(m_specOp!=SpecOp::NONE);
- ui->respondComboBox->setVisible(ui->cbAutoSeq->isChecked());
-
- m_specOp=m_config.special_op_id();
- if(m_specOp!=SpecOp::NONE and m_specOp!=SpecOp::FOX and m_specOp!=SpecOp::HOUND) {
- QString t0="";
- if(SpecOp::NA_VHF==m_specOp && m_config.NCCC_Sprint()) t0="NCCC Sprint";
- if(SpecOp::NA_VHF==m_specOp && !m_config.NCCC_Sprint()) t0="NA VHF";
- if(SpecOp::EU_VHF==m_specOp) t0="EU VHF";
- if(SpecOp::FIELD_DAY==m_specOp) t0="Field Day";
- if(SpecOp::RTTY==m_specOp) t0="FT RU";
- if(SpecOp::WW_DIGI==m_specOp) t0="WW Digi";
- if(SpecOp::ARRL_DIGI==m_specOp) t0="ARRL Digi";
- if(SpecOp::Q65_PILEUP==m_specOp) t0="Q65 Pileup";
- if(t0=="") {
- ui->labDXped->setVisible(false);
- } else {
- ui->labDXped->setVisible(true);
- ui->labDXped->setText(t0);
- }
- if(m_specOp!=SpecOp::Q65_PILEUP) on_contest_log_action_triggered();
- }
- if (SpecOp::HOUND == m_specOp or SpecOp::FOX == m_specOp) {
- ui->labDXped->setVisible(false);
- }
-
-}
-
-void MainWindow::on_pbBestSP_clicked()
-{
- m_bBestSPArmed = !m_bBestSPArmed;
- if(m_bBestSPArmed and !m_transmitting) ui->pbBestSP->setStyleSheet ("QPushButton{color:red}");
- if(!m_bBestSPArmed) ui->pbBestSP->setStyleSheet ("");
- if(m_bBestSPArmed) m_dateTimeBestSP=QDateTime::currentDateTimeUtc();
-}
-
-void MainWindow::set_mode (QString const& mode)
-{
- if ("FT4" == mode) on_actionFT4_triggered ();
- else if ("FST4" == mode) on_actionFST4_triggered ();
- else if ("FST4W" == mode) on_actionFST4W_triggered ();
- else if ("FT8" == mode) on_actionFT8_triggered ();
- else if ("JT4" == mode) on_actionJT4_triggered ();
- else if ("JT9" == mode) on_actionJT9_triggered ();
- else if ("JT65" == mode) on_actionJT65_triggered ();
- else if ("Q65" == mode) on_actionQ65_triggered ();
- else if ("FreqCal" == mode) on_actionFreqCal_triggered ();
- else if ("MSK144" == mode) on_actionMSK144_triggered ();
- else if ("WSPR" == mode) on_actionWSPR_triggered ();
- else if ("Echo" == mode) on_actionEcho_triggered ();
-}
-
-void MainWindow::configActiveStations()
-{
- if (m_ActiveStationsWidget != NULL and (m_mode == "Q65" or m_mode == "FT4" or m_mode == "FT8")) {
- if (m_specOp == SpecOp::Q65_PILEUP) {
- m_ActiveStationsWidget->displayRecentStations("Q65-pileup", "");
- } else {
- if (m_specOp == SpecOp::FOX)
- if (m_config.superFox())
- m_ActiveStationsWidget->displayRecentStations("SuperFox Mode", "");
- else
- m_ActiveStationsWidget->displayRecentStations("Fox Mode", "");
- else
- m_ActiveStationsWidget->displayRecentStations(m_mode, "");
- }
- }
-}
-
-void MainWindow::remote_configure (QString const& mode, quint32 frequency_tolerance
- , QString const& submode, bool fast_mode, quint32 tr_period, quint32 rx_df
- , QString const& dx_call, QString const& dx_grid, bool generate_messages)
-{
- if (mode.size ())
- {
- if (mode != m_mode) set_mode (mode);
- }
- auto is_FST4W = "FST4W" == m_mode;
- if (frequency_tolerance != quint32_max && (ui->sbFtol->isVisible () || is_FST4W))
- {
- m_block_udp_status_updates = true;
- if (is_FST4W)
- {
- ui->sbFST4W_FTol->setValue (frequency_tolerance);
- }
- else
- {
- ui->sbFtol->setValue (frequency_tolerance);
- }
- m_block_udp_status_updates = false;
- }
- if (submode.size () && ui->sbSubmode->isVisible ())
- {
- ui->sbSubmode->setValue (submode.toUpper ().at (0).toLatin1 () - 'A');
- }
- if (ui->cbFast9->isVisible () && ui->cbFast9->isChecked () != fast_mode)
- {
- ui->cbFast9->click ();
- }
- if (tr_period != quint32_max && ui->sbTR->isVisible ())
- {
- if (is_FST4W)
- {
- ui->sbTR_FST4W->setValue (tr_period);
- ui->sbTR_FST4W->interpretText ();
- }
- else
- {
- ui->sbTR->setValue (tr_period);
- ui->sbTR->interpretText ();
- }
- }
- if (rx_df != quint32_max && ui->RxFreqSpinBox->isVisible ())
- {
- m_block_udp_status_updates = true;
- if (is_FST4W)
- {
- ui->sbFST4W_RxFreq->setValue (rx_df);
- ui->sbFST4W_RxFreq->interpretText ();
- }
- else
- {
- ui->RxFreqSpinBox->setValue (rx_df);
- ui->RxFreqSpinBox->interpretText ();
- }
- m_block_udp_status_updates = false;
- }
- if (dx_call.size () && ui->dxCallEntry->isVisible ())
- {
- ui->dxCallEntry->setText (dx_call);
- }
- if (dx_grid.size () && ui->dxGridEntry->isVisible ())
- {
- ui->dxGridEntry->setText (dx_grid);
- }
- if (generate_messages && ui->genStdMsgsPushButton->isVisible ())
- {
- ui->genStdMsgsPushButton->click ();
- }
- if (m_config.udpWindowToFront ())
- {
- show ();
- raise ();
- activateWindow ();
- }
- if (m_config.udpWindowRestore () && isMinimized ())
- {
- showNormal ();
- raise ();
- }
- tx_watchdog (false);
- QApplication::alert (this);
-}
-
-QString MainWindow::WSPR_message()
-{
- QString sdBm,msg0,msg1,msg2;
- sdBm = sdBm.asprintf(" %d",m_dBm);
- m_tx=1-m_tx;
- int i2=m_config.my_callsign().indexOf("/");
- if(i2>0
- || (6 == m_config.my_grid ().size ()
- && !ui->WSPR_prefer_type_1_check_box->isChecked ())) {
- if(i2<0) { // "Type 2" WSPR message
- msg1=m_config.my_callsign() + " " + m_config.my_grid().mid(0,4) + sdBm;
- } else {
- msg1=m_config.my_callsign() + sdBm;
- }
- msg0="<" + m_config.my_callsign() + "> " + m_config.my_grid();
- if(m_mode=="WSPR") msg0 += sdBm;
- if(m_tx==0) msg2=msg0;
- if(m_tx==1) msg2=msg1;
- } else {
- msg2=m_config.my_callsign() + " " + m_config.my_grid().mid(0,4) + sdBm; // Normal WSPR message
- }
- return msg2;
-}
-
-void MainWindow::on_houndButton_clicked (bool checked)
-{
- if (checked) {
- HoldTxFreqStatus = ui->cbHoldTxFreq->isChecked(); // save state of the Hold Tx Freq checkbox
- m_config.setSpecial_Hound();
- ui->tx1->setVisible(true);
- ui->tx1->setEnabled(true);
- ui->txb1->setEnabled(true);
- } else {
- m_config.setSpecial_None();
- keep_frequency = true;
- QTimer::singleShot (250, [=] {keep_frequency = false;});
- }
- m_specOp=m_config.special_op_id();
- on_actionFT8_triggered();
- check_button_color();
-}
-
-void MainWindow::on_cbHoldTxFreq_clicked (bool)
-{
- HoldTxFreqStatus = ui->cbHoldTxFreq->isChecked(); // save state of the Hold Tx Freq checkbox
-}
-
-void MainWindow::on_ft8Button_clicked()
-{
- if (m_specOp==SpecOp::HOUND or m_specOp==SpecOp::FOX) {
- m_config.setSpecial_None();
- m_specOp=m_config.special_op_id();
- }
- on_actionFT8_triggered();
-}
-
-void MainWindow::on_ft4Button_clicked()
-{
- on_actionFT4_triggered();
-}
-
-void MainWindow::on_msk144Button_clicked()
-{
- on_actionMSK144_triggered();
-}
-
-void MainWindow::on_q65Button_clicked()
-{
- if (m_specOp==SpecOp::Q65_PILEUP) {
- m_config.setSpecial_None();
- m_specOp=m_config.special_op_id();
- }
- on_actionQ65_triggered();
-}
-
-void MainWindow::on_jt65Button_clicked()
-{
- on_actionJT65_triggered();
-}
-
-void MainWindow::on_echoButton_clicked()
-{
- on_actionEcho_triggered();
-}
-
-void MainWindow::sfox_tx() {
- auto fname{QDir::toNativeSeparators(m_config.writeable_data_dir().absoluteFilePath("sfox_1.dat")).toLocal8Bit()};
- QString ckey{"OTP:000000"};
- LOG_INFO(QString("sfox_tx: OTP code is %1").arg(foxOTPcode()));
-#ifdef FOX_OTP
- qint32 otp_key = 0;
- if (m_config.OTPEnabled())
- {
- LOG_INFO(QString("TOTP: Generating OTP key with %1").arg(m_config.OTPSeed()));
- if (m_config.OTPSeed().length() == 16) {
- QString output=foxOTPcode();
- if (6 == output.length())
- {
- otp_key = QString(output).toInt();
- LOG_INFO(QString("TOTP SF: %1 [%2]").arg(output).arg(otp_key).toStdString());
- } else
- {
- otp_key = 0;
- LOG_INFO(QString("TOTP SF: Incorrect length"));
- }
- ckey=(QString("OTP:%1").arg(otp_key));
- } else
- {
- showStatusMessage (tr ("TOTP SF: seed not long enough."));
- LOG_INFO(QString("TOTP SF: seed not long enough"));
- }
- }
-#endif
- sftx_sub_(ckey.toLatin1().constData(), (FCL)ckey.size());
- sfox_wave_gfsk_();
-}
-
-void MainWindow::on_pb15A_clicked()
-{
- ui->sbTR->setValue(15);
- ui->sbSubmode->setValue(0);
-}
-
-void MainWindow::on_pb15C_clicked()
-{
- ui->sbTR->setValue(15);
- ui->sbSubmode->setValue(2);
- ui->TxFreqSpinBox->setValue(700);
-}
-
-void MainWindow::on_pb30B_clicked()
-{
- ui->sbTR->setValue(30);
- ui->sbSubmode->setValue(1);
-}
-
-void MainWindow::on_pb60C_clicked()
-{
- ui->sbTR->setValue(60);
- ui->sbSubmode->setValue(2);
-}
-
-void MainWindow::on_pb60D_clicked()
-{
- ui->sbTR->setValue(60);
- ui->sbSubmode->setValue(3);
-}
-
-void MainWindow::on_pb60E_clicked()
-{
- ui->sbTR->setValue(60);
- ui->sbSubmode->setValue(4);
- ui->TxFreqSpinBox->setValue(700);
-}
-
-void MainWindow::bandHoppingTimer()
-{
- if(ui->pbBandHopping->isChecked()) {
- static int startIndex = 0;
- int nextStartIndex = startIndex +1;
- switch (startIndex){
- case 0:
- startIndex = nextStartIndex; // band hopping every other minute
- return;
- case 1:
- m_displayBand = false;
- bandHopping();
- startIndex = 0;
- return;
- }
- }
-}
-
-void MainWindow::bandHopping()
-{
- if(ui->pbBandHopping->isChecked() && !ui->autoButton->isChecked() && !ui->tuneButton->isChecked()) {
- static int startIndex = 0;
- int nextStartIndex = startIndex +1;
- switch (startIndex){
- case 0:
- if (ui->cb160m->isChecked()) {
- on_actionFT8_triggered();
- auto const& row = m_config.frequencies ()->best_working_frequency (1840000);
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0) on_bandComboBox_activated (row);
- ui->pbBandHopping->setChecked(true);
- startIndex = nextStartIndex;
- return;
- } else {
- nextStartIndex++;
- }
- Q_FALLTHROUGH();
- case 1:
- if (ui->cb80m->isChecked()) {
- on_actionFT8_triggered();
- auto const& row = m_config.frequencies ()->best_working_frequency (3573000);
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0) on_bandComboBox_activated (row);
- ui->pbBandHopping->setChecked(true);
- startIndex = nextStartIndex;
- return;
- } else {
- nextStartIndex++;
- }
- Q_FALLTHROUGH();
- case 2:
- if (ui->cb60m->isChecked()) {
- on_actionFT8_triggered();
- auto const& row = m_config.frequencies ()->best_working_frequency (5357000);
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0) on_bandComboBox_activated (row);
- ui->pbBandHopping->setChecked(true);
- startIndex = nextStartIndex;
- return;
- } else {
- nextStartIndex++;
- }
- Q_FALLTHROUGH();
- case 3:
- if (ui->cb40m->isChecked()) {
- on_actionFT8_triggered();
- auto const& row = m_config.frequencies ()->best_working_frequency (7074000);
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0) on_bandComboBox_activated (row);
- ui->pbBandHopping->setChecked(true);
- startIndex = nextStartIndex;
- return;
- } else {
- nextStartIndex++;
- }
- Q_FALLTHROUGH();
- case 4:
- if (ui->cb30m->isChecked()) {
- on_actionFT8_triggered();
- auto const& row = m_config.frequencies ()->best_working_frequency (10136000);
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0) on_bandComboBox_activated (row);
- ui->pbBandHopping->setChecked(true);
- startIndex = nextStartIndex;
- return;
- } else {
- nextStartIndex++;
- }
- Q_FALLTHROUGH();
- case 5:
- if (ui->cb20m->isChecked()) {
- on_actionFT8_triggered();
- auto const& row = m_config.frequencies ()->best_working_frequency (14074000);
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0) on_bandComboBox_activated (row);
- ui->pbBandHopping->setChecked(true);
- startIndex = nextStartIndex;
- return;
- } else {
- nextStartIndex++;
- }
- Q_FALLTHROUGH();
- case 6:
- if (ui->cb17m->isChecked()) {
- on_actionFT8_triggered();
- auto const& row = m_config.frequencies ()->best_working_frequency (18100000);
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0) on_bandComboBox_activated (row);
- ui->pbBandHopping->setChecked(true);
- startIndex = nextStartIndex;
- return;
- } else {
- nextStartIndex++;
- }
- Q_FALLTHROUGH();
- case 7:
- if (ui->cb15m->isChecked()) {
- on_actionFT8_triggered();
- auto const& row = m_config.frequencies ()->best_working_frequency (21074000);
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0) on_bandComboBox_activated (row);
- ui->pbBandHopping->setChecked(true);
- startIndex = nextStartIndex;
- return;
- } else {
- nextStartIndex++;
- }
- Q_FALLTHROUGH();
- case 8:
- if (ui->cb12m->isChecked()) {
- on_actionFT8_triggered();
- auto const& row = m_config.frequencies ()->best_working_frequency (24915000);
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0) on_bandComboBox_activated (row);
- ui->pbBandHopping->setChecked(true);
- startIndex = nextStartIndex;
- return;
- } else {
- nextStartIndex++;
- }
- Q_FALLTHROUGH();
- case 9:
- if (ui->cb10m->isChecked()) {
- on_actionFT8_triggered();
- auto const& row = m_config.frequencies ()->best_working_frequency (28074000);
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0) on_bandComboBox_activated (row);
- ui->pbBandHopping->setChecked(true);
- startIndex = nextStartIndex;
- return;
- } else {
- nextStartIndex++;
- }
- Q_FALLTHROUGH();
- case 10:
- if (ui->cb6m->isChecked()) {
- on_actionFT8_triggered();
- auto const& row = m_config.frequencies ()->best_working_frequency (50313000);
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0) on_bandComboBox_activated (row);
- ui->pbBandHopping->setChecked(true);
- startIndex = nextStartIndex;
- return;
- } else {
- nextStartIndex++;
- }
- Q_FALLTHROUGH();
- case 11:
- if (ui->cb4m->isChecked()) {
- on_actionFT8_triggered();
- auto const& row = m_config.frequencies ()->best_working_frequency (70154000);
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0) on_bandComboBox_activated (row);
- ui->pbBandHopping->setChecked(true);
- startIndex = nextStartIndex;
- return;
- } else {
- nextStartIndex++;
- }
- Q_FALLTHROUGH();
- case 12:
- if (ui->cb2m->isChecked()) {
- on_actionFT8_triggered();
- auto const& row = m_config.frequencies ()->best_working_frequency (144174000);
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0) on_bandComboBox_activated (row);
- ui->pbBandHopping->setChecked(true);
- startIndex = nextStartIndex;
- return;
- } else {
- nextStartIndex++;
- }
- Q_FALLTHROUGH();
- case 13:
- if (ui->cb70cm->isChecked()) {
- on_actionFT8_triggered();
- auto const& row = m_config.frequencies ()->best_working_frequency (432174000);
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0) on_bandComboBox_activated (row);
- ui->pbBandHopping->setChecked(true);
- startIndex = nextStartIndex;
- return;
- } else {
- nextStartIndex++;
- }
- Q_FALLTHROUGH();
- case 14:
- if (ui->cb80mFT4->isChecked()) {
- on_actionFT4_triggered();
- auto const& row = m_config.frequencies ()->best_working_frequency (3575000);
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0) on_bandComboBox_activated (row);
- ui->pbBandHopping->setChecked(true);
- startIndex = nextStartIndex;
- return;
- } else {
- nextStartIndex++;
- }
- Q_FALLTHROUGH();
- case 15:
- if (ui->cb40mFT4->isChecked()) {
- on_actionFT4_triggered();
- auto const& row = m_config.frequencies ()->best_working_frequency (7047500);
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0) on_bandComboBox_activated (row);
- ui->pbBandHopping->setChecked(true);
- startIndex = nextStartIndex;
- return;
- } else {
- nextStartIndex++;
- }
- Q_FALLTHROUGH();
- case 16:
- if (ui->cb30mFT4->isChecked()) {
- on_actionFT4_triggered();
- auto const& row = m_config.frequencies ()->best_working_frequency (10140000);
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0) on_bandComboBox_activated (row);
- ui->pbBandHopping->setChecked(true);
- startIndex = nextStartIndex;
- return;
- } else {
- nextStartIndex++;
- }
- Q_FALLTHROUGH();
- case 17:
- if (ui->cb20mFT4->isChecked()) {
- on_actionFT4_triggered();
- auto const& row = m_config.frequencies ()->best_working_frequency (14080000);
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0) on_bandComboBox_activated (row);
- ui->pbBandHopping->setChecked(true);
- startIndex = nextStartIndex;
- return;
- } else {
- nextStartIndex++;
- }
- Q_FALLTHROUGH();
- case 18:
- if (ui->cb17mFT4->isChecked()) {
- on_actionFT4_triggered();
- auto const& row = m_config.frequencies ()->best_working_frequency (18104000);
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0) on_bandComboBox_activated (row);
- ui->pbBandHopping->setChecked(true);
- startIndex = nextStartIndex;
- return;
- } else {
- nextStartIndex++;
- }
- Q_FALLTHROUGH();
-
- case 19:
- if (ui->cb15mFT4->isChecked()) {
- on_actionFT4_triggered();
- auto const& row = m_config.frequencies ()->best_working_frequency (21140000);
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0) on_bandComboBox_activated (row);
- ui->pbBandHopping->setChecked(true);
- startIndex = nextStartIndex;
- return;
- } else {
- nextStartIndex++;
- }
- Q_FALLTHROUGH();
- case 20:
- if (ui->cb12mFT4->isChecked()) {
- on_actionFT4_triggered();
- auto const& row = m_config.frequencies ()->best_working_frequency (24919000);
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0) on_bandComboBox_activated (row);
- ui->pbBandHopping->setChecked(true);
- startIndex = nextStartIndex;
- return;
- } else {
- nextStartIndex++;
- }
- Q_FALLTHROUGH();
- case 21:
- if (ui->cb10mFT4->isChecked()) {
- on_actionFT4_triggered();
- auto const& row = m_config.frequencies ()->best_working_frequency (28180000);
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0) on_bandComboBox_activated (row);
- ui->pbBandHopping->setChecked(true);
- startIndex = nextStartIndex;
- return;
- } else {
- nextStartIndex++;
- }
- Q_FALLTHROUGH();
- case 22:
- if (ui->cb2mMSK->isChecked()) {
- on_actionMSK144_triggered();
- auto const& row = m_config.frequencies ()->best_working_frequency (144360000);
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0) on_bandComboBox_activated (row);
- ui->pbBandHopping->setChecked(true);
- startIndex = nextStartIndex;
- return;
- } else {
- nextStartIndex++;
- }
- Q_FALLTHROUGH();
- case 23:
- if (ui->cbQRG1->isChecked()) {
- int f1 = ui->sbQRG1->value()*1000;
- keep_frequency = true;
- QTimer::singleShot (250, [=] {keep_frequency = false;});
- setRig (f1);
- on_actionFT8_triggered();
- ui->pbBandHopping->setChecked(true);
- startIndex = nextStartIndex;
- return;
- } else {
- nextStartIndex++;
- }
- Q_FALLTHROUGH();
- case 24:
- if (ui->cbQRG2->isChecked()) {
- int f2 = ui->sbQRG2->value()*1000;
- keep_frequency = true;
- QTimer::singleShot (250, [=] {keep_frequency = false;});
- setRig (f2);
- on_actionFT8_triggered();
- ui->pbBandHopping->setChecked(true);
- startIndex = nextStartIndex;
- return;
- } else {
- nextStartIndex++;
- }
- Q_FALLTHROUGH();
- case 25:
- if (ui->cbQRG3->isChecked()) {
- int f3 = ui->sbQRG3->value()*1000;
- keep_frequency = true;
- QTimer::singleShot (250, [=] {keep_frequency = false;});
- setRig (f3);
- on_actionFT8_triggered();
- ui->pbBandHopping->setChecked(true);
- startIndex = nextStartIndex;
- return;
- } else {
- nextStartIndex++;
- }
- Q_FALLTHROUGH();
- case 26:
- if (ui->cbQRG4->isChecked()) {
- int f4 = ui->sbQRG4->value()*1000;
- keep_frequency = true;
- QTimer::singleShot (250, [=] {keep_frequency = false;});
- setRig (f4);
- on_actionFT8_triggered();
- ui->pbBandHopping->setChecked(true);
- startIndex = nextStartIndex;
- return;
- } else {
- nextStartIndex++;
- }
- Q_FALLTHROUGH();
- case 27:
- if (ui->cbQRG5->isChecked()) {
- int f5 = ui->sbQRG5->value()*1000;
- keep_frequency = true;
- QTimer::singleShot (250, [=] {keep_frequency = false;});
- setRig (f5);
- on_actionFT8_triggered();
- ui->pbBandHopping->setChecked(true);
- startIndex = nextStartIndex;
- return;
- } else {
- nextStartIndex++;
- }
- Q_FALLTHROUGH();
- case 28:
- if (ui->cbQRG6->isChecked()) {
- int f6 = ui->sbQRG6->value()*1000;
- keep_frequency = true;
- QTimer::singleShot (250, [=] {keep_frequency = false;});
- setRig (f6);
- on_actionFT8_triggered();
- ui->pbBandHopping->setChecked(true);
- startIndex = nextStartIndex;
- return;
- } else {
- nextStartIndex++;
- }
- Q_FALLTHROUGH();
- case 29:
- if (ui->cbQRG7->isChecked()) {
- int f7 = ui->sbQRG7->value()*1000;
- keep_frequency = true;
- QTimer::singleShot (250, [=] {keep_frequency = false;});
- setRig (f7);
- on_actionFT8_triggered();
- ui->pbBandHopping->setChecked(true);
- startIndex = nextStartIndex;
- return;
- } else {
- nextStartIndex++;
- }
- Q_FALLTHROUGH();
- case 30:
- if (ui->cbQRG8->isChecked()) {
- int f8 = ui->sbQRG8->value()*1000;
- keep_frequency = true;
- QTimer::singleShot (250, [=] {keep_frequency = false;});
- setRig (f8);
- on_actionFT8_triggered();
- ui->pbBandHopping->setChecked(true);
- startIndex = 0;
- return;
- bandHopping();
- } else {
- startIndex = 0;
- bandHopping();
- }
- }
- }
-}
-
-void MainWindow::on_actionDefault_event_logging_triggered()
-{
-#if defined(Q_OS_WIN)
- QFile::remove (QDir {QStandardPaths::writableLocation (QStandardPaths::DataLocation)}.absoluteFilePath ("wsjtx_log_config.ini"));
-#else
- QFile::remove (QDir {QStandardPaths::writableLocation (QStandardPaths::ConfigLocation)}.absoluteFilePath ("wsjtx_log_config.ini"));
-#endif
-}
-
-void MainWindow::on_actionDiagnostic_mode_triggered()
-{
-#if defined(Q_OS_WIN)
- static QFile f {QDir {QStandardPaths::writableLocation (QStandardPaths::DataLocation)}.absoluteFilePath ("wsjtx_log_config.ini")};
-#else
- static QFile f {QDir {QStandardPaths::writableLocation (QStandardPaths::ConfigLocation)}.absoluteFilePath ("wsjtx_log_config.ini")};
-#endif
- if(!f.open(QIODevice::WriteOnly | QIODevice::Text)) {
- QMessageBox mb;
- mb.setText("Cannot write wsjtx_log_config.ini file");
- mb.exec();
- return;
- }
- QString instance = "";
- QString path = QStandardPaths::writableLocation (QStandardPaths::DataLocation);
- QStringList tw;
- if (path.contains("/WSJT-X")) tw=path.split("/WSJT-X");
- if (tw.size () > 0 && tw[1].remove(" - ") != "") instance = tw[1].remove(" - ") + "/";
- QString EventConfig = (
- "\[Sinks.SYSLOG]\n"
- "Destination=TextFile\n"
- "Asynchronous=true\n"
- "AutoFlush=true\n"
- "FileName=\"${DesktopLocation}/logs/" + instance + "wsjtx_syslog.log\"\n"
- "Append=true\n"
- "Format=\"[%Channel%][%TimeStamp(format=\\\"%Y-%m-%d %H:%M:%S.%f\\\")%][%Uptime(format=\\\"%O:%M:%S.%f\\\")%][%Severity%] %Message%\"\n"
- "Filter=\"%Channel% matches \\\"SYSLOG\\\" | %Severity% >= info\"\n"
- "\n"
- "\[Sinks.RIGCTRL]\n"
- "Destination=TextFile\n"
- "Asynchronous=true\n"
- "AutoFlush=true\n"
- "FileName=\"${DesktopLocation}/logs/" + instance + "WSJT-X_RigControl.log\"\n"
- "Append=true\n"
- "Format=\"[%TimeStamp(format=\\\"%Y-%m-%d %H:%M:%S.%f\\\")%][%Uptime(format=\\\"%O:%M:%S.%f\\\")%][%Channel%:%Severity%] %Message%\"\n"
- "Filter=\"%Channel% matches \\\"RIGCTRL\\\" | %Severity% >= info\""
- );
- QTextStream out(&f);
- out << EventConfig;
- f.close();
- MessageBox::critical_message (this,
- " DIAGNOSTIC MODE\n"
- "\n"
- "You have switched to diagnostic mode. It allows you to collect data to\n"
- "troubleshoot problems with WSJT-X, or its communication with your rig.\n"
- "\n"
- "The diagnostic mode is active after closing and restarting WSJT-X,\n"
- "and is then automatically deactivated when the program is next closed.\n"
- "In the diagnostic mode a new \"logs\" folder appears on your screen, and\n"
- "in it two files are created: \"wsjtx_syslog.log\" and \"WSJT-X_RigControl.log\".\n"
- "Open these files with a text editor and look for error messages,\n"
- "or send these files to the development team for further analysis.\n"
- "\n"
- "In dagnostic mode, you should close the program as soon as the fault\n"
- "has appeared, because the two log files grow to large sizes quickly.\n"
- "\n"
- "If you have accidentally switched to diagnostic mode, simply click\n"
- "\"Default event logging\" again.");
-}
-
-void MainWindow::on_actionDisable_event_logging_triggered()
-{
-#if defined(Q_OS_WIN)
- static QFile f {QDir {QStandardPaths::writableLocation (QStandardPaths::DataLocation)}.absoluteFilePath ("wsjtx_log_config.ini")};
-#else
- static QFile f {QDir {QStandardPaths::writableLocation (QStandardPaths::ConfigLocation)}.absoluteFilePath ("wsjtx_log_config.ini")};
-#endif
- if(!f.open(QIODevice::WriteOnly | QIODevice::Text)) {
- QMessageBox mb;
- mb.setText("Cannot write wsjtx_log_config.ini file");
- mb.exec();
- return;
- }
- QString EventConfig = (
- "\[Core]\n"
- "DisableLogging=\"true\""
- );
- QTextStream out(&f);
- out << EventConfig;
- f.close();
- QFile::remove (QDir {QStandardPaths::writableLocation (QStandardPaths::DataLocation)}.absoluteFilePath ("wsjtx_syslog.log"));
-}
-
-void MainWindow::on_actionUse_Dark_Style_triggered (bool checked)
-{
- QFont font = m_config.text_font();
- if (checked) {
- QFile f(":qdarkstyle/style.qss");
- if (!f.exists()) {
- printf("Unable to set stylesheet, file not found\n");
- } else {
- qApp->setFont (font);
- QString ss;
- f.open(QFile::ReadOnly | QFile::Text);
- QTextStream ts(&f);
- qApp->setStyleSheet(ts.readAll() + "* {" + font_as_stylesheet (font) + '}');
- m_useDarkStyle = true;
- m_wideGraph->setDarkStyle(m_useDarkStyle);
- check_button_color();
- ui->tabWidget->setTabShape(QTabWidget::Rounded);
- }
- } else {
- m_useDarkStyle = false;
- m_wideGraph->setDarkStyle(m_useDarkStyle);
- check_button_color();
- ui->tabWidget->setTabShape(QTabWidget::Triangular);
- qApp->setFont (font);
- QString ss;
- if (qApp->styleSheet ().size ()) {
- auto sheet = qApp->styleSheet ();
- sheet.remove ("file:///");
- QFile sf {sheet};
- if (sf.open (QFile::ReadOnly | QFile::Text)) ss = sf.readAll () + ss;
- }
- qApp->setStyleSheet (ss + "* {" + font_as_stylesheet (font) + '}');
- }
- // ensure a balanced layout
- qreal pointSize = m_config.text_font().pointSizeF();
-// if (pointSize < 9) ui->controls_stack_widget->setMaximumWidth(180); // UR for AL
-// if (pointSize == 9) ui->controls_stack_widget->setMaximumWidth(200); // UR for AL
-// if (pointSize == 10) ui->controls_stack_widget->setMaximumWidth(220); // UR for AL
-// if (pointSize > 10) ui->controls_stack_widget->setMaximumWidth(240); // UR for AL
- if (pointSize < 11) {
-// ui->tabWidget->setMaximumHeight(210); // UR for AL
-// ui->controls_stack_widget->setMaximumHeight(200); // UR for AL
- if (ui->actionUse_Dark_Style->isChecked()) ui->tabWidget->setMaximumHeight(225); // UR for normal + widescreen
- } else {
-// ui->tabWidget->setMaximumHeight(255); // UR for AL
-// ui->controls_stack_widget->setMaximumHeight(225); // UR for AL
- ui->tabWidget->setMaximumHeight(500); // UR for normal + widescreen
- }
- for (auto& widget : qApp->topLevelWidgets ())
- {
- widget->updateGeometry ();
- }
- statusChanged();
- guiUpdate();
-}
-
-void MainWindow:: on_actionBand_Buttons_triggered ()
-{
- if (ui->actionBand_Buttons->isChecked()) {
- ui->actionVHF_UHF_Buttons->setVisible(true);
- } else {
- ui->actionVHF_UHF_Buttons->setVisible(false);
- }
-}
-
-void MainWindow:: on_actionVHF_UHF_Buttons_triggered ()
-{
- check_button_color();
-}
-
-void MainWindow::check_button_color()
-{
- // Yellow background for the DX Call and Enable Tx buttons when the rig is allowed to Tx automatically
- if((((m_mode=="FT8" or m_mode=="FT4" or m_mode=="Q65" or m_mode=="FST4" or m_mode=="MSK144" or m_mode=="JT65" or m_mode=="JT9" or m_mode=="JT4") &&
- m_specOp==SpecOp::NONE && ui->cbAutoSeq->isChecked() && ui->cbAutoSeq->isChecked()
- && m_config.Wait_features_enabled()) or m_specOp==SpecOp::HOUND) && (m_hisCall!="" or (m_mode=="FT8" && m_specOp==SpecOp::HOUND))) {
- if (ui->DX_Call_Button->isChecked()) {
- ui->DX_Call_Button->setStyleSheet("QPushButton {background-color: #ff0000; color: #ffffff; border-style: outset; border-width: 1px; border-radius: 5px; border-color: black; min-width: 5em; padding: 3px;}");
- } else {
- if (m_mode=="FT8" && m_specOp==SpecOp::HOUND && m_hisCall=="") {
- if (m_useDarkStyle) {
- ui->DX_Call_Button->setStyleSheet("QPushButton {background-color: #505F69; color: #ffffff; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}");
- } else {
- ui->DX_Call_Button->setStyleSheet("QPushButton {background-color: #9fafd5; border: none;}");
- }
- } else {
- ui->DX_Call_Button->setStyleSheet("QPushButton {background-color: #ffff00; color: #000000; border: 1px solid #32414B; border-radius: 4px; padding: 3px; outline: none;}");
- }
- }
- if (!m_auto) {
- if (m_mode=="FT8" && m_specOp==SpecOp::HOUND && m_hisCall=="") {
- if (m_useDarkStyle) {
- ui->autoButton->setStyleSheet("QPushButton {background-color: #505F69; color: #ffffff; border: 1px solid #32414B; color: #F0F0F0; border-radius: 5px; padding: 3px; outline: none; min-width: 5em;}");
- } else {
- ui->autoButton->setStyleSheet("");
- ui->autoButton->setStyleSheet("QPushButton {min-width: 5em;}");
- }
- } else {
- ui->autoButton->setStyleSheet("QPushButton {background-color: #ffff00; color: #000000; border: 1px solid #32414B; border-radius: 4px; padding: 3px; outline: none; min-width: 5em;}");
- }
- }
- if (m_auto) ui->autoButton->setStyleSheet("QPushButton {background-color: #ff0000; color: #ffffff; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none; min-width: 5em;}");
- } else {
- ui->DX_Call_Button->setChecked(false);
- if (m_useDarkStyle) {
- ui->DX_Call_Button->setStyleSheet("QPushButton {background-color: #505F69; color: #ffffff; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}");
- if (!m_auto) ui->autoButton->setStyleSheet("QPushButton {background-color: #505F69; color: #ffffff; border: 1px solid #32414B; color: #F0F0F0; border-radius: 5px; padding: 3px; outline: none; min-width: 5em;}");
- if (m_auto) ui->autoButton->setStyleSheet("QPushButton {background-color: #ff0000; color: #ffffff; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none; min-width: 5em;}");
- } else {
- ui->DX_Call_Button->setStyleSheet("QPushButton {background-color: #9fafd5; border: none;}");
- if (!m_auto) {
- ui->autoButton->setStyleSheet("");
- ui->autoButton->setStyleSheet("QPushButton {min-width: 5em;}");
- }
- if (m_auto) ui->autoButton->setStyleSheet("QPushButton {background-color: #ff0000; color: #ffffff; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none; min-width: 5em;}");
- }
- }
-
- ui->autoButton->setToolTip("Toggle Auto-Tx On/Off");
- if (m_config.Wait_features_enabled()) {
- ui->DX_Call_Button->setToolTip("Toggle Wait & Call On/Off.\n"
- "Right-click to clear the DX Call box.");
- ui->autoButton->setToolTip("Toggle Auto-Tx On/Off.\n"
- "Right-click to toggle Wait & Pounce On/Off.");
- } else {
- ui->DX_Call_Button->setToolTip("Right-click to clear the DX Call box");
- ui->autoButton->setToolTip("Toggle Auto-Tx On/Off");
- }
- if (m_config.alternate_erase_button()) {
- ui->EraseButton->setToolTip("Left-click to erase left window.\n"
- "Right-click to erase right window.");
- } else {
- ui->EraseButton->setToolTip("Erase right window.\n"
- "Double-click to erase both windows.");
- }
- if (pounce && !m_auto) {
- ui->autoButton->setStyleSheet("QPushButton {background-color: #ff7a05; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none; min-width: 5em;}");
- ui->autoButton->setChecked(false); // ensure auoButton is unchecked
- }
- if (m_config.Territory1()=="") {
- ui->actionHideTerritory1->setText("Hide stations from Territory 1");
- ui->actionHighlightTerritory1->setText("Highlight stations from Territory 1");
- } else {
- ui->actionHideTerritory1->setText("Hide stations from " + m_config.Territory1());
- ui->actionHighlightTerritory1->setText("Highlight stations from " + m_config.Territory1());
- }
- if (m_config.Territory2()=="") {
- ui->actionHideTerritory2->setText("Hide stations from Territory 2");
- ui->actionHighlightTerritory2->setText("Highlight stations from Territory 2");
- } else {
- ui->actionHideTerritory2->setText("Hide stations from " + m_config.Territory2());
- ui->actionHighlightTerritory2->setText("Highlight stations from " + m_config.Territory2());
- }
- if (m_config.Territory3()=="") {
- ui->actionHideTerritory3->setText("Hide stations from Territory 3");
- ui->actionHighlightTerritory3->setText("Highlight stations from Territory 3");
- } else {
- ui->actionHideTerritory3->setText("Hide stations from " + m_config.Territory3());
- ui->actionHighlightTerritory3->setText("Highlight stations from " + m_config.Territory3());
- }
- if (m_config.Territory4()=="") {
- ui->actionHideTerritory4->setText("Hide stations from Territory 4");
- ui->actionHighlightTerritory4->setText("Highlight stations from Territory 4");
- } else {
- ui->actionHideTerritory4->setText("Hide stations from " + m_config.Territory4());
- ui->actionHighlightTerritory4->setText("Highlight stations from " + m_config.Territory4());
- }
-
- if (m_config.twoDays()) {
- ui->actionHideToday->setText("Hide stations worked today or yesterday");
- ui->actionIgnoreToday->setText("Ignore stations worked today or yesterday");
- ui->actionHighlightToday->setText("Highlight callsigns worked today or yesterday");
- } else {
- ui->actionHideToday->setText("Hide stations worked today");
- ui->actionIgnoreToday->setText("Ignore stations worked today");
- ui->actionHighlightToday->setText("Highlight callsigns worked today");
- }
-
- if (!m_config.button_coloring_disabled()) {
- if (m_mode=="Q65" && m_config.enable_VHF_features() && m_TRperiod==15 && m_nSubMode==0) {
- ui->pb15A->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}");
- } else {
- if (m_useDarkStyle) {
- ui->pb15A->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}");
- } else {
- ui->pb15A->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}");
- }
- }
- if (m_mode=="Q65" && m_config.enable_VHF_features() && m_TRperiod==15 && m_nSubMode==2) {
- ui->pb15C->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}");
- } else {
- if (m_useDarkStyle) {
- ui->pb15C->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}");
- } else {
- ui->pb15C->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}");
- }
- }
- if (m_mode=="Q65" && m_config.enable_VHF_features() && m_TRperiod==30 && m_nSubMode==1) {
- ui->pb30B->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}");
- } else {
- if (m_useDarkStyle) {
- ui->pb30B->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}");
- } else {
- ui->pb30B->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}");
- }
- }
- if (m_mode=="Q65" && m_config.enable_VHF_features() && m_TRperiod==60 && m_nSubMode==2) {
- ui->pb60C->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}");
- } else {
- if (m_useDarkStyle) {
- ui->pb60C->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}");
- } else {
- ui->pb60C->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}");
- }
- }
- if (m_mode=="Q65" && m_config.enable_VHF_features() && m_TRperiod==60 && m_nSubMode==3) {
- ui->pb60D->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}");
- } else {
- if (m_useDarkStyle) {
- ui->pb60D->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}");
- } else {
- ui->pb60D->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}");
- }
- }
- if (m_mode=="Q65" && m_config.enable_VHF_features() && m_TRperiod==60 && m_nSubMode==4) {
- ui->pb60E->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}");
- } else {
- if (m_useDarkStyle) {
- ui->pb60E->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}");
- } else {
- ui->pb60E->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}");
- }
- }
- if (ui->houndButton->isChecked() && !m_config.button_coloring_disabled()) {
- ui->houndButton->setStyleSheet("QPushButton {background-color: #ff0000; color: #ffffff; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none; min-width: 3em;}");
- } else {
- if (SpecOp::FOX==m_specOp && !m_config.button_coloring_disabled()) {
- ui->houndButton->setStyleSheet("QPushButton {background-color: #ffff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none; min-width: 3em;}");
- } else {
- if (m_useDarkStyle) {
- ui->houndButton->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none; min-width: 3em;}");
- } else {
- ui->houndButton->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none; min-width: 3em;}");
- }
- }
- }
- if (m_mode=="FT8") {
- ui->ft8Button->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none; min-width: 3em;}");
- } else {
- if (m_useDarkStyle) {
- ui->ft8Button->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none; min-width: 3em;}");
- } else {
- ui->ft8Button->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none; min-width: 3em;}");
- }
- }
- if (m_mode=="FT4") {
- ui->ft4Button->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none; min-width: 3em;}");
- } else {
- if (m_useDarkStyle) {
- ui->ft4Button->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none; min-width: 3em;}");
- } else {
- ui->ft4Button->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none; min-width: 3em;}");
- }
- }
- if (m_mode=="MSK144") {
- ui->msk144Button->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none; min-width: 3em;}");
- } else {
- if (m_useDarkStyle) {
- ui->msk144Button->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none; min-width: 3em;}");
- } else {
- ui->msk144Button->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none; min-width: 3em;}");
- }
- }
- if (m_mode=="Q65") {
- ui->q65Button->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none; min-width: 3em;}");
- } else {
- if (m_useDarkStyle) {
- ui->q65Button->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none; min-width: 3em;}");
- } else {
- ui->q65Button->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none; min-width: 3em;}");
- }
- }
- if (m_mode=="JT65") {
- ui->jt65Button->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none; min-width: 3em;}");
- } else {
- if (m_useDarkStyle) {
- ui->jt65Button->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none; min-width: 3em;}");
- } else {
- ui->jt65Button->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none; min-width: 3em;}");
- }
- }
- if (m_mode=="Echo" && ui->echoButton->isVisible()) {
- ui->echoButton->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none; min-width: 3em;}");
- } else {
- if (m_useDarkStyle) {
- ui->echoButton->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none; min-width: 3em;}");
- } else {
- ui->echoButton->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none; min-width: 3em;}");
- }
- }
- }
- if (m_config.enable_VHF_features() && m_config.decode_at_52s()) {
- ui->echoButton->setVisible (true);
- } else {
- ui->echoButton->setVisible (false);
- }
- if (m_mode=="JT65" && m_config.enable_VHF_features() && ui->cbShMsgs->isChecked()) {
- ui->tx3->setStyleSheet("color: #000000; background-color: #66ffff");
- ui->tx4->setStyleSheet("color: #000000; background-color: #66ffff");
- if (!keepTx5) ui->tx5->setStyleSheet("color: #000000; background-color: #66ffff");
- } else {
- ui->tx3->setStyleSheet("");
- ui->tx4->setStyleSheet("");
- if (!keepTx5) ui->tx5->setStyleSheet("");
- }
- if (ui->actionBand_Buttons->isChecked()) {
- QString band=m_config.bands()->find(m_freqNominal);
- if (ui->actionVHF_UHF_Buttons->isChecked()) {
- ui->pb160->setVisible(false);
- ui->pb80->setVisible(false);
- ui->pb60->setVisible(false);
- ui->pb40->setVisible(false);
- ui->pb30->setVisible(false);
- ui->pb20->setVisible(false);
- ui->pb17->setVisible(false);
- ui->pb15->setVisible(false);
- ui->pb12->setVisible(false);
- ui->pb10->setVisible(false);
- ui->pb8->setVisible(true);
- ui->pb6->setVisible(false);
- ui->pb2->setVisible(false);
- ui->pb70->setVisible(false);
- ui->pb50->setVisible(true);
- ui->pb4->setVisible(true);
- ui->pb144->setVisible(true);
- ui->pb220->setVisible(true);
- ui->pb432->setVisible(true);
- ui->pb902->setVisible(true);
- ui->pb23->setVisible(true);
- ui->pb13->setVisible(true);
- ui->pb9->setVisible(true);
- ui->pb5G->setVisible(true);
- ui->pb10G->setVisible(true);
- ui->pb24G->setVisible(true);
- if (band=="8m") {
- ui->pb8->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}");
- } else {
- if (m_useDarkStyle) {
- ui->pb8->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}");
- } else {
- ui->pb8->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}");
- }
- }
- if (band=="6m") {
- ui->pb50->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}");
- } else {
- if (m_useDarkStyle) {
- ui->pb50->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}");
- } else {
- ui->pb50->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}");
- }
- }
- if (band=="4m") {
- ui->pb4->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}");
- } else {
- if (m_useDarkStyle) {
- ui->pb4->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}");
- } else {
- ui->pb4->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}");
- }
- }
- if (band=="2m") {
- ui->pb144->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}");
- } else {
- if (m_useDarkStyle) {
- ui->pb144->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}");
- } else {
- ui->pb144->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}");
- }
- }
- if (band=="1.25m") {
- ui->pb220->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}");
- } else {
- if (m_useDarkStyle) {
- ui->pb220->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}");
- } else {
- ui->pb220->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}");
- }
- }
- if (band=="70cm") {
- ui->pb432->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}");
- } else {
- if (m_useDarkStyle) {
- ui->pb432->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}");
- } else {
- ui->pb432->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}");
- }
- }
- if (band=="33cm") {
- ui->pb902->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}");
- } else {
- if (m_useDarkStyle) {
- ui->pb902->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}");
- } else {
- ui->pb902->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}");
- }
- }
- if (band=="23cm") {
- ui->pb23->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}");
- } else {
- if (m_useDarkStyle) {
- ui->pb23->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}");
- } else {
- ui->pb23->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}");
- }
- }
- if (band=="13cm") {
- ui->pb13->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}");
- } else {
- if (m_useDarkStyle) {
- ui->pb13->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}");
- } else {
- ui->pb13->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}");
- }
- }
- if (band=="9cm") {
- ui->pb9->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}");
- } else {
- if (m_useDarkStyle) {
- ui->pb9->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}");
- } else {
- ui->pb9->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}");
- }
- }
- if (band=="6cm") {
- ui->pb5G->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}");
- } else {
- if (m_useDarkStyle) {
- ui->pb5G->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}");
- } else {
- ui->pb5G->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}");
- }
- }
- if (band=="3cm") {
- ui->pb10G->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}");
- } else {
- if (m_useDarkStyle) {
- ui->pb10G->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}");
- } else {
- ui->pb10G->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}");
- }
- }
- if (band=="1.25cm") {
- ui->pb24G->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}");
- } else {
- if (m_useDarkStyle) {
- ui->pb24G->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}");
- } else {
- ui->pb24G->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}");
- }
- }
- } else {
- ui->pb160->setVisible(true);
- ui->pb80->setVisible(true);
- ui->pb60->setVisible(true);
- ui->pb40->setVisible(true);
- ui->pb30->setVisible(true);
- ui->pb20->setVisible(true);
- ui->pb17->setVisible(true);
- ui->pb15->setVisible(true);
- ui->pb12->setVisible(true);
- ui->pb10->setVisible(true);
- ui->pb8->setVisible(false);
- ui->pb6->setVisible(true);
- ui->pb2->setVisible(true);
- ui->pb70->setVisible(true);
- ui->pb50->setVisible(false);
- ui->pb4->setVisible(false);
- ui->pb144->setVisible(false);
- ui->pb220->setVisible(false);
- ui->pb432->setVisible(false);
- ui->pb902->setVisible(false);
- ui->pb23->setVisible(false);
- ui->pb13->setVisible(false);
- ui->pb9->setVisible(false);
- ui->pb5G->setVisible(false);
- ui->pb10G->setVisible(false);
- ui->pb24G->setVisible(false);
- if (band=="160m") {
- ui->pb160->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}");
- } else {
- if (m_useDarkStyle) {
- ui->pb160->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}");
- } else {
- ui->pb160->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}");
- }
- }
- if (band=="80m") {
- ui->pb80->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}");
- } else {
- if (m_useDarkStyle) {
- ui->pb80->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}");
- } else {
- ui->pb80->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}");
- }
- }
- if (band=="60m") {
- ui->pb60->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}");
- } else {
- if (m_useDarkStyle) {
- ui->pb60->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}");
- } else {
- ui->pb60->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}");
- }
- }
- if (band=="40m") {
- ui->pb40->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}");
- } else {
- if (m_useDarkStyle) {
- ui->pb40->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}");
- } else {
- ui->pb40->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}");
- }
- }
- if (band=="30m") {
- ui->pb30->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}");
- } else {
- if (m_useDarkStyle) {
- ui->pb30->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}");
- } else {
- ui->pb30->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}");
- }
- }
- if (band=="20m") {
- ui->pb20->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}");
- } else {
- if (m_useDarkStyle) {
- ui->pb20->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}");
- } else {
- ui->pb20->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}");
- }
- }
- if (band=="17m") {
- ui->pb17->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}");
- } else {
- if (m_useDarkStyle) {
- ui->pb17->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}");
- } else {
- ui->pb17->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}");
- }
- }
- if (band=="15m") {
- ui->pb15->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}");
- } else {
- if (m_useDarkStyle) {
- ui->pb15->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}");
- } else {
- ui->pb15->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}");
- }
- }
- if (band=="12m") {
- ui->pb12->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}");
- } else {
- if (m_useDarkStyle) {
- ui->pb12->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}");
- } else {
- ui->pb12->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}");
- }
- }
- if (band=="10m") {
- ui->pb10->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}");
- } else {
- if (m_useDarkStyle) {
- ui->pb10->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}");
- } else {
- ui->pb10->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}");
- }
- }
- if (band=="6m") {
- ui->pb6->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}");
- } else {
- if (m_useDarkStyle) {
- ui->pb6->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}");
- } else {
- ui->pb6->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}");
- }
- }
- if (band=="4m" or band=="1.25m" ) {
- ui->pb2->setStyleSheet("QPushButton {background-color: #ffff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}");
- } else {
- if (band=="2m") {
- ui->pb2->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}");
- } else {
- if (m_useDarkStyle) {
- ui->pb2->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}");
- } else {
- ui->pb2->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}");
- }
- }
- }
- if (band=="23cm") {
- ui->pb70->setStyleSheet("QPushButton {background-color: #ffff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}");
- } else {
- if (band=="70cm") {
- ui->pb70->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}");
- } else {
- if (m_useDarkStyle) {
- ui->pb70->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}");
- } else {
- ui->pb70->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}");
- }
- }
- }
- }
- } else {
- ui->pb160->setVisible(false);
- ui->pb80->setVisible(false);
- ui->pb60->setVisible(false);
- ui->pb40->setVisible(false);
- ui->pb30->setVisible(false);
- ui->pb20->setVisible(false);
- ui->pb17->setVisible(false);
- ui->pb15->setVisible(false);
- ui->pb12->setVisible(false);
- ui->pb10->setVisible(false);
- ui->pb8->setVisible(false);
- ui->pb6->setVisible(false);
- ui->pb2->setVisible(false);
- ui->pb70->setVisible(false);
- ui->pb50->setVisible(false);
- ui->pb4->setVisible(false);
- ui->pb144->setVisible(false);
- ui->pb220->setVisible(false);
- ui->pb432->setVisible(false);
- ui->pb902->setVisible(false);
- ui->pb23->setVisible(false);
- ui->pb13->setVisible(false);
- ui->pb9->setVisible(false);
- ui->pb5G->setVisible(false);
- ui->pb10G->setVisible(false);
- ui->pb24G->setVisible(false);
- }
- if (ui->monitorButton->isChecked()) {
- if (m_saveAll or m_saveDecoded) {
- ui->monitorButton->setStyleSheet("QPushButton {background-color: #ffff00; color: #000000; border-style: outset; border-width: 1px; border-radius: 5px; border-color: black; min-width: 5em; padding: 3px;}");
- } else {
- ui->monitorButton->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border-style: outset; border-width: 1px; border-radius: 5px; border-color: black; min-width: 5em; padding: 3px;}");
- }
- } else {
- ui->monitorButton->setStyleSheet("");
- }
- if (ui->pbBandHopping->isChecked()) {
- keep_last_tx_label = false;
- ui->pbBandHopping->setStyleSheet("QPushButton {background-color: #ff0000; color: #ffffff; border-style: outset; border-width: 1px; border-radius: 5px; border-color: black; min-width: 5em; padding: 3px;}");
- last_tx_label.setText(" Band Hopping On ");
- last_tx_label.setStyleSheet ("QLabel{color: #ffffff; background-color: #ff0000}");
- ui->genStdMsgsPushButton->setStyleSheet("QPushButton {background-color: #ffff00; color: #000000; border-style: outset; border-width: 1px; border-radius: 5px; border-color: black; min-width: 5em; padding: 3px;}");
- } else {
- ui->pbBandHopping->setStyleSheet ("");
- if (!keep_last_tx_label) last_tx_label.setText ("");
- last_tx_label.setStyleSheet ("");
- ui->genStdMsgsPushButton->setStyleSheet ("");
- }
-}
-
-void MainWindow::on_pb160_clicked()
-{
- auto const& row = m_config.frequencies ()->best_working_frequency (1840000);
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0) {
- on_bandComboBox_activated (row);
- } else {
- keep_frequency = true;
- setRig(1837000);
- QTimer::singleShot (250, [=] {keep_frequency = false;});
- }
- setXIT (ui->TxFreqSpinBox->value ());
-}
-
-void MainWindow::on_pb80_clicked()
-{
- auto const& row = m_config.frequencies ()->best_working_frequency (3573000);
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0) {
- on_bandComboBox_activated (row);
- } else {
- keep_frequency = true;
- setRig(3576000);
- QTimer::singleShot (250, [=] {keep_frequency = false;});
- }
- setXIT (ui->TxFreqSpinBox->value ());
-}
-
-void MainWindow::on_pb60_clicked()
-{
- auto const& row = m_config.frequencies ()->best_working_frequency (5357000);
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0) {
- on_bandComboBox_activated (row);
- } else {
- keep_frequency = true;
- setRig(5357000);
- QTimer::singleShot (250, [=] {keep_frequency = false;});
- }
- setXIT (ui->TxFreqSpinBox->value ());
-}
-
-void MainWindow::on_pb40_clicked()
-{
- auto const& row = m_config.frequencies ()->best_working_frequency (7074000);
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0) {
- on_bandComboBox_activated (row);
- } else {
- keep_frequency = true;
- setRig(7077000);
- QTimer::singleShot (250, [=] {keep_frequency = false;});
- }
- setXIT (ui->TxFreqSpinBox->value ());
-}
-
-void MainWindow::on_pb30_clicked()
-{
- auto const& row = m_config.frequencies ()->best_working_frequency (10136000);
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0) {
- on_bandComboBox_activated (row);
- } else {
- keep_frequency = true;
- setRig(10139000);
- QTimer::singleShot (250, [=] {keep_frequency = false;});
- }
- setXIT (ui->TxFreqSpinBox->value ());
-}
-
-void MainWindow::on_pb20_clicked()
-{
- auto const& row = m_config.frequencies ()->best_working_frequency (14074000);
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0) {
- on_bandComboBox_activated (row);
- } else {
- keep_frequency = true;
- setRig(14077000);
- QTimer::singleShot (250, [=] {keep_frequency = false;});
- }
- setXIT (ui->TxFreqSpinBox->value ());
-}
-
-void MainWindow::on_pb17_clicked()
-{
- auto const& row = m_config.frequencies ()->best_working_frequency (18100000);
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0) {
- on_bandComboBox_activated (row);
- } else {
- keep_frequency = true;
- setRig(18103000);
- QTimer::singleShot (250, [=] {keep_frequency = false;});
- }
- setXIT (ui->TxFreqSpinBox->value ());
-}
-
-void MainWindow::on_pb15_clicked()
-{
- auto const& row = m_config.frequencies ()->best_working_frequency (21074000);
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0) {
- on_bandComboBox_activated (row);
- } else {
- keep_frequency = true;
- setRig(21077000);
- QTimer::singleShot (250, [=] {keep_frequency = false;});
- }
- setXIT (ui->TxFreqSpinBox->value ());
-}
-
-void MainWindow::on_pb12_clicked()
-{
- auto const& row = m_config.frequencies ()->best_working_frequency (24915000);
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0) {
- on_bandComboBox_activated (row);
- } else {
- keep_frequency = true;
- setRig(24918000);
- QTimer::singleShot (250, [=] {keep_frequency = false;});
- }
- setXIT (ui->TxFreqSpinBox->value ());
-}
-
-void MainWindow::on_pb10_clicked()
-{
- auto const& row = m_config.frequencies ()->best_working_frequency (28074000);
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0) {
- on_bandComboBox_activated (row);
- } else {
- keep_frequency = true;
- setRig(28077000);
- QTimer::singleShot (250, [=] {keep_frequency = false;});
- }
- setXIT (ui->TxFreqSpinBox->value ());
-}
-
-void MainWindow::on_pb6_clicked()
-{
- auto const& row = m_config.frequencies ()->best_working_frequency (50313000);
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0) {
- on_bandComboBox_activated (row);
- } else {
- keep_frequency = true;
- setRig(50316000);
- QTimer::singleShot (250, [=] {keep_frequency = false;});
- }
- setXIT (ui->TxFreqSpinBox->value ());
-}
-
-void MainWindow::on_pb2_clicked()
-{
- auto const& row = m_config.frequencies ()->best_working_frequency (144074000);
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0) {
- on_bandComboBox_activated (row);
- } else {
- keep_frequency = true;
- setRig(144077000);
- QTimer::singleShot (250, [=] {keep_frequency = false;});
- }
- setXIT (ui->TxFreqSpinBox->value ());
-}
-
-void MainWindow::on_pb70_clicked()
-{
- auto const& row = m_config.frequencies ()->best_working_frequency (432074000);
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0) {
- on_bandComboBox_activated (row);
- } else {
- keep_frequency = true;
- setRig(432077000);
- QTimer::singleShot (250, [=] {keep_frequency = false;});
- }
- setXIT (ui->TxFreqSpinBox->value ());
-}
-
-void MainWindow::on_pb8_clicked()
-{
- auto const& row = m_config.frequencies ()->best_working_frequency (40680000);
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0) {
- on_bandComboBox_activated (row);
- } else {
- keep_frequency = true;
- setRig(40680000);
- QTimer::singleShot (250, [=] {keep_frequency = false;});
- }
- setXIT (ui->TxFreqSpinBox->value ());
-}
-
-void MainWindow::on_pb50_clicked()
-{
- auto const& row = m_config.frequencies ()->best_working_frequency (50313000);
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0) {
- on_bandComboBox_activated (row);
- } else {
- keep_frequency = true;
- setRig(50316000);
- QTimer::singleShot (250, [=] {keep_frequency = false;});
- }
- setXIT (ui->TxFreqSpinBox->value ());
-}
-
-void MainWindow::on_pb4_clicked()
-{
- auto const& row = m_config.frequencies ()->best_working_frequency (70154000);
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0) {
- on_bandComboBox_activated (row);
- } else {
- keep_frequency = true;
- setRig(70154000);
- QTimer::singleShot (250, [=] {keep_frequency = false;});
- }
- setXIT (ui->TxFreqSpinBox->value ());
-}
-
-void MainWindow::on_pb144_clicked()
-{
- auto const& row = m_config.frequencies ()->best_working_frequency (144074000);
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0) {
- on_bandComboBox_activated (row);
- } else {
- keep_frequency = true;
- setRig(144077000);
- QTimer::singleShot (250, [=] {keep_frequency = false;});
- }
- setXIT (ui->TxFreqSpinBox->value ());
-}
-
-void MainWindow::on_pb220_clicked()
-{
- auto const& row = m_config.frequencies ()->best_working_frequency (222174000);
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0) {
- on_bandComboBox_activated (row);
- } else {
- keep_frequency = true;
- setRig(222177000);
- QTimer::singleShot (250, [=] {keep_frequency = false;});
- }
- setXIT (ui->TxFreqSpinBox->value ());
-}
-
-void MainWindow::on_pb432_clicked()
-{
- auto const& row = m_config.frequencies ()->best_working_frequency (432174000);
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0) {
- on_bandComboBox_activated (row);
- } else {
- keep_frequency = true;
- setRig(432177000);
- QTimer::singleShot (250, [=] {keep_frequency = false;});
- }
- setXIT (ui->TxFreqSpinBox->value ());
-}
-
-void MainWindow::on_pb902_clicked()
-{
- auto const& row = m_config.frequencies ()->best_working_frequency (902174000);
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0) {
- on_bandComboBox_activated (row);
- } else {
- keep_frequency = true;
- setRig(902177000);
- QTimer::singleShot (250, [=] {keep_frequency = false;});
- }
- setXIT (ui->TxFreqSpinBox->value ());
-}
-
-void MainWindow::on_pb23_clicked()
-{
- auto const& row = m_config.frequencies ()->best_working_frequency (1296065000);
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0) {
- on_bandComboBox_activated (row);
- } else {
- keep_frequency = true;
- setRig(1296065000);
- QTimer::singleShot (250, [=] {keep_frequency = false;});
- }
- setXIT (ui->TxFreqSpinBox->value ());
-}
-
-void MainWindow::on_pb13_clicked()
-{
- auto const& row = m_config.frequencies ()->best_working_frequency (2304065000);
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0) {
- on_bandComboBox_activated (row);
- } else {
- keep_frequency = true;
- setRig(2304065000);
- QTimer::singleShot (250, [=] {keep_frequency = false;});
- }
- setXIT (ui->TxFreqSpinBox->value ());
-}
-
-void MainWindow::on_pb9_clicked()
-{
- auto const& row = m_config.frequencies ()->best_working_frequency (3400065000);
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0) {
- on_bandComboBox_activated (row);
- } else {
- keep_frequency = true;
- setRig(3400065000);
- QTimer::singleShot (250, [=] {keep_frequency = false;});
- }
- setXIT (ui->TxFreqSpinBox->value ());
-}
-
-void MainWindow::on_pb5G_clicked()
-{
- auto const& row = m_config.frequencies ()->best_working_frequency (5760200000);
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0) {
- on_bandComboBox_activated (row);
- } else {
- keep_frequency = true;
- setRig(5760200000);
- QTimer::singleShot (250, [=] {keep_frequency = false;});
- }
- setXIT (ui->TxFreqSpinBox->value ());
-}
-
-void MainWindow::on_pb10G_clicked()
-{
- auto const& row = m_config.frequencies ()->best_working_frequency (10368200000);
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0) {
- on_bandComboBox_activated (row);
- } else {
- keep_frequency = true;
- setRig(10368200000);
- QTimer::singleShot (250, [=] {keep_frequency = false;});
- }
- setXIT (ui->TxFreqSpinBox->value ());
-}
-
-void MainWindow::on_pb24G_clicked()
-{
- auto const& row = m_config.frequencies ()->best_working_frequency (24048200000);
- ui->bandComboBox->setCurrentIndex (row);
- if (row >= 0) {
- on_bandComboBox_activated (row);
- } else {
- keep_frequency = true;
- setRig(24048200000);
- QTimer::singleShot (250, [=] {keep_frequency = false;});
- }
- setXIT (ui->TxFreqSpinBox->value ());
-}
-
-void MainWindow::read_txLog()
-{
- static QFile logfile {QDir {QStandardPaths::writableLocation (QStandardPaths::DataLocation)}.absoluteFilePath ("wsjtx.log")};
- QTextStream logstream(&logfile);
- if(logfile.open(QIODevice::ReadOnly | QIODevice::Text)) {
- while (!logstream.atEnd()) {
- txLog = logstream.readAll();
- }
- logstream.flush();
- logfile.close();
- }
-}
-
-void MainWindow::on_actionErase_Tx_Log_triggered()
-{
- int ret = MessageBox::query_message (this, tr ("Confirm Erase"),
- tr ("Are you sure you want to erase the Tx Log?"));
- if(ret==MessageBox::Yes) {
- static QFile logFile {QDir {QStandardPaths::writableLocation (QStandardPaths::DataLocation)}.absoluteFilePath ("wsjtx.log")};
- logFile.remove();
- txLog = "";
- }
-}
-
-void MainWindow::addCallsignToignoreList()
-{
- if (m_hisCall!="") {
- static QFile ignoreFile {QDir {QStandardPaths::writableLocation (QStandardPaths::DataLocation)}.absoluteFilePath ("ignore.list")};
- if(ignoreFile.open(QIODevice::Text | QIODevice::Append)) {
- QString ignoreEntry= (m_hisCall + ",");
- QTextStream out(&ignoreFile);
- out << ignoreEntry <<
- #if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
- endl
- #else
- Qt::endl
- #endif
- ;
- ignoreFile.close();
- QTimer::singleShot (2000, [=] {read_ignoreList();});
- QTimer::singleShot (7000, [=] {read_ignoreList();});
- MessageBox::information_message (this, tr ("\"%1\" added to Ignore List").arg (m_hisCall));
- }
- }
-}
-
-void MainWindow::read_ignoreList()
-{
- static QFile ignoreFile {QDir {QStandardPaths::writableLocation (QStandardPaths::DataLocation)}.absoluteFilePath ("ignore.list")};
- QTextStream ignoreStream(&ignoreFile);
- if(ignoreFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
- while (!ignoreStream.atEnd()) {
- ignoreList = ignoreStream.readAll();
- }
- ignoreStream.flush();
- ignoreFile.close();
- }
-}
-
-void MainWindow::on_actionErase_Ignore_List_triggered()
-{
- int ret = MessageBox::query_message (this, tr ("Confirm Erase"),
- tr ("Are you sure you want to erase the Ignore List?"));
- if(ret==MessageBox::Yes) {
- static QFile ignoreFile {QDir {QStandardPaths::writableLocation (QStandardPaths::DataLocation)}.absoluteFilePath ("ignore.list")};
- ignoreFile.remove();
- ignoreList = "";
- }
-}
-
-void MainWindow::read_ALLCALL7()
-{
- static QFile AllCall7File {"ALLCALL7.TXT"};
- QTextStream AllCall7Stream(&AllCall7File);
- if(AllCall7File.open(QIODevice::ReadOnly | QIODevice::Text)) {
- while (!AllCall7Stream.atEnd()) {
- ALLCALL7 = AllCall7Stream.readAll();
- }
- AllCall7Stream.flush();
- AllCall7File.close();
- }
-}
-
-void MainWindow::remove_old_files(const QString &directoryPath, int daysOld)
-{
- QDir dir(directoryPath);
- if (!dir.exists()) {
- qWarning() << "Directory does not exist:" << directoryPath;
- return;
- }
- dir.setFilter(QDir::Files);
- QDateTime timeThreshold = QDateTime::currentDateTime().addDays(-daysOld);
- QFileInfoList fileList = dir.entryInfoList();
- foreach(QFileInfo fileInfo, fileList) {
- if(fileInfo.lastModified() < timeThreshold) {
- if(!QFile::remove(fileInfo.absoluteFilePath())) {
- qWarning() << "Could not delete file:" << fileInfo.absoluteFilePath();
- } else {
- qDebug() << "Deleted old file:" << fileInfo.absoluteFilePath();
- }
- }
- }
-}
-
-void MainWindow::alertQSYmessage ()
-{
-#ifdef WIN32
- QAudioOutput info(QAudioDeviceInfo::defaultOutputDevice());
- QString binPath = QCoreApplication::applicationDirPath();
- QAudioFormat format;
- format.setCodec("audio/pcm");
- format.setSampleRate (48000);
- format.setChannelCount (1);
- format.setSampleSize (16);
- format.setSampleType(QAudioFormat::SignedInt);
- QAudioOutput* audio;
- audio = new QAudioOutput(format, this);
- connect(audio, SIGNAL(stateChanged(QAudio::State)), this, SLOT(handleStateChanged(QAudio::State)));
- QFile *effect1 = new QFile(this);
- effect1->setFileName(QString("%1/%2").arg(binPath, "/sounds/Message.wav"));
- effect1->open(QIODevice::ReadOnly);
- audio->start(effect1);
-#else
- QString binPath = QCoreApplication::applicationDirPath();
- QSound::play(binPath + "/sounds/Message.wav"); // for Linux and macOS
-#endif
-}
+//---------------------------------------------------------- MainWindow +#include "mainwindow.h" + +#include <QAudio> +#include <QAudioOutput> +#include <QSound> +#include <QCoreApplication> +#include <cinttypes> +#include <cstring> +#include <cmath> +#include <limits> +#include <functional> +#include <fstream> +#include <iterator> +#include <algorithm> +#include <fftw3.h> +#include <thread> // TCI +#include <QApplication> +#include <QStringListModel> +#include <QSettings> +#include <QKeyEvent> +#include <QWheelEvent> +#include <QProcessEnvironment> +#include <QSharedMemory> +#include <QFileDialog> +#include <QTextBlock> +#include <QProgressBar> +#include <QLineEdit> +#include <QRegExpValidator> +#include <QRegExp> +#include <QRegularExpression> +#include <QDesktopServices> +#include <QNetworkAccessManager> // TCI +#include <QNetworkRequest> // TCI +#include <QNetworkReply> // TCI +#include <QUrl> +#include <QStandardPaths> +#include <QDir> +#include <QDebug> +#include <QtConcurrent/QtConcurrentRun> +#include <QProgressDialog> +#include <QHostInfo> +#include <QVector> +#include <QCursor> +#include <QToolTip> +#include <QAction> +#include <QButtonGroup> +#include <QActionGroup> +#include <QSplashScreen> +#include <QUdpSocket> +#include <QAbstractItemView> +#include <QInputDialog> +#include <QSound> // TCI +#include <QtMath> // TCI +#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0) +#include <QRandomGenerator> +#endif + +#include "itoneAndicw.h" // TCI + +#include "helper_functions.h" +#include "revision_utils.hpp" +#include "qt_helpers.hpp" +#include "Network/NetworkAccessManager.hpp" +#include "Audio/soundout.h" +#include "Audio/soundin.h" +#include "Modulator/Modulator.hpp" +#include "Detector/Detector.hpp" +#include "plotter.h" +#include "echoplot.h" +#include "echograph.h" +#include "fastplot.h" +#include "fastgraph.h" +#include "otpgenerator.h" +#include "about.h" +#include "messageaveraging.h" +#include "activeStations.h" +#include "colorhighlighting.h" +#include "widegraph.h" +#include "sleep.h" +#include "logqso.h" +#include "Decoder/decodedtext.h" +#include "Radio.hpp" +#include "models/Bands.hpp" +#include "Transceiver/TransceiverFactory.hpp" +#include "models/StationList.hpp" +#include "validators/LiveFrequencyValidator.hpp" +#include "Network/MessageClient.hpp" +#include "Network/FoxVerifier.hpp" +#include "Network/wsprnet.h" +#include "signalmeter.h" +#include "HelpTextWindow.hpp" +#include "SampleDownloader.hpp" +#include "Audio/BWFFile.hpp" +#include "MultiSettings.hpp" +#include "validators/MaidenheadLocatorValidator.hpp" +#include "validators/CallsignValidator.hpp" +#include "EqualizationToolsDialog.hpp" +#include "Network/LotWUsers.hpp" +#include "logbook/AD1CCty.hpp" +#include "models/FoxLog.hpp" +#include "models/CabrilloLog.hpp" +#include "FoxLogWindow.hpp" +#include "CabrilloLogWindow.hpp" +#include "ExportCabrillo.h" +#include "Network/Cloudlog.hpp" +#include "ui_mainwindow.h" +#include "moc_mainwindow.cpp" +#include "Logger.hpp" +#include "widgets/QSYMessage.h" +#include "widgets/QSYMessageCreator.h" +#include "widgets/qsymonitor.h" +#include "Network/eqsl.h" + +#define FCL fortran_charlen_t + +extern "C" { + //----------------------------------------------------- C and Fortran routines + void symspec_(struct dec_data *, int* k, int* nsps, int* ingain, + bool* bLowSidelobes, int* minw, float* px, float s[], float* df3, + int* nhsym, int* npts8, float *m_pxmax, int* npct); + + void hspec_(short int d2[], int* k, int* nutc0, int* ntrperiod, int* nrxfreq, int* ntol, + bool* bmsk144, bool* btrain, double const pcoeffs[], int* ingain, + char const * mycall, char const * hiscall, bool* bshmsg, bool* bswl, + char const * ddir, float green[], + float s[], int* jh, float *pxmax, float *rmsNoGain, char line[], + fortran_charlen_t, fortran_charlen_t, fortran_charlen_t, fortran_charlen_t); + + void gen_echocall_(char* basecall, int itone[], fortran_charlen_t); + + void genft8_(char* msg, int* i3, int* n3, char* msgsent, char ft8msgbits[], + int itone[], fortran_charlen_t, fortran_charlen_t); + + void genft4_(char* msg, int* ichk, char* msgsent, char ft4msgbits[], int itone[], + fortran_charlen_t, fortran_charlen_t); + + void genfst4_(char* msg, int* ichk, char* msgsent, char fst4msgbits[], + int itone[], int* iwspr, fortran_charlen_t, fortran_charlen_t); + + void gen_ft8wave_(int itone[], int* nsym, int* nsps, float* bt, float* fsample, float* f0, + float xjunk[], float wave[], int* icmplx, int* nwave); + + void gen_ft4wave_(int itone[], int* nsym, int* nsps, float* fsample, float* f0, + float xjunk[], float wave[], int* icmplx, int* nwave); + + void gen_fst4wave_(int itone[], int* nsym, int* nsps, int* nwave, float* fsample, + int* hmod, float* f0, int* icmplx, float xjunk[], float wave[]); + + void genwave_(int itone[], int* nsym, int* nsps, int* nwave, float* fsample, + double* toneSpacing, float* f0, int* icmplx, float xjunk[], float wave[]); + + void gen4_(char* msg, int* ichk, char* msgsent, int itone[], + int* itext, fortran_charlen_t, fortran_charlen_t); + + void gen9_(char* msg, int* ichk, char* msgsent, int itone[], + int* itext, fortran_charlen_t, fortran_charlen_t); + + void genmsk_128_90_(char* msg, int* ichk, char* msgsent, int itone[], int* itype, + fortran_charlen_t, fortran_charlen_t); + + void gen65(char* msg, int* ichk, char msgsent[], int itone[], int* itext); + + void gen_cw_wave_(char* msg, int* ifreq, float wave[], fortran_charlen_t); + + void genq65_(char* msg, int* ichk, char* msgsent, int itone[], + int* i3, int* n3, fortran_charlen_t, fortran_charlen_t); + + void genwspr_(char* msg, char* msgsent, int itone[], fortran_charlen_t, fortran_charlen_t); + + void azdist_(char* MyGrid, char* HisGrid, double* utch, int* nAz, int* nEl, + int* nDmiles, int* nDkm, int* nHotAz, int* nHotABetter, + fortran_charlen_t, fortran_charlen_t); + + void morse_(char* msg, int* icw, int* ncw, fortran_charlen_t); + + void wspr_downsample_(short int d2[], int* k); + + int savec2_(char const * fname, int* TR_seconds, double* dial_freq, fortran_charlen_t); + + void save_echo_params_(int* ndoptotal, int* ndop, int* nfrit, float* f1, float* fspread, + int* toneSpacing, volatile int itone[], short id2[], int* idir); + + void avecho_( short id2[], int* dop, int* nfrit, int* nauto, int* ndf, int* navg, + int* nqual, float* f1, float* level, float* sigdb, float* snr, float* dfreq, + float* width, bool* bDiskData, bool* bEchoCall, char const * txcall, + char rxcall[], FCL len1, FCL len2); + + void fast_decode_(short id2[], int narg[], double * trperiod, + char msg[], char mycall[], char hiscall[], + fortran_charlen_t, fortran_charlen_t, fortran_charlen_t); + void degrade_snr_(short d2[], int* n, float* db, float* bandwidth); + + void wav12_(short d2[], short d1[], int* nbytes, short* nbitsam2); + + void refspectrum_(short int d2[], bool* bclearrefspec, + bool* brefspec, bool* buseref, const char* c_fname, fortran_charlen_t); + + void freqcal_(short d2[], int* k, int* nkhz,int* noffset, int* ntol, + char line[], fortran_charlen_t); + + void calibrate_(char const * data_dir, int* iz, double* a, double* b, double* rms, + double* sigmaa, double* sigmab, int* irc, fortran_charlen_t); + + void foxgen_(bool* bSuperFox, char const * fname, FCL len); + + void sfox_wave_gfsk_(); + + void sftx_sub_(char const * otp_key, FCL len1); + + void plotsave_(float swide[], int* m_w , int* m_h1, int* irow); + + void chk_samples_(int* m_ihsym,int* k, int* m_hsymStop); + + void save_dxbase_(char* dxbase, FCL len); + + void indexx_(float arr[], int* n, int indx[]); + + void get_q3list_(char* fname, bool* bDiskData, int* nlist, char* list, FCL len1, FCL len2); + + void rm_q3list_(char* callsign, FCL len); + + void jpl_setup_(char* fname, FCL len); +} +QList<FoxVerifier *> m_verifications; +int volatile itone[MAX_NUM_SYMBOLS]; //Audio tones for all Tx symbols +int volatile itone0[MAX_NUM_SYMBOLS]; //Dummy array, data not actually used +int volatile icw[NUM_CW_SYMBOLS]; //Dits for CW ID +dec_data_t dec_data; //For sharing with Fortran +int outBufSize; +int rc; +qint32 g_iptt {0}; +wchar_t buffer[256]; +float fast_green[703]; +float fast_green2[703]; +float fast_s[44992]; //44992=64*703 +float fast_s2[44992]; +int fast_jh {0}; +int fast_jhpeak {0}; +int fast_jh2 {0}; +int narg[15]; +QVector<QColor> g_ColorTbl; + +using SpecOp = Configuration::SpecialOperatingActivity; + +bool verified = false; +bool blocked = false; +bool m_displayBand = false; +bool wait_and_call = false; +bool no_wait_and_call = false; +bool no_a7_decodes = false; +bool keep_frequency = false; +bool keep_msk144_frequency = false; +bool msk144qsy = false; +bool keep_last_tx_label = false; +int m_Nslots0 {1}; +int m_TxFreqFox {300}; +bool not_erase = false; +bool first_Fox_alert = true; +bool second_Fox_alert = true; +bool no_Fox_alert = false; +int Dpoints=0; +int maxDPoints=0; +int dBpoints=-28; +int dBpoints2=99; +int maxdBPoints=-28; +int mindBPoints=99; +bool pounce = false; +bool filtered = false; +bool ignored = false; +bool selected = false; +bool keepTx5 = false; +bool no_logging = false; +bool BlankLineInserted = false; +bool m_txing; +bool HoldTxFreqStatus; +bool m_band_changed = false; +bool m_muted = false; +bool no_decodes_to_UDP = false; +bool rigFailed = false; +bool programStart = true; +int m_msk144_tr {30}; +int m_msk144_tr2 {30}; +int m_msk144_tr6 {15}; +QString txLog; +QString ignoreList; +QString ALLCALL7 = ""; +QString m_hisCall0 = ""; +QString earlyDecodes = ""; //ft8md + +QSharedMemory mem_qmap("mem_qmap"); //Memory segment to be shared (optionally) with QMAP +struct { + int ndecodes; //Number of QMAP decodes available (so far) + int ncand; //Number of QMAP candidates considered for decoding + int nQDecoderDone; //QMAP decoder is finished (0 or 1) + int nWDecoderBusy; //WSJT-X decoder is busy (0 or 1) + int nWTransmitting; //WSJT-X is transmitting (0 or 1) + int kHzRequested; //Integer kHz dial frequency requested from QMAP + char result[50][72]; //Decodes as character*72 arrays +} qmapcom; +int* ipc_qmap; + +namespace +{ + Radio::Frequency constexpr default_frequency {14074000}; + QRegExp message_alphabet {"[- @A-Za-z0-9+./?#<>;$]*"}; + // grid exact match excluding RR73 + QRegularExpression grid_regexp {"\\A(?![Rr]{2}73)[A-Ra-r]{2}[0-9]{2}([A-Xa-x]{2}){0,1}\\z"}; + QRegularExpression non_r_db_regexp {"\\A[-+]{1}[0-9]{1,2}\\z"}; + auto quint32_max = std::numeric_limits<quint32>::max (); + constexpr int N_WIDGETS {38}; + constexpr int default_rx_audio_buffer_frames {-1}; // lets Qt decide + constexpr int default_tx_audio_buffer_frames {-1}; // lets Qt decide + + bool message_is_73 (int type, QStringList const& msg_parts) + { + return type >= 0 + && (((type < 6 || 7 == type) + && (msg_parts.contains ("73") || msg_parts.contains ("RR73"))) + || (type == 6 && !msg_parts.filter ("73").isEmpty ())); + } + + int ms_minute_error () + { + auto const& now = QDateTime::currentDateTimeUtc (); + auto const& time = now.time (); + auto second = time.second (); + return now.msecsTo (now.addSecs (second > 30 ? 60 - second : -second)) - time.msec (); + } +} + +//--------------------------------------------------- MainWindow constructor +MainWindow::MainWindow(QDir const& temp_directory, bool multiple, + MultiSettings * multi_settings, QSharedMemory *shdmem, + unsigned downSampleFactor, + QSplashScreen * splash, QProcessEnvironment const& env, QWidget *parent) : + MultiGeometryWidget {parent}, + m_env {env}, + m_network_manager {this}, + m_valid {true}, + m_splash {splash}, + m_revision {revision ()}, + m_multiple {multiple}, + m_multi_settings {multi_settings}, + m_configurations_button {0}, + m_settings {multi_settings->settings ()}, + ui(new Ui::MainWindow), + m_config {&m_network_manager, temp_directory, m_settings, &m_logBook, this}, + m_logBook {&m_config}, + m_cloudlog {&m_config, &m_network_manager}, + m_WSPR_band_hopping {m_settings, &m_config, this}, + m_WSPR_tx_next {false}, + m_rigErrorMessageBox {MessageBox::Critical, tr ("Rig Control Error") + , MessageBox::Cancel | MessageBox::Ok | MessageBox::Retry}, + m_wideGraph (new WideGraph(m_settings)), + m_echoGraph (new EchoGraph(m_settings)), + m_fastGraph (new FastGraph(m_settings)), + // no parent so that it has a taskbar icon + m_logDlg (new LogQSO (program_title (), m_settings, &m_config, &m_logBook, nullptr)), + m_lastDialFreq {0}, + m_dialFreqRxWSPR {0}, + m_detector {new Detector {RX_SAMPLE_RATE, double(NTMAX), downSampleFactor}}, + m_FFTSize {6192 / 2}, // conservative value to avoid buffer overruns + m_soundInput {new SoundInput}, + m_modulator {new Modulator {TX_SAMPLE_RATE, NTMAX}}, + m_soundOutput {new SoundOutput}, + m_rx_audio_buffer_frames {0}, + m_tx_audio_buffer_frames {0}, + m_msErase {0}, + m_secBandChanged {0}, + m_msDecStarted {0}, //ft8md + m_freqNominal {0}, + m_freqNominalPeriod {0}, + m_freqTxNominal {0}, + m_mslastTX {0}, //ft8md + m_nlasttx {0}, //ft8md + m_lapmyc {0}, //ft8md + m_reverse_Doppler {"1" == env.value ("WSJT_REVERSE_DOPPLER", "0")}, + m_tRemaining {0.}, + m_TRperiod {60.0}, + m_DTtol {3.0}, + m_waterfallAvg {1}, + m_ntx {1}, + m_gen_message_is_cq {false}, + m_send_RR73 {false}, + m_XIT {0}, + m_ncandthin {100}, //ft8md + m_nFT8Cycles {3}, //ft8md + m_nFT8RXfSens {3} , //ft8md + m_ft8threads {0}, //ft8md + m_ft8Sensitivity {3}, //ft8md + m_ft8DecoderStart {3}, //ft8md + m_nsecBandChanged {0},//ft8md + m_nFT4depth {3}, //ft8md + m_sec0 {-1}, + m_RxLog {1}, //Write Date and Time to RxLog + m_nutc0 {999999}, + m_ntr {0}, + m_tx {0}, + m_mslastMon {0}, + m_delay {0}, + m_inGain {0}, + m_secID {0}, + m_idleMinutes {0}, + m_nSubMode {0}, + m_nclearave {1}, + m_nWSPRdecodes {0}, + m_k0 {9999999}, + m_nPick {0}, + m_frequency_list_fcal_iter {m_config.frequencies ()->begin ()}, + m_nTx73 {0}, + m_position {0}, + m_btxok {false}, + m_diskData {false}, + m_loopall {false}, + m_txFirst {false}, + m_auto {false}, + m_restart {false}, + m_startAnother {false}, + m_skipTx1 {false}, //ft8md + m_filter {false}, //ft8md + m_agcc {false}, //ft8md + m_hint {true}, //ft8md + m_multithreadFT8 (false), //ft8md + m_houndMode {false}, //ft8md + m_commonFT8b {true}, //ft8md + m_manualDecode (false), //ft8md + m_modeChanged {false}, //ft8md + m_multInst {false}, //ft8md + m_saveDecoded {false}, + m_saveAll {false}, + m_widebandDecode {false}, + m_dataAvailable {false}, + m_decodedText2 {false}, + m_sentFirst73 {false}, + m_tci_mod_active {false}, // TCI + m_tci {false}, // TCI + m_tci_audio {false}, // TCI + m_currentMessageType {-1}, + m_lastMessageType {-1}, + m_bShMsgs {false}, + m_bSWL {false}, + m_uploading {false}, + m_grid6 {false}, + m_tuneup {false}, + m_bTxTime {false}, + m_rxDone {true}, + m_bSimplex {false}, + m_bEchoTxOK {false}, + m_bTransmittedEcho {false}, + m_bEchoTxed {false}, + m_bFastDecodeCalled {false}, + m_bDoubleClickAfterCQnnn {false}, + m_bRefSpec {false}, + m_bClearRefSpec {false}, + m_bTrain {false}, + m_bAutoReply {false}, + m_lastloggedcall {""}, + m_QSOProgress {CALLING}, + m_ihsym {0}, + m_nzap {0}, + m_px {0.0}, + m_iptt0 {0}, + m_btxok0 {false}, + m_nsendingsh {0}, + m_onAirFreq0 {0.0}, + m_first_error {true}, + tx_status_label {tr ("Receiving")}, + wsprNet {new WSPRNet {&m_network_manager, this}}, + Eqsl {new EQSL {&m_network_manager, this}}, + m_baseCall {Radio::base_callsign (m_config.my_callsign ())}, + m_appDir {QApplication::applicationDirPath ()}, + m_cqStr {""}, + m_palette {"Linrad"}, + m_mode {"FT8"}, + m_modeTx {"FT8"}, + m_rpt {"-15"}, + m_pfx { + "1A", "1S", + "3A", "3B6", "3B8", "3B9", "3C", "3C0", "3D2", "3D2C", + "3D2R", "3DA", "3V", "3W", "3X", "3Y", "3YB", "3YP", + "4J", "4L", "4S", "4U1I", "4U1U", "4W", "4X", + "5A", "5B", "5H", "5N", "5R", "5T", "5U", "5V", "5W", "5X", "5Z", + "6W", "6Y", + "7O", "7P", "7Q", "7X", + "8P", "8Q", "8R", + "9A", "9G", "9H", "9J", "9K", "9L", "9M2", "9M6", "9N", + "9Q", "9U", "9V", "9X", "9Y", + "A2", "A3", "A4", "A5", "A6", "A7", "A9", "AP", + "BS7", "BV", "BV9", "BY", + "C2", "C3", "C5", "C6", "C9", "CE", "CE0X", "CE0Y", + "CE0Z", "CE9", "CM", "CN", "CP", "CT", "CT3", "CU", + "CX", "CY0", "CY9", + "D2", "D4", "D6", "DL", "DU", + "E3", "E4", "E5", "EA", "EA6", "EA8", "EA9", "EI", "EK", + "EL", "EP", "ER", "ES", "ET", "EU", "EX", "EY", "EZ", + "F", "FG", "FH", "FJ", "FK", "FKC", "FM", "FO", "FOA", + "FOC", "FOM", "FP", "FR", "FRG", "FRJ", "FRT", "FT5W", + "FT5X", "FT5Z", "FW", "FY", + "M", "MD", "MI", "MJ", "MM", "MU", "MW", + "H4", "H40", "HA", "HB", "HB0", "HC", "HC8", "HH", + "HI", "HK", "HK0", "HK0M", "HL", "HM", "HP", "HR", + "HS", "HV", "HZ", + "I", "IS", "IS0", + "J2", "J3", "J5", "J6", "J7", "J8", "JA", "JDM", + "JDO", "JT", "JW", "JX", "JY", + "K", "KC4", "KG4", "KH0", "KH1", "KH2", "KH3", "KH4", "KH5", + "KH5K", "KH6", "KH7", "KH8", "KH9", "KL", "KP1", "KP2", + "KP4", "KP5", + "LA", "LU", "LX", "LY", "LZ", + "OA", "OD", "OE", "OH", "OH0", "OJ0", "OK", "OM", "ON", + "OX", "OY", "OZ", + "P2", "P4", "PA", "PJ2", "PJ7", "PY", "PY0F", "PT0S", "PY0T", "PZ", + "R1F", "R1M", + "S0", "S2", "S5", "S7", "S9", "SM", "SP", "ST", "SU", + "SV", "SVA", "SV5", "SV9", + "T2", "T30", "T31", "T32", "T33", "T5", "T7", "T8", "T9", "TA", + "TF", "TG", "TI", "TI9", "TJ", "TK", "TL", "TN", "TR", "TT", + "TU", "TY", "TZ", + "UA", "UA2", "UA9", "UK", "UN", "UR", + "V2", "V3", "V4", "V5", "V6", "V7", "V8", "VE", "VK", "VK0H", + "VK0M", "VK9C", "VK9L", "VK9M", "VK9N", "VK9W", "VK9X", "VP2E", + "VP2M", "VP2V", "VP5", "VP6", "VP6D", "VP8", "VP8G", "VP8H", + "VP8O", "VP8S", "VP9", "VQ9", "VR", "VU", "VU4", "VU7", + "XE", "XF4", "XT", "XU", "XW", "XX9", "XZ", + "YA", "YB", "YI", "YJ", "YK", "YL", "YN", "YO", "YS", "YU", "YV", "YV0", + "Z2", "Z3", "ZA", "ZB", "ZC4", "ZD7", "ZD8", "ZD9", "ZF", "ZK1N", + "ZK1S", "ZK2", "ZK3", "ZL", "ZL7", "ZL8", "ZL9", "ZP", "ZS", "ZS8" + }, + m_sfx {"P", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A"}, + mem_jt9 {shdmem}, + m_downSampleFactor (downSampleFactor), + m_audioThreadPriority (QThread::HighPriority), + m_bandEdited {false}, + m_splitMode {false}, + m_monitoring {false}, + m_tx_when_ready {false}, + m_transmitting {false}, + m_tune {false}, + m_tx_watchdog {false}, + m_block_pwr_tooltip {false}, + m_PwrBandSetOK {true}, + m_lastMonitoredFrequency {default_frequency}, + m_toneSpacing {0.}, + m_firstDecode {0}, + m_optimizingProgress {"Optimizing decoder FFTs for your CPU.\n" + "Please be patient,\n" + "this may take a few minutes", QString {}, 0, 1, this}, + m_messageClient {new MessageClient {QApplication::applicationName (), + version (), revision (), + m_config.udp_server_name (), m_config.udp_server_port (), + m_config.udp_interface_names (), m_config.udp_TTL (), + this}}, + m_psk_Reporter {&m_config, QString {"WSJT-X v" + version () + " i+"}.simplified ()}, // UR + m_manual {&m_network_manager}, + m_block_udp_status_updates {false}, + m_useDarkStyle {false} +{ + ui->setupUi(this); + setUnifiedTitleAndToolBarOnMac (true); + createStatusBar(); + add_child_to_event_filter (this); + ui->dxGridEntry->setValidator (new MaidenheadLocatorValidator {this}); + ui->dxCallEntry->setValidator (new CallsignValidator {this}); + ui->sbTR->values ({5, 10, 15, 30, 60, 120, 300, 900, 1800}); + ui->sbTR_FST4W->values ({120, 300, 900, 1800}); + ui->decodedTextBrowser->set_configuration (&m_config, true); + ui->decodedTextBrowser2->set_configuration (&m_config); + + m_optimizingProgress.setWindowModality (Qt::WindowModal); + m_optimizingProgress.setAutoReset (false); + m_optimizingProgress.setMinimumDuration (15000); // only show after 15s delay + + //Attach or create a memory segment to be shared with QMAP. + int memSize=4096; + if(!mem_qmap.attach()) mem_qmap.create(memSize); + ipc_qmap = (int*)mem_qmap.data(); + mem_qmap.lock(); + memset(ipc_qmap,0,memSize); //Zero all of QMAP shared memory + mem_qmap.unlock(); + + // Closedown. + connect (ui->actionExit, &QAction::triggered, this, &QMainWindow::close); + + // parts of the rig error message box that are fixed + m_rigErrorMessageBox.setInformativeText (tr ("Do you want to reconfigure the radio interface?")); + m_rigErrorMessageBox.setDefaultButton (MessageBox::Ok); + + // start audio thread and hook up slots & signals for shutdown management + // these objects need to be in the audio thread so that invoking + // their slots is done in a thread safe way + m_soundOutput->moveToThread (&m_audioThread); + m_modulator->moveToThread (&m_audioThread); + m_soundInput->moveToThread (&m_audioThread); + m_detector->moveToThread (&m_audioThread); + bool ok; + auto buffer_size = env.value ("WSJT_RX_AUDIO_BUFFER_FRAMES", "0").toInt (&ok); + m_rx_audio_buffer_frames = ok && buffer_size ? buffer_size : default_rx_audio_buffer_frames; + buffer_size = env.value ("WSJT_TX_AUDIO_BUFFER_FRAMES", "0").toInt (&ok); + m_tx_audio_buffer_frames = ok && buffer_size ? buffer_size : default_tx_audio_buffer_frames; + + // hook up sound output stream slots & signals and disposal + connect (this, &MainWindow::initializeAudioOutputStream, m_soundOutput, &SoundOutput::setFormat); + connect (m_soundOutput, &SoundOutput::error, this, &MainWindow::showSoundOutError); + connect (m_soundOutput, &SoundOutput::error, &m_config, &Configuration::invalidate_audio_output_device); + // connect (m_soundOutput, &SoundOutput::status, this, &MainWindow::showStatusMessage); + connect (this, &MainWindow::outAttenuationChanged, m_soundOutput, &SoundOutput::setAttenuation); + connect (&m_audioThread, &QThread::finished, m_soundOutput, &QObject::deleteLater); + + // hook up Modulator slots and disposal + connect (this, &MainWindow::transmitFrequency, m_modulator, &Modulator::setFrequency); + connect (this, &MainWindow::endTransmitMessage, m_modulator, &Modulator::stop); + connect (this, &MainWindow::tune, m_modulator, &Modulator::tune); + connect (this, &MainWindow::sendMessage, m_modulator, &Modulator::start); + connect (&m_audioThread, &QThread::finished, m_modulator, &QObject::deleteLater); + + // hook up the audio input stream signals, slots and disposal + connect (this, &MainWindow::startAudioInputStream, m_soundInput, &SoundInput::start); + connect (this, &MainWindow::suspendAudioInputStream, m_soundInput, &SoundInput::suspend); + connect (this, &MainWindow::resumeAudioInputStream, m_soundInput, &SoundInput::resume); + connect (this, &MainWindow::reset_audio_input_stream, m_soundInput, &SoundInput::reset); + connect (this, &MainWindow::finished, m_soundInput, &SoundInput::stop); + connect(m_soundInput, &SoundInput::error, this, &MainWindow::showSoundInError); + connect(m_soundInput, &SoundInput::error, &m_config, &Configuration::invalidate_audio_input_device); + // connect(m_soundInput, &SoundInput::status, this, &MainWindow::showStatusMessage); + connect (&m_audioThread, &QThread::finished, m_soundInput, &QObject::deleteLater); + + connect (this, &MainWindow::finished, this, &MainWindow::close); + + // hook up the detector signals, slots and disposal + connect (this, &MainWindow::FFTSize, m_detector, &Detector::setBlockSize); + connect(m_detector, &Detector::framesWritten, this, &MainWindow::dataSink); + connect (&m_audioThread, &QThread::finished, m_detector, &QObject::deleteLater); + + // setup the waterfall + connect(m_wideGraph.data (), SIGNAL(freezeDecode2(int)),this,SLOT(freezeDecode(int))); + connect(m_wideGraph.data (), SIGNAL(f11f12(int)),this,SLOT(bumpFqso(int))); + connect(m_wideGraph.data (), SIGNAL(setXIT2(int)),this,SLOT(setXIT(int))); + + connect (m_fastGraph.data (), &FastGraph::fastPick, this, &MainWindow::fastPick); + + connect (this, &MainWindow::finished, m_wideGraph.data (), &WideGraph::close); + connect (this, &MainWindow::finished, m_echoGraph.data (), &EchoGraph::close); + connect (this, &MainWindow::finished, m_fastGraph.data (), &FastGraph::close); + + // setup the log QSO dialog + connect (m_logDlg.data (), &LogQSO::acceptQSO, this, &MainWindow::acceptQSO); + connect (this, &MainWindow::finished, m_logDlg.data (), &LogQSO::close); + + // hook up the log book + connect (&m_logBook, &LogBook::finished_loading, [this] (int record_count, QString cty_version, QString const& error) { + if (error.size ()) + { + MessageBox::warning_message (this, tr ("Error Scanning ADIF Log"), error); + } + else + { + m_config.set_CTY_DAT_version(cty_version); + showStatusMessage (tr ("Scanned ADIF log, %1 worked-before records created. CTY: %2").arg (record_count).arg (cty_version)); + } + }); + + // Network message handlers + m_messageClient->enable (m_config.accept_udp_requests ()); + connect (m_messageClient, &MessageClient::clear_decodes, [this] (quint8 window) { + ++window; + if (window & 1) + { + ui->decodedTextBrowser->erase (); + } + if (window & 2) + { + ui->decodedTextBrowser2->erase (); + } + }); + connect (m_messageClient, &MessageClient::reply, this, &MainWindow::replyToCQ); + connect (m_messageClient, &MessageClient::close, this, &MainWindow::close); + connect (m_messageClient, &MessageClient::replay, this, &MainWindow::replayDecodes); + connect (m_messageClient, &MessageClient::location, this, &MainWindow::locationChange); + connect (m_messageClient, &MessageClient::halt_tx, [this] (bool auto_only) { + if (auto_only) { + if (ui->autoButton->isChecked ()) { + ui->autoButton->click(); + } + } else { + ui->stopTxButton->click(); + } + }); + connect (m_messageClient, &MessageClient::error, this, &MainWindow::networkError); + connect (m_messageClient, &MessageClient::free_text, [this] (QString const& text, bool send) { + tx_watchdog (false); + // send + non-empty text means set and send the free text + // message, !send + non-empty text means set the current free + // text message, send + empty text means send the current free + // text message without change, !send + empty text means clear + // the current free text message + if (0 == ui->tabWidget->currentIndex ()) { + if (!text.isEmpty ()) { + ui->tx5->setCurrentText (text); + } + if (send) { + ui->txb5->click (); + } else if (text.isEmpty ()) { + ui->tx5->setCurrentText (text); + } + } + QApplication::alert (this); + }); + + connect (m_messageClient, &MessageClient::highlight_callsign, ui->decodedTextBrowser, &DisplayText::highlight_callsign); + connect (m_messageClient, &MessageClient::switch_configuration, m_multi_settings, &MultiSettings::select_configuration); + connect (m_messageClient, &MessageClient::configure, this, &MainWindow::remote_configure); + + // Hook up WSPR band hopping + connect (ui->band_hopping_schedule_push_button, &QPushButton::clicked + , &m_WSPR_band_hopping, &WSPRBandHopping::show_dialog); + connect (ui->sbTxPercent, static_cast<void (QSpinBox::*) (int)> (&QSpinBox::valueChanged) + , &m_WSPR_band_hopping, &WSPRBandHopping::set_tx_percent); + + on_EraseButton_clicked (); + + QActionGroup* modeGroup = new QActionGroup(this); + ui->actionFST4->setActionGroup(modeGroup); + ui->actionFST4W->setActionGroup(modeGroup); + ui->actionFT4->setActionGroup(modeGroup); + ui->actionFT8->setActionGroup(modeGroup); + ui->actionJT9->setActionGroup(modeGroup); + ui->actionJT65->setActionGroup(modeGroup); + ui->actionJT4->setActionGroup(modeGroup); + ui->actionWSPR->setActionGroup(modeGroup); + ui->actionEcho->setActionGroup(modeGroup); + ui->actionMSK144->setActionGroup(modeGroup); + ui->actionQ65->setActionGroup(modeGroup); + ui->actionFreqCal->setActionGroup(modeGroup); + + QActionGroup* saveGroup = new QActionGroup(this); + ui->actionNone->setActionGroup(saveGroup); + ui->actionSave_decoded->setActionGroup(saveGroup); + ui->actionSave_all->setActionGroup(saveGroup); + + QActionGroup* alltxtGroup = new QActionGroup(this); + ui->actionDon_t_split_ALL_TXT->setActionGroup(alltxtGroup); + ui->actionSplit_ALL_TXT_yearly->setActionGroup(alltxtGroup); + ui->actionSplit_ALL_TXT_monthly->setActionGroup(alltxtGroup); + ui->actionDisable_writing_of_ALL_TXT->setActionGroup(alltxtGroup); + + QActionGroup* EventLoggingGroup = new QActionGroup(this); + ui->actionDefault_event_logging->setActionGroup(EventLoggingGroup); + ui->actionDiagnostic_mode->setActionGroup(EventLoggingGroup); + ui->actionDisable_event_logging->setActionGroup(EventLoggingGroup); + + QActionGroup* DepthGroup = new QActionGroup(this); + ui->actionQuickDecode->setActionGroup(DepthGroup); + ui->actionMediumDecode->setActionGroup(DepthGroup); + ui->actionDeepestDecode->setActionGroup(DepthGroup); + + QActionGroup* FT8CyclesGroup = new QActionGroup(this); + ui->actionDecFT8cycles1->setActionGroup(FT8CyclesGroup); + ui->actionDecFT8cycles2->setActionGroup(FT8CyclesGroup); + ui->actionDecFT8cycles3->setActionGroup(FT8CyclesGroup); + + QActionGroup* FT8RXfreqSensitivityGroup = new QActionGroup(this); + ui->actionRXfLow->setActionGroup(FT8RXfreqSensitivityGroup); + ui->actionRXfMedium->setActionGroup(FT8RXfreqSensitivityGroup); + ui->actionRXfHigh->setActionGroup(FT8RXfreqSensitivityGroup); + + QActionGroup* FT8DecoderSensitivityGroup = new QActionGroup(this); + ui->actionFT8SensMin->setActionGroup(FT8DecoderSensitivityGroup); + ui->actionlowFT8thresholds->setActionGroup(FT8DecoderSensitivityGroup); + ui->actionFT8subpass->setActionGroup(FT8DecoderSensitivityGroup); + + QActionGroup* FT8DecoderStartGroup = new QActionGroup(this); + ui->actionStartTwoStage->setActionGroup(FT8DecoderStartGroup); + ui->actionStartThreeStage->setActionGroup(FT8DecoderStartGroup); + ui->actionStartEarly->setActionGroup(FT8DecoderStartGroup); + ui->actionStartNormal->setActionGroup(FT8DecoderStartGroup); + ui->actionStartLate->setActionGroup(FT8DecoderStartGroup); + + QActionGroup* FT8threadsGroup = new QActionGroup(this); + ui->actionMTAuto->setActionGroup(FT8threadsGroup); + ui->actionMT1->setActionGroup(FT8threadsGroup); + ui->actionMT2->setActionGroup(FT8threadsGroup); + ui->actionMT3->setActionGroup(FT8threadsGroup); + ui->actionMT4->setActionGroup(FT8threadsGroup); + ui->actionMT5->setActionGroup(FT8threadsGroup); + ui->actionMT6->setActionGroup(FT8threadsGroup); + ui->actionMT7->setActionGroup(FT8threadsGroup); + ui->actionMT8->setActionGroup(FT8threadsGroup); + ui->actionMT9->setActionGroup(FT8threadsGroup); + ui->actionMT10->setActionGroup(FT8threadsGroup); + ui->actionMT11->setActionGroup(FT8threadsGroup); + ui->actionMT12->setActionGroup(FT8threadsGroup); + + connect (ui->download_samples_action, &QAction::triggered, [this] () { + if (!m_sampleDownloader) + { + m_sampleDownloader.reset (new SampleDownloader {m_settings, &m_config, &m_network_manager, this}); + } + m_sampleDownloader->show (); + }); + + connect (ui->view_phase_response_action, &QAction::triggered, [this] () { + if (!m_equalizationToolsDialog) + { + m_equalizationToolsDialog.reset (new EqualizationToolsDialog {m_settings, m_config.writeable_data_dir (), m_phaseEqCoefficients, this}); + connect (m_equalizationToolsDialog.data (), &EqualizationToolsDialog::phase_equalization_changed, + [this] (QVector<double> const& coeffs) { + m_phaseEqCoefficients = coeffs; + }); + } + m_equalizationToolsDialog->show (); + }); + + connect (&m_config.lotw_users (), &LotWUsers::LotW_users_error, this, [this] (QString const& reason) { + MessageBox::warning_message (this, tr ("Error Loading LotW Users Data"), reason); + }, Qt::QueuedConnection); + + QButtonGroup* txMsgButtonGroup = new QButtonGroup {this}; + txMsgButtonGroup->addButton(ui->txrb1,1); + txMsgButtonGroup->addButton(ui->txrb2,2); + txMsgButtonGroup->addButton(ui->txrb3,3); + txMsgButtonGroup->addButton(ui->txrb4,4); + txMsgButtonGroup->addButton(ui->txrb5,5); + txMsgButtonGroup->addButton(ui->txrb6,6); + set_dateTimeQSO(-1); + connect(txMsgButtonGroup,SIGNAL(buttonClicked(int)),SLOT(set_ntx(int))); + connect (ui->decodedTextBrowser, &DisplayText::selectCallsign, this, &MainWindow::doubleClickOnCall2); + connect (ui->decodedTextBrowser2, &DisplayText::selectCallsign, this, &MainWindow::doubleClickOnCall); + connect (ui->houndQueueTextBrowser, &DisplayText::selectCallsign, this, &MainWindow::doubleClickOnFoxQueue); + connect (ui->foxTxListTextBrowser, &DisplayText::selectCallsign, this, &MainWindow::doubleClickOnFoxInProgress); + connect (ui->decodedTextBrowser, &DisplayText::erased, this, &MainWindow::band_activity_cleared); + connect (ui->decodedTextBrowser2, &DisplayText::erased, this, &MainWindow::rx_frequency_activity_cleared); + connect (ui->decodedTextBrowser->horizontalScrollBar(),SIGNAL(sliderMoved(int)),SLOT(ScrollBarPosition(int))); + + // initialize decoded text font and hook up font change signals + // defer initialization until after construction otherwise menu fonts do not get set + // with 50 ms delay we are on the safe side + QTimer::singleShot (50, this, SLOT (initialize_fonts ())); + connect (&m_config, &Configuration::text_font_changed, [this] (QFont const& font) { + set_application_font (font); + }); + connect (&m_config, &Configuration::decoded_text_font_changed, [this] (QFont const& font) { + setDecodedTextFont (font); + }); + + setWindowTitle (program_title ()); + + connect(&proc_jt9, &QProcess::readyReadStandardOutput, this, &MainWindow::readFromStdout); +#if QT_VERSION < QT_VERSION_CHECK (5, 6, 0) + connect(&proc_jt9, static_cast<void (QProcess::*) (QProcess::ProcessError)> (&QProcess::error), + [this] (QProcess::ProcessError error) { + subProcessError (&proc_jt9, error); + }); +#else + connect(&proc_jt9, &QProcess::errorOccurred, [this] (QProcess::ProcessError error) { + subProcessError (&proc_jt9, error); + }); +#endif + connect(&proc_jt9, static_cast<void (QProcess::*) (int, QProcess::ExitStatus)> (&QProcess::finished), + [this] (int exitCode, QProcess::ExitStatus status) { + if (subProcessFailed (&proc_jt9, exitCode, status)) + { + m_valid = false; // ensures exit if still + // constructing + QTimer::singleShot (0, this, SLOT (close ())); + } + }); + connect(&p1, &QProcess::started, [this] () { + showStatusMessage (QString {"Started: %1 \"%2\""}.arg (p1.program ()).arg (p1.arguments ().join ("\" \""))); + }); + connect(&p1, &QProcess::readyReadStandardOutput, this, &MainWindow::p1ReadFromStdout); +#if QT_VERSION < QT_VERSION_CHECK (5, 6, 0) + connect(&p1, static_cast<void (QProcess::*) (QProcess::ProcessError)> (&QProcess::error), + [this] (QProcess::ProcessError error) { + subProcessError (&p1, error); + }); +#else + connect(&p1, &QProcess::errorOccurred, [this] (QProcess::ProcessError error) { + subProcessError (&p1, error); + }); +#endif + connect(&p1, static_cast<void (QProcess::*) (int, QProcess::ExitStatus)> (&QProcess::finished), + [this] (int exitCode, QProcess::ExitStatus status) { + if (subProcessFailed (&p1, exitCode, status)) + { + m_valid = false; // ensures exit if still + // constructing + QTimer::singleShot (0, this, SLOT (close ())); + } + }); + +#if QT_VERSION < QT_VERSION_CHECK (5, 6, 0) + connect(&p3, static_cast<void (QProcess::*) (QProcess::ProcessError)> (&QProcess::error), + [this] (QProcess::ProcessError error) { +#else + connect(&p3, &QProcess::errorOccurred, [this] (QProcess::ProcessError error) { +#endif +#if !defined(Q_OS_WIN) + if (QProcess::FailedToStart != error) +#else + if (QProcess::Crashed != error) +#endif + { + subProcessError (&p3, error); + } + }); + connect(&p3, &QProcess::started, [this] () { + showStatusMessage (QString {"Started: %1 \"%2\""}.arg (p3.program ()).arg (p3.arguments ().join ("\" \""))); + }); + connect(&p3, static_cast<void (QProcess::*) (int, QProcess::ExitStatus)> (&QProcess::finished), + [this] (int exitCode, QProcess::ExitStatus status) { +#if defined(Q_OS_WIN) + // We forgo detecting user_hardware failures with exit + // code 1 on Windows. This is because we use CMD.EXE to + // run the executable. CMD.EXE returns exit code 1 when it + // can't find the target executable. + if (exitCode != 1) // CMD.EXE couldn't find file to execute +#else + // We forgo detecting user_hardware failures with exit + // code 127 non-Windows. This is because we use /bin/sh to + // run the executable. /bin/sh returns exit code 127 when it + // can't find the target executable. + if (exitCode != 127) // /bin/sh couldn't find file to execute +#endif + { + subProcessFailed (&p3, exitCode, status); + } + }); + + // hook up save WAV file exit handling + connect (&m_saveWAVWatcher, &QFutureWatcher<QString>::finished, [this] { + // extract the promise from the future + auto const& result = m_saveWAVWatcher.future ().result (); + if (!result.isEmpty ()) // error + { + MessageBox::critical_message (this, tr("Error Writing WAV File"), result); + } + }); + + // Hook up working frequencies. + ui->bandComboBox->setModel (m_config.frequencies ()); + ui->bandComboBox->setModelColumn (FrequencyList_v2_101::frequency_mhz_column); + + // Enable live band combo box entry validation and action. + auto band_validator = new LiveFrequencyValidator {ui->bandComboBox + , m_config.bands () + , m_config.frequencies () + , &m_freqNominal + , m_config.kHz_without_k () + , this}; + ui->bandComboBox->setValidator (band_validator); + + // Hook up signals. + connect (band_validator, &LiveFrequencyValidator::valid, this, &MainWindow::band_changed); + connect (ui->bandComboBox->lineEdit (), &QLineEdit::textEdited, [this] (QString const&) {m_bandEdited = true;}); + + // hook up configuration signals + connect (&m_config, &Configuration::leavingSettings, this, &MainWindow::handle_leavingSettings); + connect (&m_config, &Configuration::transceiver_update, this, &MainWindow::handle_transceiver_update); + connect (&m_config, &Configuration::transceiver_TCIframesWritten, this, &MainWindow::dataSink); + connect (&m_config, &Configuration::transceiver_TCImodActive, this, &MainWindow::tci_mod_active); + connect (&m_config, &Configuration::transceiver_failure, this, &MainWindow::handle_transceiver_failure); + connect (&m_config, &Configuration::udp_server_changed, m_messageClient, &MessageClient::set_server); + connect (&m_config, &Configuration::udp_server_port_changed, m_messageClient, &MessageClient::set_server_port); + connect (&m_config, &Configuration::udp_TTL_changed, m_messageClient, &MessageClient::set_TTL); + connect (&m_config, &Configuration::accept_udp_requests_changed, m_messageClient, &MessageClient::enable); + connect (&m_config, &Configuration::enumerating_audio_devices, [this] () { + showStatusMessage (tr ("Enumerating audio devices")); + }); + + // set up configurations menu + connect (m_multi_settings, &MultiSettings::configurationNameChanged, [this] (QString const& name) { + if ("Default" != name) { + config_label.setText (name); + config_label.show (); + } + else { + config_label.hide (); + } + if (!programStart) { // set programStart to true for 2 seconds when changing Configurations + programStart = true; + QTimer::singleShot (2000, [=] {programStart=false;}); + } + statusUpdate (); +#if defined(Q_OS_WIN) + QTimer::singleShot (250, [=] { + setRig (m_lastMonitoredFrequency); // This is needed for Hamradio Deluxe + m_msk144basefreq = m_lastMonitoredFrequency; // This is needed for Hamradio Deluxe + }); +#endif + }); + m_multi_settings->create_menu_actions (this, ui->menuConfig); + m_configurations_button = m_rigErrorMessageBox.addButton (tr ("Configurations...") + , QMessageBox::ActionRole); + + // set up message text validators + ui->tx1->setValidator (new QRegExpValidator {message_alphabet, this}); + ui->tx2->setValidator (new QRegExpValidator {message_alphabet, this}); + ui->tx3->setValidator (new QRegExpValidator {message_alphabet, this}); + ui->tx4->setValidator (new QRegExpValidator {message_alphabet, this}); + ui->tx5->setValidator (new QRegExpValidator {message_alphabet, this}); + ui->tx6->setValidator (new QRegExpValidator {message_alphabet, this}); + + // Free text macros model to widget hook up. + ui->tx5->setModel (m_config.macros ()); + connect (ui->tx5->lineEdit(), &QLineEdit::editingFinished, + [this] () {on_tx5_currentTextChanged (ui->tx5->lineEdit()->text());}); + connect(&m_guiTimer, &QTimer::timeout, this, &MainWindow::guiUpdate); + m_guiTimer.start(100); //### Don't change the 100 ms! ### + + stopWRTimer.setSingleShot(true); + connect(&stopWRTimer, &QTimer::timeout, this, &MainWindow::stopWRTimeout); + + stopWCTimer.setSingleShot(true); + connect(&stopWCTimer, &QTimer::timeout, this, &MainWindow::stopWCTimeout); + + ptt0Timer.setSingleShot(true); + connect(&ptt0Timer, &QTimer::timeout, this, &MainWindow::stopTx2); + + ptt1Timer.setSingleShot(true); + connect(&ptt1Timer, &QTimer::timeout, this, &MainWindow::startTx2); + + p1Timer.setSingleShot(true); + connect(&p1Timer, &QTimer::timeout, this, &MainWindow::startP1); + + logQSOTimer.setSingleShot(true); + connect(&logQSOTimer, &QTimer::timeout, this, &MainWindow::on_logQSOButton_clicked); + + tuneButtonTimer.setSingleShot(true); + connect(&tuneButtonTimer, &QTimer::timeout, this, &MainWindow::end_tuning); + + tuneATU_Timer.setSingleShot(true); + connect(&tuneATU_Timer, &QTimer::timeout, this, &MainWindow::stopTuneATU); + + killFileTimer.setSingleShot(true); + connect(&killFileTimer, &QTimer::timeout, this, &MainWindow::killFile); + + uploadTimer.setSingleShot(true); + connect(&uploadTimer, &QTimer::timeout, [this] () {uploadWSPRSpots ();}); + + TxAgainTimer.setSingleShot(true); + connect(&TxAgainTimer, SIGNAL(timeout()), this, SLOT(TxAgain())); + + connect(m_wideGraph.data (), SIGNAL(setFreq3(int,int)),this, + SLOT(setFreq4(int,int))); + + decodeBusy(false); + + m_msg[0][0]=0; + + char const * const power[] = {"1 mW","2 mW","5 mW","10 mW","20 mW","50 mW","100 mW","200 mW","500 mW", + "1 W","2 W","5 W","10 W","20 W","50 W","100 W","200 W","500 W","1 kW"}; + for(auto i = 0u; i < sizeof power / sizeof power[0]; ++i) { //Initialize dBm values + auto dBm = int ((10. * i / 3.) + .5); + ui->TxPowerComboBox->addItem (QString {"%1 dBm %2"}.arg (dBm).arg (power[i]), dBm); + } + ui->respondComboBox->addItem("CQ: None"); + ui->respondComboBox->addItem("CQ: First"); + ui->respondComboBox->addItem("CQ: Max Dist"); + ui->respondComboBox->addItem("CQ: Max dB"); + ui->respondComboBox->addItem("CQ: Min dB"); + + m_dateTimeRcvdRR73=QDateTime::currentDateTimeUtc(); + m_dateTimeSentTx3=QDateTime::currentDateTimeUtc(); + + ui->labAz->setStyleSheet("border: 0px;"); + ui->labAz->setText(""); + auto t = "UTC dB DT Freq " + tr ("Message"); + ui->lh_decodes_headings_label->setText(t); + ui->rh_decodes_headings_label->setText(t); + readSettings(); //Restore user's setup parameters + if(m_mode=="Q65") { + m_score=0; + read_log(); + } + m_audioThread.start (m_audioThreadPriority); + +#ifdef WIN32 + if (!m_multiple) + { + while(true) + { + int iret=killbyname("jt9.exe"); + if(iret == 603) break; + if(iret != 0) + MessageBox::warning_message (this, tr ("Error Killing jt9.exe Process") + , tr ("KillByName return code: %1") + .arg (iret)); + } + } +#endif + + { + //delete any .quit file that might have been left lying around + //since its presence will cause jt9 to exit a soon as we start it + //and decodes will hang + QFile quitFile {m_config.temp_dir ().absoluteFilePath (".quit")}; + while (quitFile.exists ()) + { + if (!quitFile.remove ()) + { + MessageBox::query_message (this, tr ("Error removing \"%1\"").arg (quitFile.fileName ()) + , tr ("Click OK to retry")); + } + } + } + + to_jt9(0,0,0); //initialize IPC variables + + QStringList jt9_args { + "-s", QApplication::applicationName () // shared memory key, + // includes rig +#ifdef NDEBUG + , "-w", "1" //FFTW patience - release +#else + , "-w", "1" //FFTW patience - debug builds for speed +#endif + // The number of threads for FFTW specified here is chosen as + // three because that gives the best throughput of the large + // FFTs used in jt9. The count is the minimum of (the number + // available CPU threads less one) and three. This ensures that + // there is always at least one free CPU thread to run the other + // mode decoder in parallel. + , "-m", QString::number (qMin (qMax (QThread::idealThreadCount () - 1, 1), 3)) //FFTW threads + + , "-e", QDir::toNativeSeparators (m_appDir) + , "-a", QDir::toNativeSeparators (m_config.writeable_data_dir ().absolutePath ()) + , "-t", QDir::toNativeSeparators (m_config.temp_dir ().absolutePath ()) + }; + QProcessEnvironment new_env {m_env}; + new_env.insert ("OMP_STACKSIZE", "10M"); + proc_jt9.setProcessEnvironment (new_env); + proc_jt9.start(QDir::toNativeSeparators (m_appDir) + QDir::separator () + + "jt9", jt9_args, QIODevice::ReadWrite | QIODevice::Unbuffered); + + auto fname {QDir::toNativeSeparators(m_config.writeable_data_dir ().absoluteFilePath ("wsjtx_wisdom.dat"))}; + fftwf_import_wisdom_from_filename (fname.toLocal8Bit ()); + + m_ntx = 6; + ui->txrb6->setChecked(true); + + connect (&m_wav_future_watcher, &QFutureWatcher<void>::finished, this, &MainWindow::diskDat); + + connect(&watcher3, SIGNAL(finished()),this,SLOT(fast_decode_done())); + + m_tci = m_config.is_tci(); + m_tci_audio = (m_config.tci_audio() && m_config.is_tci()); + + if (!m_tci_audio) { + if (!m_config.audio_input_device ().isNull ()) + { + Q_EMIT startAudioInputStream (m_config.audio_input_device () + , m_rx_audio_buffer_frames + , m_detector, m_downSampleFactor, m_config.audio_input_channel ()); + } + if (!m_config.audio_output_device ().isNull ()) + { + Q_EMIT initializeAudioOutputStream (m_config.audio_output_device () + , AudioDevice::Mono == m_config.audio_output_channel () ? 1 : 2 + , m_tx_audio_buffer_frames); + } + Q_EMIT transmitFrequency (ui->TxFreqSpinBox->value () - m_XIT); + } + + enable_DXCC_entity (m_config.DXCC ()); // sets text window proportions and (re)inits the logbook + + // this must be done before initializing the mode as some modes need + // to turn off split on the rig e.g. WSPR + m_config.transceiver_online (); + bool vhf {m_config.enable_VHF_features ()}; + + ui->txFirstCheckBox->setChecked(m_txFirst); + morse_(const_cast<char *> (m_config.my_callsign ().toLatin1().constData()), + const_cast<int *> (icw), &m_ncw, (FCL)m_config.my_callsign().length()); + on_actionWide_Waterfall_triggered(); + ui->cbShMsgs->setChecked(m_bShMsgs); + ui->cbSWL->setChecked(m_bSWL); + if(m_bFast9) m_bFastMode=true; + ui->cbFast9->setChecked(m_bFast9 or m_bFastMode); + + set_mode (m_mode); + if(m_mode=="Echo") monitor(false); //Don't auto-start Monitor in Echo mode. + + // Ensure that the correct frequency is set and displayed + if(m_mode=="Echo") { + QTimer::singleShot (5000, [=] { + auto const& row = m_config.frequencies ()->best_working_frequency (m_freqNominal); + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0) on_bandComboBox_activated (row); + if (m_monitoring) ui->monitorButton->click(); + }); + } + + ui->sbSubmode->setValue (vhf ? m_nSubMode : 0); //Submodes require VHF features + + if(m_mode=="MSK144") { + if (m_tci_audio) { + QTimer::singleShot (5000, [=] { + if (ui->bandComboBox->currentText()!="OOB") { + Q_EMIT m_config.transceiver_trfrequency(1000.0); + } else { + rigFailure("TCI audio cannot be started as frequency is OOB"); + } + }); + } else { + Q_EMIT transmitFrequency (1000.0); + } + } else { + if (m_tci_audio) { + QTimer::singleShot (5000, [=] { + if (ui->bandComboBox->currentText()!="OOB") { + Q_EMIT m_config.transceiver_trfrequency(ui->TxFreqSpinBox->value () - m_XIT); + } else { + rigFailure("TCI audio cannot be started as frequency is OOB"); + } + }); + } else { + Q_EMIT transmitFrequency (ui->TxFreqSpinBox->value() - m_XIT); + } + } + + if(m_tci_audio) + { + QTimer::singleShot (5000, [=] { + int attVal = ui->outAttenuation->value(); + ui->outAttenuation->setValue(0); + ui->outAttenuation->setValue(attVal); + Q_EMIT m_config.transceiver_volume(m_config.volume()); + }); + } + + m_saveDecoded=ui->actionSave_decoded->isChecked(); + m_saveAll=ui->actionSave_all->isChecked(); + ui->TxPowerComboBox->setCurrentIndex(int(.3 * m_dBm + .2)); + ui->cbUploadWSPR_Spots->setChecked(m_uploadWSPRSpots); + if((m_ndepth&7)==1) ui->actionQuickDecode->setChecked(true); + if((m_ndepth&7)==2) ui->actionMediumDecode->setChecked(true); + if((m_ndepth&7)==3) ui->actionDeepestDecode->setChecked(true); + ui->actionInclude_averaging->setChecked(m_ndepth&16); + ui->actionInclude_correlation->setChecked(m_ndepth&32); + ui->actionEnable_AP_DXcall->setChecked(m_ndepth&64); + ui->actionAuto_Clear_Avg->setChecked(m_ndepth&128); + + m_UTCdisk=-1; + m_UTCdiskDateTime=QDateTime{}; // UTCDateTime of file being read from disk. + m_fCPUmskrtd=0.0; + m_bFastDone=false; + m_bAltV=false; + m_bNoMoreFiles=false; + m_bDoubleClicked=false; + m_bCallingCQ=false; + m_bCheckedContest=false; + m_bDisplayedOnce=false; + m_wait=0; + m_isort=-3; + m_max_dB=70; + m_CQtype="CQ"; + fixStop(); + VHF_features_enabled(m_config.enable_VHF_features()); + m_wideGraph->setVHF(m_config.enable_VHF_features()); + + connect( wsprNet, SIGNAL(uploadStatus(QString)), this, SLOT(uploadResponse(QString))); + + statusChanged(); + + m_fastGraph->setMode(m_mode); + m_wideGraph->setMode(m_mode); + + connect (&minuteTimer, &QTimer::timeout, this, &MainWindow::bandHoppingTimer); + connect (&minuteTimer, &QTimer::timeout, this, &MainWindow::on_the_minute); + connect (&minuteTimer, &QTimer::timeout, this, &MainWindow::invalidate_frequencies_filter); + + minuteTimer.setSingleShot (true); + minuteTimer.start (ms_minute_error () + 60 * 1000); + + connect (&splashTimer, &QTimer::timeout, this, &MainWindow::splash_done); + splashTimer.setSingleShot (true); + splashTimer.start (20 * 1000); + + if(QCoreApplication::applicationVersion().contains("-devel") or + QCoreApplication::applicationVersion().contains("-rc")) { +// QTimer::singleShot (0, this, SLOT (not_GA_warning_message ())); + } + + m_bMyCallStd=stdCall(m_config.my_callsign ()); //ft8md + m_bHisCallStd=stdCall(m_hisCall); //ft8md + + m_specOp=m_config.special_op_id(); + + // Starting in FT8 Hound mode needs this initialization + if (m_specOp==SpecOp::HOUND) { + on_ft8Button_clicked(); + QTimer::singleShot (50, [=] {ui->houndButton->click();}); + } + + ui->labDXped->setVisible(SpecOp::NONE != m_specOp); + ui->labDXped->setStyleSheet("QLabel {background-color: red; color: white;}"); + ui->pbBestSP->setVisible(m_mode=="FT4"); + + update_foxLogWindow_rate(); // update the rate on the window + check_button_color(); + read_txLog(); + read_ignoreList(); + read_ALLCALL7(); + if (ui->actionRemove_after_30days->isChecked ()) { + remove_old_files(m_config.save_directory().absolutePath(), 30); // remove saved audio files after 30 days + } + + QString jpleph = m_config.data_dir().absoluteFilePath("JPLEPH"); + jpl_setup_(const_cast<char *>(jpleph.toLocal8Bit().constData()),256); + +#ifdef WIN32 + // backup libhamlib-4.dll file, so it is still available after the next program update + QDir dataPath = QCoreApplication::applicationDirPath(); + QFile f {dataPath.absolutePath() + "/" + "libhamlib-4_old.dll"}; + if (!f.exists()) { + QFile::copy(dataPath.absolutePath() + "/" + "libhamlib-4.dll", dataPath.absolutePath() + "/" + "libhamlib-4_old.dll"); + QTimer::singleShot (5000, [=] { //wait until hamlib has been started + extern char* hamlib_version2; + QString hamlib = QString(QLatin1String(hamlib_version2)); + m_settings->beginGroup("Configuration"); + m_settings->setValue ("HamlibBackedUp", hamlib); + m_settings->endGroup(); + }); + } +#endif + + ui->sbToneSpacing->values({10, 15, 20, 25, 30}); + QTimer::singleShot (4000, [=] {programStart=false;}); + +// this must be the last statement of constructor + if (!m_valid) throw std::runtime_error {"Fatal initialization exception"}; +} + +void MainWindow::not_GA_warning_message () +{ + MessageBox::critical_message (this, + "This is a pre-release version of WSJT-X " + version (false) + " made\n" + "available for testing purposes. By design it will\n" + "be nonfunctional after Jan 15, 2025."); + auto now = QDateTime::currentDateTimeUtc (); + if (now >= QDateTime {{2025, 01, 15}, {23, 59, 59, 999}, Qt::UTC}) { + Q_EMIT finished (); + } +} + +void MainWindow::handle_leavingSettings () +{ + inSettings = false; +} + +void MainWindow::initialize_fonts () +{ + set_application_font (m_config.text_font ()); + setDecodedTextFont (m_config.decoded_text_font ()); +} + +void MainWindow::splash_done () +{ + m_splash && m_splash->close (); +} + +void MainWindow::invalidate_frequencies_filter () +{ + // every interval, invalidate the frequency filter, so that if any + // working frequency goes in/out of scope, we pick it up. + m_config.frequencies ()->filter_refresh (); + ui->bandComboBox->update (); +} + +void MainWindow::on_the_minute () +{ + if (minuteTimer.isSingleShot ()) + { + minuteTimer.setSingleShot (false); + minuteTimer.start (60 * 1000); // run free + } + else + { + auto const& ms_error = ms_minute_error (); + if (qAbs (ms_error) > 1000) // keep drift within +-1s + { + minuteTimer.setSingleShot (true); + minuteTimer.start (ms_error + 60 * 1000); + } + } + + if (m_config.watchdog () && m_mode!="WSPR" && m_mode!="FST4W") { + if (m_idleMinutes < m_config.watchdog ()) ++m_idleMinutes; + update_watchdog_label (); + } else { + tx_watchdog (false); + } + update_foxLogWindow_rate(); // update the rate on the window + if ((!verified && ui->labDXped->isVisible()) or !ui->labDXped->text().contains("Hound")) + ui->labDXped->setStyleSheet("QLabel {background-color: red; color: white;}"); + verified = false; + if(!m_transmitting && m_mode=="FT8" && (QDateTime::currentMSecsSinceEpoch()-m_mslastTX) > 120000) m_lapmyc=0; +} + +//--------------------------------------------------- MainWindow destructor +MainWindow::~MainWindow() +{ + if(m_astroWidget) m_astroWidget.reset (); + if(m_QSYMessageCreatorWidget) m_QSYMessageCreatorWidget.reset (); + if(m_QSYMessageWidget) m_QSYMessageWidget.reset (); + if(m_qsymonitorWidget) m_qsymonitorWidget.reset (); + auto fname {QDir::toNativeSeparators(m_config.writeable_data_dir ().absoluteFilePath ("wsjtx_wisdom.dat"))}; + fftwf_export_wisdom_to_filename (fname.toLocal8Bit ()); + m_audioThread.quit (); + m_audioThread.wait (); + remove_child_from_event_filter (this); + memset(ipc_qmap,0,4096); //Zero all of QMAP shared memory +} + +//-------------------------------------------------------- writeSettings() +void MainWindow::writeSettings() +{ + m_settings->beginGroup("MainWindow"); + if (ui->actionSWL_Mode->isChecked ()) + { + m_settings->setValue ("SWLView", true); + m_settings->setValue ("ShowMenus", ui->cbMenus->isChecked ()); + m_settings->setValue ("geometry", geometries ()[0]); + m_settings->setValue ("SWLModeGeometry", saveGeometry ()); + m_settings->setValue ("geometryNoControls", geometries ()[2]); + } + else + { + if (ui->cbMenus->isChecked()) + { + m_settings->setValue ("SWLView", ui->actionSWL_Mode->isChecked ()); + m_settings->setValue ("ShowMenus", true); + m_settings->setValue ("geometry", saveGeometry ()); + m_settings->setValue ("SWLModeGeometry", geometries ()[1]); + m_settings->setValue ("geometryNoControls", geometries ()[2]); + } + else + { + m_settings->setValue ("SWLView", ui->actionSWL_Mode->isChecked ()); + m_settings->setValue ("ShowMenus", false); + m_settings->setValue ("geometry", geometries ()[0]); + m_settings->setValue ("SWLModeGeometry", geometries ()[1]); + m_settings->setValue ("geometryNoControls", saveGeometry ()); + } + } + m_settings->setValue ("state", saveState ()); + m_settings->setValue("MRUdir", m_path); + m_settings->setValue("TxFirst",m_txFirst); + m_settings->setValue("DXcall",ui->dxCallEntry->text()); + m_settings->setValue("DXgrid",ui->dxGridEntry->text()); + m_settings->setValue("AstroDisplayed", m_astroWidget && m_astroWidget->isVisible()); + m_settings->setValue("MsgAvgDisplayed", m_msgAvgWidget && m_msgAvgWidget->isVisible ()); + m_settings->setValue("FoxLogDisplayed", m_foxLogWindow && m_foxLogWindow->isVisible ()); + m_settings->setValue("ContestLogDisplayed", m_contestLogWindow && m_contestLogWindow->isVisible ()); + m_settings->setValue("ActiveStationsDisplayed", m_ActiveStationsWidget && m_ActiveStationsWidget->isVisible ()); + m_settings->setValue("QSYMessageCreatorDisplayed", m_QSYMessageCreatorWidget && m_QSYMessageCreatorWidget->isVisible ()); + m_settings->setValue("ShowQSYMessages", ui->actionEnable_QSY_Popups->isChecked()); + m_settings->setValue("QSYMonitorDisplayed", m_qsymonitorWidget && m_qsymonitorWidget->isVisible ()); + m_settings->setValue("RespondCQ",ui->respondComboBox->currentIndex()); + m_settings->setValue("HoundSort",ui->comboBoxHoundSort->currentIndex()); + m_settings->setValue("FoxNlist",ui->sbNlist->value()); + m_settings->setValue("FoxNslots",m_Nslots0); + m_settings->setValue("SerialNumber",ui->sbSerialNumber->value ()); + m_settings->setValue("FoxTextMsg", m_freeTextMsg0); + m_settings->setValue("WorkDupes", ui->cbWorkDupes->isChecked()); + m_settings->endGroup(); + + // do this in the General group because we save the parameters from various places + if(m_mode=="JT9") { + m_settings->setValue("SubMode",ui->sbSubmode->value()); + m_settings->setValue("TRPeriod", ui->sbTR->value()); + } + if(m_mode=="MSK144") m_settings->setValue("ShMsgs_MSK144",m_bShMsgs); + if(m_mode=="Q65") m_settings->setValue("ShMsgs_Q65",m_bShMsgs); + if(m_mode=="JT65") m_settings->setValue("ShMsgs_JT65",m_bShMsgs); + if(m_mode=="JT4") m_settings->setValue("ShMsgs_JT4",m_bShMsgs); + + m_settings->beginGroup("Common"); + m_settings->setValue("Mode",m_mode); + m_settings->setValue("SaveNone",ui->actionNone->isChecked()); + m_settings->setValue("SaveDecoded",ui->actionSave_decoded->isChecked()); + m_settings->setValue("SaveAll",ui->actionSave_all->isChecked()); + m_settings->setValue("RemoveAudioFiles",ui->actionRemove_after_30days->isChecked()); + m_settings->setValue("NDepth",m_ndepth); + + //ft8md + m_settings->setValue ("MultithreadedFT8decoder",ui->actionUse_multithreaded_FT8_decoder->isChecked() ); + m_settings->setValue("NFT8Cycles",m_nFT8Cycles); + m_settings->setValue("NFT8QSORXfreqSensitivity",m_nFT8RXfSens); + m_settings->setValue("FT8threads",m_ft8threads); + m_settings->setValue("FT8Sensitivity",m_ft8Sensitivity); + m_settings->setValue("FT8DecoderStart",m_ft8DecoderStart); + m_settings->setValue("FT8WideDXCallSearch",m_FT8WideDxCallSearch); + m_settings->setValue("HideFT8Dupes",ui->actionHide_FT8_dupe_messages->isChecked()); + //ft8md + + m_settings->setValue("RxFreq",ui->RxFreqSpinBox->value()); + if(m_specOp!=SpecOp::FOX) m_settings->setValue("TxFreq",ui->TxFreqSpinBox->value()); + m_settings->setValue("TxFreqFox",m_TxFreqFox); + m_settings->setValue("WSPRfreq",ui->WSPRfreqSpinBox->value()); + m_settings->setValue("FST4W_RxFreq",ui->sbFST4W_RxFreq->value()); + m_settings->setValue("FST4W_FTol",ui->sbFST4W_FTol->value()); + m_settings->setValue("FST4_FLow",ui->sbF_Low->value()); + m_settings->setValue("FST4_FHigh",ui->sbF_High->value()); + m_settings->setValue("EchoToneSpacing",ui->sbToneSpacing->value()); + m_settings->setValue("EchoFixedTone",ui->rbFixedTone->isChecked()); + m_settings->setValue("EchoMessageRB",ui->rbEchoMessage->isChecked()); + m_settings->setValue("EchoCW",ui->rbEchoCW->isChecked()); + m_settings->setValue("EchoMessage",ui->leEchoMessage->text()); + m_settings->setValue("DTtol",m_DTtol); + m_settings->setValue("MinSync",m_minSync); + m_settings->setValue ("AutoSeq", ui->cbAutoSeq->isChecked ()); + m_settings->setValue ("RxAll", ui->cbRxAll->isChecked ()); +// m_settings->setValue("ShMsgs",m_bShMsgs); + m_settings->setValue("SWL",ui->cbSWL->isChecked()); + if(m_mode=="MSK144" && m_msk144basefreq > 0) { + m_settings->setValue ("DialFreq", QVariant::fromValue(m_msk144basefreq)); // MSK144 QSY + } else { + m_settings->setValue ("DialFreq", QVariant::fromValue(m_lastMonitoredFrequency)); + } + m_settings->setValue("SkedFreq",m_skedFreq); + m_settings->setValue("OutAttenuation", ui->outAttenuation->value ()); + m_settings->setValue("NoSuffix",m_noSuffix); + m_settings->setValue("GUItab",ui->tabWidget->currentIndex()); + m_settings->setValue("OutBufSize",outBufSize); + m_settings->setValue ("HoldTxFreq", ui->cbHoldTxFreq->isChecked ()); + m_settings->setValue ("CQonly", ui->cbCQonly->isChecked ()); + m_settings->setValue ("BypassFilters", ui->cbBypass->isChecked ()); + m_settings->setValue("PctTx", ui->sbTxPercent->value ()); + m_settings->setValue("RoundRobin",ui->RoundRobin->currentText()); + m_settings->setValue("dBm",m_dBm); + m_settings->setValue("RR73",m_send_RR73); + m_settings->setValue ("WSPRPreferType1", ui->WSPR_prefer_type_1_check_box->isChecked ()); + m_settings->setValue("UploadSpots",m_uploadWSPRSpots); + m_settings->setValue("NoOwnCall",ui->cbNoOwnCall->isChecked()); + m_settings->setValue ("BandHopping", ui->band_hopping_group_box->isChecked ()); + m_settings->setValue ("MaxDrift", ui->sbMaxDrift->value()); + m_settings->setValue ("TRPeriod_FST4W", ui->sbTR_FST4W->value ()); + m_settings->setValue("FastMode",m_bFastMode); + m_settings->setValue("Fast9",m_bFast9); + m_settings->setValue ("CQTxfreq", ui->sbCQTxFreq->value ()); + m_settings->setValue("pwrBandTxMemory",m_pwrBandTxMemory); + m_settings->setValue("pwrBandTuneMemory",m_pwrBandTuneMemory); + m_settings->setValue ("FT8AP", ui->actionEnable_AP_FT8->isChecked ()); + m_settings->setValue ("JT65AP", ui->actionEnable_AP_JT65->isChecked ()); + m_settings->setValue ("AutoClearAvg", ui->actionAuto_Clear_Avg->isChecked ()); + m_settings->setValue ("DisableClicksOnWaterfall", ui->actionDisable_clicks_on_waterfall->isChecked ()); + m_settings->setValue("SplitterState",ui->decodes_splitter->saveState()); + m_settings->setValue("Blanker",ui->sbNB->value()); + m_settings->setValue("Score",m_score); + m_settings->setValue("labDXpedText",ui->labDXped->text()); + m_settings->setValue("EchoAvg",ui->sbEchoAvg->value()); + { + QList<QVariant> coeffs; // suitable for QSettings + for (auto const& coeff : m_phaseEqCoefficients) + { + coeffs << coeff; + } + m_settings->setValue ("PhaseEqualizationCoefficients", QVariant {coeffs}); + } + m_settings->setValue ("bh_160m", ui->cb160m->isChecked() ); + m_settings->setValue ("bh_80m", ui->cb80m->isChecked() ); + m_settings->setValue ("bh_60m", ui->cb60m->isChecked() ); + m_settings->setValue ("bh_40m", ui->cb40m->isChecked() ); + m_settings->setValue ("bh_30m", ui->cb30m->isChecked() ); + m_settings->setValue ("bh_20m", ui->cb20m->isChecked() ); + m_settings->setValue ("bh_17m", ui->cb17m->isChecked() ); + m_settings->setValue ("bh_15m", ui->cb15m->isChecked() ); + m_settings->setValue ("bh_12m", ui->cb12m->isChecked() ); + m_settings->setValue ("bh_10m", ui->cb10m->isChecked() ); + m_settings->setValue ("bh_6m", ui->cb6m->isChecked() ); + m_settings->setValue ("bh_4m", ui->cb4m->isChecked() ); + m_settings->setValue ("bh_2m", ui->cb2m->isChecked() ); + m_settings->setValue ("bh_70cm", ui->cb70cm->isChecked() ); + m_settings->setValue ("bh_2mMSK", ui->cb2mMSK->isChecked() ); + m_settings->setValue ("bh_80mFT4", ui->cb80mFT4->isChecked() ); + m_settings->setValue ("bh_40mFT4", ui->cb40mFT4->isChecked() ); + m_settings->setValue ("bh_30mFT4", ui->cb30mFT4->isChecked() ); + m_settings->setValue ("bh_20mFT4", ui->cb20mFT4->isChecked() ); + m_settings->setValue ("bh_17mFT4", ui->cb17mFT4->isChecked() ); + m_settings->setValue ("bh_15mFT4", ui->cb15mFT4->isChecked() ); + m_settings->setValue ("bh_12mFT4", ui->cb12mFT4->isChecked() ); + m_settings->setValue ("bh_10mFT4", ui->cb10mFT4->isChecked() ); + m_settings->setValue ("bh_QRG1", ui->cbQRG1->isChecked() ); + m_settings->setValue ("bh_QRG2", ui->cbQRG2->isChecked() ); + m_settings->setValue ("bh_QRG3", ui->cbQRG3->isChecked() ); + m_settings->setValue ("bh_QRG4", ui->cbQRG4->isChecked() ); + m_settings->setValue ("bh_QRG5", ui->cbQRG5->isChecked() ); + m_settings->setValue ("bh_QRG6", ui->cbQRG6->isChecked() ); + m_settings->setValue ("bh_QRG7", ui->cbQRG7->isChecked() ); + m_settings->setValue ("bh_QRG8", ui->cbQRG8->isChecked() ); + m_settings->setValue ("QRG1", ui->sbQRG1->value ()); + m_settings->setValue ("QRG2", ui->sbQRG2->value ()); + m_settings->setValue ("QRG3", ui->sbQRG3->value ()); + m_settings->setValue ("QRG4", ui->sbQRG4->value ()); + m_settings->setValue ("QRG5", ui->sbQRG5->value ()); + m_settings->setValue ("QRG6", ui->sbQRG6->value ()); + m_settings->setValue ("QRG7", ui->sbQRG7->value ()); + m_settings->setValue ("QRG8", ui->sbQRG8->value ()); + m_settings->setValue ("reduceFalseDecodes", ui->actionReduce_false_decodes->isChecked() ); + m_settings->setValue ("HideAPInfo", ui->actionHide_AP_info->isChecked() ); + m_settings->setValue ("FullDuplexMode", ui->actionFull_Duplex_Mode->isChecked() ); + m_settings->setValue ("actionDontSplitALLTXT", ui->actionDon_t_split_ALL_TXT->isChecked() ); + m_settings->setValue ("splitAllTxtYearly", ui->actionSplit_ALL_TXT_yearly->isChecked() ); + m_settings->setValue ("splitAllTxtMonthly", ui->actionSplit_ALL_TXT_monthly->isChecked() ); + m_settings->setValue ("disableWritingOfAllTxt", ui->actionDisable_writing_of_ALL_TXT->isChecked() ); + m_settings->setValue ("DisableEventLogging", ui->actionDisable_event_logging->isChecked() ); + m_settings->setValue ("DarkStyle", ui->actionUse_Dark_Style->isChecked() ); + m_settings->setValue ("BandButtons", ui->actionBand_Buttons->isChecked() ); + m_settings->setValue ("VHFUHFButtons", ui->actionVHF_UHF_Buttons->isChecked() ); + m_settings->setValue ("tx1State", ui->tx1->isEnabled() ); + m_settings->setValue ("HighlightB4", ui->actionHighlightB4->isChecked() ); + m_settings->setValue ("HighlightToday", ui->actionHighlightToday->isChecked() ); + m_settings->setValue ("HighlightIgnored", ui->actionHighlightIgnored->isChecked() ); + m_settings->setValue ("HideB4", ui->actionHideB4->isChecked() ); + m_settings->setValue ("HideToday", ui->actionHideToday->isChecked() ); + m_settings->setValue ("HideIgnored", ui->actionHideIgnored->isChecked() ); + m_settings->setValue ("IgnoreB4", ui->actionIgnoreB4->isChecked() ); + m_settings->setValue ("IgnoreToday", ui->actionIgnoreToday->isChecked() ); + m_settings->setValue ("IgnoreIgnored", ui->actionIgnoreIgnored->isChecked() ); + m_settings->setValue ("HideTerritory1", ui->actionHideTerritory1->isChecked() ); + m_settings->setValue ("HideTerritory2", ui->actionHideTerritory2->isChecked() ); + m_settings->setValue ("HideTerritory3", ui->actionHideTerritory3->isChecked() ); + m_settings->setValue ("HideTerritory4", ui->actionHideTerritory4->isChecked() ); + m_settings->setValue ("HighlightTerritory1", ui->actionHighlightTerritory1->isChecked() ); + m_settings->setValue ("HighlightTerritory2", ui->actionHighlightTerritory2->isChecked() ); + m_settings->setValue ("HighlightTerritory3", ui->actionHighlightTerritory3->isChecked() ); + m_settings->setValue ("HighlightTerritory4", ui->actionHighlightTerritory4->isChecked() ); + m_settings->setValue ("HideEU", ui->actionHideEU->isChecked() ); + m_settings->setValue ("HideNA", ui->actionHideNA->isChecked() ); + m_settings->setValue ("HideSA", ui->actionHideSA->isChecked() ); + m_settings->setValue ("HideAS", ui->actionHideAS->isChecked() ); + m_settings->setValue ("HideAF", ui->actionHideAF->isChecked() ); + m_settings->setValue ("HideOC", ui->actionHideOC->isChecked() ); + m_settings->setValue ("HideAN", ui->actionHideAN->isChecked() ); + m_settings->setValue ("HighlightWhitelistEntries", ui->actionHighlight_Whitelist_entries->isChecked() ); + m_settings->endGroup(); +} + +void MainWindow::update_tx5(const QString &qsy_text) +{ + if (m_hisCall=="") { + QMessageBox::warning(this, "WSJT-X","There must be a callsign in the\n DX Call Box to send QSY Request"); + } else { + QString text = qsy_text; + ui->tx6->setText(text.replace("$DX",m_hisCall)); + ui->txb6->click(); + stopWRTimer.stop(); + if(!m_auto) { + ui->autoButton->click(); + stopWRTimer.start(int(1750.0*m_TRperiod)); + } + } +} + +void MainWindow::reply_tx5(const QString &qsy_reply) +{ + ui->tx6->setText(qsy_reply); + ui->txb6->click(); + stopWRTimer.stop(); + if(!m_auto) ui->autoButton->click(); + stopWRTimer.start(int(1750.0*m_TRperiod)); +} + +void MainWindow::setQSYMessageCreatorStatus(const bool &QSYMessageCreatorValue) +{ + m_QSYMessageCreatorValue = QSYMessageCreatorValue; +} + +//---------------------------------------------------------- readSettings() +void MainWindow::readSettings() +{ + ui->cbAutoSeq->setVisible(false); + ui->respondComboBox->setVisible(false); + + m_settings->beginGroup("MainWindow"); + std::array<QByteArray, 3> the_geometries; + the_geometries[0] = m_settings->value ("geometry", saveGeometry ()).toByteArray (); + the_geometries[1] = m_settings->value ("SWLModeGeometry", saveGeometry ()).toByteArray (); + the_geometries[2] = m_settings->value ("geometryNoControls", saveGeometry ()).toByteArray (); + auto SWL_mode = m_settings->value ("SWLView", false).toBool (); + auto show_menus = m_settings->value ("ShowMenus", true).toBool (); + ui->actionSWL_Mode->setChecked (SWL_mode); + ui->cbMenus->setChecked (show_menus); + auto current_view_mode = SWL_mode ? 1 : show_menus ? 0 : 2; + change_layout (current_view_mode); + geometries (current_view_mode, the_geometries); + restoreState (m_settings->value ("state", saveState ()).toByteArray ()); + ui->dxCallEntry->setText (m_settings->value ("DXcall", QString {}).toString ()); + ui->dxGridEntry->setText (m_settings->value ("DXgrid", QString {}).toString ()); + m_path = m_settings->value("MRUdir", m_config.save_directory ().absolutePath ()).toString (); + m_txFirst = m_settings->value("TxFirst",false).toBool(); + auto displayAstro = m_settings->value ("AstroDisplayed", false).toBool (); + auto displayMsgAvg = m_settings->value ("MsgAvgDisplayed", false).toBool (); + auto displayFoxLog = m_settings->value ("FoxLogDisplayed", false).toBool (); + auto displayContestLog = m_settings->value ("ContestLogDisplayed", false).toBool (); + bool displayActiveStations = m_settings->value ("ActiveStationsDisplayed", false).toBool (); + bool displayQSYMessageCreator = m_settings->value ("QSYMessageCreatorDisplayed", false).toBool (); + bool displayQSYMonitor = m_settings->value("QSYMonitorDisplayed", false).toBool (); + bool enableQSYpopups = m_settings->value("ShowQSYMessages", true).toBool (); + ui->respondComboBox->setCurrentIndex(m_settings->value("RespondCQ",0).toInt()); + ui->comboBoxHoundSort->setCurrentIndex(m_settings->value("HoundSort",3).toInt()); + ui->sbNlist->setValue(m_settings->value("FoxNlist",12).toInt()); + m_Nslots=m_settings->value("FoxNslots",3).toInt(); + m_Nslots0=m_Nslots; + if(!m_config.superFox()) ui->sbNslots->setValue(m_Nslots); + ui->sbSerialNumber->setValue (m_settings->value ("SerialNumber", 1).toInt ()); + m_freeTextMsg0=m_settings->value("FoxTextMsg","").toString(); + m_freeTextMsg=m_freeTextMsg0; + ui->cbWorkDupes->setChecked(m_settings->value("WorkDupes",false).toBool()); + m_settings->endGroup(); + + m_settings->beginGroup("Common"); + m_mode=m_settings->value("Mode","FT8").toString(); + m_settings->endGroup(); + + // do this outside of settings group because it uses groups internally + ui->actionAstronomical_data->setChecked (displayAstro); + ui->actionEnable_QSY_Popups->setChecked (enableQSYpopups); + + // do this in the General group because we save the parameters from various places + if(m_mode=="JT9") { + blocked=true; + m_nSubMode=m_settings->value("SubMode",0).toInt(); + ui->sbSubmode->setValue(m_nSubMode); + ui->sbFtol->setValue (m_settings->value("Ftol_JT9", 50).toInt()); + ui->sbTR->setValue (m_settings->value ("TRPeriod", 15).toInt()); + QTimer::singleShot (50, [=] {blocked = false;}); + } + if (m_mode=="FT8") { + ui->sbFtol->setValue (m_settings->value("Ftol_SF", 50).toInt()); + } + if (m_mode=="Q65") { + m_nSubMode=m_settings->value("SubMode_Q65",0).toInt(); + ui->sbSubmode->setValue(m_nSubMode); + ui->sbFtol->setValue (m_settings->value("Ftol_Q65", 50).toInt()); + ui->sbTR->setValue (m_settings->value ("TRPeriod_Q65", 30).toInt()); + } + if (m_mode=="JT65") { + m_nSubMode=m_settings->value("SubMode_JT65",0).toInt(); + ui->sbSubmode->setValue(m_nSubMode); + ui->sbFtol->setValue (m_settings->value("Ftol_JT65", 50).toInt()); + } + if (m_mode=="JT4") { + m_nSubMode=m_settings->value("SubMode_JT4",0).toInt(); + ui->sbSubmode->setValue(m_nSubMode); + ui->sbFtol->setValue (m_settings->value("Ftol_JT4", 50).toInt()); + ui->sbTR->setValue (m_settings->value ("TRPeriod_FST4", 60).toInt()); + } + if (m_mode=="MSK144") { + ui->sbFtol->setValue (m_settings->value("Ftol_MSK144",50).toInt()); + m_msk144_tr2=m_settings->value ("TRPeriod_MSK144_2m", 30).toInt(); + m_msk144_tr6=m_settings->value ("TRPeriod_MSK144_6m", 15).toInt(); + m_msk144_tr=m_settings->value ("TRPeriod_MSK144", 30).toInt(); + QTimer::singleShot (3000, [=] { + if (m_currentBand=="2m") ui->sbTR->setValue (m_msk144_tr2); + else if (m_currentBand=="6m" or m_currentBand=="4m") ui->sbTR->setValue (m_msk144_tr6); + else ui->sbTR->setValue (m_msk144_tr); + }); + } + if (m_mode=="MSK144") m_bShMsgs=m_settings->value("ShMsgs_MSK144",false).toBool(); + if (m_mode=="Q65") m_bShMsgs=m_settings->value("ShMsgs_Q65",false).toBool(); + if (m_mode=="JT65") m_bShMsgs=m_settings->value("ShMsgs_JT65",false).toBool(); + if (m_mode=="JT4") m_bShMsgs=m_settings->value("ShMsgs_JT4",false).toBool(); + + m_settings->beginGroup("Common"); + ui->cb160m->setChecked(m_settings->value("bh_160m", false).toBool()); + ui->cb80m->setChecked(m_settings->value("bh_80m", false).toBool()); + ui->cb60m->setChecked(m_settings->value("bh_60m", false).toBool()); + ui->cb40m->setChecked(m_settings->value("bh_40m", false).toBool()); + ui->cb30m->setChecked(m_settings->value("bh_30m", false).toBool()); + ui->cb20m->setChecked(m_settings->value("bh_20m", false).toBool()); + ui->cb17m->setChecked(m_settings->value("bh_17m", false).toBool()); + ui->cb15m->setChecked(m_settings->value("bh_15m", false).toBool()); + ui->cb12m->setChecked(m_settings->value("bh_12m", false).toBool()); + ui->cb10m->setChecked(m_settings->value("bh_10m", false).toBool()); + ui->cb6m->setChecked(m_settings->value("bh_6m", false).toBool()); + ui->cb4m->setChecked(m_settings->value("bh_4m", false).toBool()); + ui->cb2m->setChecked(m_settings->value("bh_2m", false).toBool()); + ui->cb70cm->setChecked(m_settings->value("bh_70cm", false).toBool()); + ui->cb2mMSK->setChecked(m_settings->value("bh_2mMSK", false).toBool()); + ui->cb80mFT4->setChecked(m_settings->value("bh_80mFT4", false).toBool()); + ui->cb40mFT4->setChecked(m_settings->value("bh_40mFT4", false).toBool()); + ui->cb30mFT4->setChecked(m_settings->value("bh_30mFT4", false).toBool()); + ui->cb20mFT4->setChecked(m_settings->value("bh_20mFT4", false).toBool()); + ui->cb17mFT4->setChecked(m_settings->value("bh_17mFT4", false).toBool()); + ui->cb15mFT4->setChecked(m_settings->value("bh_15mFT4", false).toBool()); + ui->cb12mFT4->setChecked(m_settings->value("bh_12mFT4", false).toBool()); + ui->cb10mFT4->setChecked(m_settings->value("bh_10mFT4", false).toBool()); + ui->cbQRG1->setChecked(m_settings->value("bh_QRG1", false).toBool()); + ui->cbQRG2->setChecked(m_settings->value("bh_QRG2", false).toBool()); + ui->cbQRG3->setChecked(m_settings->value("bh_QRG3", false).toBool()); + ui->cbQRG4->setChecked(m_settings->value("bh_QRG4", false).toBool()); + ui->cbQRG5->setChecked(m_settings->value("bh_QRG5", false).toBool()); + ui->cbQRG6->setChecked(m_settings->value("bh_QRG6", false).toBool()); + ui->cbQRG7->setChecked(m_settings->value("bh_QRG7", false).toBool()); + ui->cbQRG8->setChecked(m_settings->value("bh_QRG8", false).toBool()); + ui->sbQRG1->setValue (m_settings->value ("QRG1", 3567).toInt ()); + ui->sbQRG2->setValue (m_settings->value ("QRG2", 7056).toInt ()); + ui->sbQRG3->setValue (m_settings->value ("QRG3", 10131).toInt ()); + ui->sbQRG4->setValue (m_settings->value ("QRG4", 14090).toInt ()); + ui->sbQRG5->setValue (m_settings->value ("QRG5", 18095).toInt ()); + ui->sbQRG6->setValue (m_settings->value ("QRG6", 21091).toInt ()); + ui->sbQRG7->setValue (m_settings->value ("QRG7", 24911).toInt ()); + ui->sbQRG8->setValue (m_settings->value ("QRG8", 28091).toInt ()); + ui->actionReduce_false_decodes->setChecked(m_settings->value("reduceFalseDecodes", false).toBool()); + ui->actionHide_AP_info->setChecked(m_settings->value("HideAPInfo", false).toBool()); + ui->actionFull_Duplex_Mode->setChecked(m_settings->value("FullDuplexMode", false).toBool()); + ui->labDXped->setText(m_settings->value("labDXpedText",QString {}).toString ()); + ui->actionDon_t_split_ALL_TXT->setChecked(m_settings->value("actionDontSplitALLTXT", true).toBool()); + ui->actionSplit_ALL_TXT_yearly->setChecked(m_settings->value("splitAllTxtYearly", false).toBool()); + ui->actionSplit_ALL_TXT_monthly->setChecked(m_settings->value("splitAllTxtMonthly", false).toBool()); + ui->actionDisable_writing_of_ALL_TXT->setChecked(m_settings->value("disableWritingOfAllTxt", false).toBool()); + ui->actionDisable_event_logging->setChecked(m_settings->value("DisableEventLogging", false).toBool()); + ui->actionUse_Dark_Style->setChecked(m_settings->value("DarkStyle", false).toBool()); + ui->actionBand_Buttons->setChecked(m_settings->value("BandButtons", true).toBool()); + ui->actionVHF_UHF_Buttons->setChecked(m_settings->value("VHFUHFButtons", false).toBool()); + ui->tx1->setEnabled(m_settings->value("tx1State", true).toBool()); + ui->actionHighlightB4->setChecked(m_settings->value("HighlightB4", false).toBool()); + ui->actionHighlightToday->setChecked(m_settings->value("HighlightToday", false).toBool()); + ui->actionHighlightIgnored->setChecked(m_settings->value("HighlightIgnored", false).toBool()); + ui->actionHideB4->setChecked(m_settings->value("HideB4", false).toBool()); + ui->actionHideToday->setChecked(m_settings->value("HideToday", false).toBool()); + ui->actionHideIgnored->setChecked(m_settings->value("HideIgnored", false).toBool()); + ui->actionIgnoreB4->setChecked(m_settings->value("IgnoreB4", false).toBool()); + ui->actionIgnoreToday->setChecked(m_settings->value("IgnoreToday", false).toBool()); + ui->actionIgnoreIgnored->setChecked(m_settings->value("IgnoreIgnored", false).toBool()); + ui->actionHideTerritory1->setChecked(m_settings->value("HideTerritory1", false).toBool()); + ui->actionHideTerritory2->setChecked(m_settings->value("HideTerritory2", false).toBool()); + ui->actionHideTerritory3->setChecked(m_settings->value("HideTerritory3", false).toBool()); + ui->actionHideTerritory4->setChecked(m_settings->value("HideTerritory4", false).toBool()); + ui->actionHighlightTerritory1->setChecked(m_settings->value("HighlightTerritory1", false).toBool()); + ui->actionHighlightTerritory2->setChecked(m_settings->value("HighlightTerritory2", false).toBool()); + ui->actionHighlightTerritory3->setChecked(m_settings->value("HighlightTerritory3", false).toBool()); + ui->actionHighlightTerritory4->setChecked(m_settings->value("HighlightTerritory4", false).toBool()); + ui->actionHideEU->setChecked(m_settings->value("HideEU", false).toBool()); + ui->actionHideNA->setChecked(m_settings->value("HideNA", false).toBool()); + ui->actionHideSA->setChecked(m_settings->value("HideSA", false).toBool()); + ui->actionHideAS->setChecked(m_settings->value("HideAS", false).toBool()); + ui->actionHideAF->setChecked(m_settings->value("HideAF", false).toBool()); + ui->actionHideOC->setChecked(m_settings->value("HideOC", false).toBool()); + ui->actionHideAN->setChecked(m_settings->value("HideAN", false).toBool()); + ui->actionHighlight_Whitelist_entries->setChecked(m_settings->value("HighlightWhitelistEntries", false).toBool()); +// m_mode=m_settings->value("Mode","FT8").toString(); + ui->actionNone->setChecked(m_settings->value("SaveNone",true).toBool()); + ui->actionSave_decoded->setChecked(m_settings->value("SaveDecoded",false).toBool()); + ui->actionSave_all->setChecked(m_settings->value("SaveAll",false).toBool()); + ui->actionRemove_after_30days->setChecked(m_settings->value("RemoveAudioFiles",false).toBool()); + ui->RxFreqSpinBox->setValue(0); // ensure a change is signaled + ui->RxFreqSpinBox->setValue(m_settings->value("RxFreq",1500).toInt()); + ui->sbFST4W_RxFreq->setValue(0); + ui->sbFST4W_RxFreq->setValue(m_settings->value("FST4W_RxFreq",1500).toInt()); + ui->sbF_Low->setValue(m_settings->value("FST4_FLow",600).toInt()); + ui->sbF_High->setValue(m_settings->value("FST4_FHigh",1400).toInt()); + ui->sbFST4W_FTol->setValue(m_settings->value("FST4W_FTol",100).toInt()); + ui->sbToneSpacing->setValue(m_settings->value("EchoToneSpacing",10).toInt()); + ui->rbFixedTone->setChecked(m_settings->value("EchoFixedTone",true).toBool()); + ui->rbEchoMessage->setChecked(m_settings->value("EchoMessageRB",false).toBool()); + ui->rbEchoCW->setChecked(m_settings->value("EchoCW",false).toBool()); + ui->leEchoMessage->setText(m_settings->value("EchoMessage",QString {}).toString()); + m_minSync=m_settings->value("MinSync",0).toInt(); + ui->syncSpinBox->setValue(m_minSync); + ui->cbAutoSeq->setChecked (m_settings->value ("AutoSeq", false).toBool()); + ui->cbRxAll->setChecked (m_settings->value ("RxAll", false).toBool()); +// m_bShMsgs=m_settings->value("ShMsgs",false).toBool(); + m_bSWL=m_settings->value("SWL",false).toBool(); + m_bFast9=m_settings->value("Fast9",false).toBool(); + m_bFastMode=m_settings->value("FastMode",false).toBool(); + ui->sbMaxDrift->setValue (m_settings->value ("MaxDrift",0).toInt()); + ui->sbTR_FST4W->setValue (m_settings->value ("TRPeriod_FST4W", 15).toInt()); + m_lastMonitoredFrequency = m_settings->value ("DialFreq", + QVariant::fromValue<Frequency> (default_frequency)).value<Frequency> (); + m_skedFreq=m_settings->value("SkedFreq",1296.065).toDouble(); + QTimer::singleShot (1000, [=] {if (m_astroWidget) m_astroWidget->setSkedFreq(m_skedFreq);}); + if(m_mode=="MSK144") m_msk144basefreq = m_lastMonitoredFrequency; // MSK144 QSY + ui->WSPRfreqSpinBox->setValue(0); // ensure a change is signaled + ui->WSPRfreqSpinBox->setValue(m_settings->value("WSPRfreq",1500).toInt()); + ui->TxFreqSpinBox->setValue(0); // ensure a change is signaled + if(m_specOp!=SpecOp::FOX) ui->TxFreqSpinBox->setValue(m_settings->value("TxFreq",1500).toInt()); + m_TxFreqFox=m_settings->value("TxFreqFox",300).toInt(); + if(m_specOp==SpecOp::FOX && !m_config.superFox()) ui->TxFreqSpinBox->setValue(m_TxFreqFox); + m_ndepth=m_settings->value("NDepth",3).toInt(); + + //ft8md + ui->actionUse_multithreaded_FT8_decoder->setChecked(m_settings->value("MultithreadedFT8decoder", false).toBool()); + m_multithreadFT8 = ui->actionUse_multithreaded_FT8_decoder->isChecked(); + dec_data.params.lmultift8 = m_multithreadFT8; + + m_nFT8Cycles=m_settings->value("NFT8Cycles",3).toInt(); if(!(m_nFT8Cycles>=1 && m_nFT8Cycles<=3)) m_nFT8Cycles=3; + if(m_nFT8Cycles==1) ui->actionDecFT8cycles1->setChecked(true); + else if(m_nFT8Cycles==2) ui->actionDecFT8cycles2->setChecked(true); + else if(m_nFT8Cycles==3) ui->actionDecFT8cycles3->setChecked(true); + + m_nFT8RXfSens=m_settings->value("NFT8QSORXfreqSensitivity",3).toInt(); if(!(m_nFT8RXfSens>=1 && m_nFT8RXfSens<=3)) m_nFT8RXfSens=3; + if(m_nFT8RXfSens==1) ui->actionRXfLow->setChecked(true); + else if(m_nFT8RXfSens==2) ui->actionRXfMedium->setChecked(true); + else if(m_nFT8RXfSens==3) ui->actionRXfHigh->setChecked(true); + + m_ft8threads=m_settings->value("FT8threads",0).toInt(); + if(!(m_ft8threads>=0 && m_ft8threads<25)) m_ft8threads=0; + if(m_ft8threads==0) ui->actionMTAuto->setChecked(true); + else if(m_ft8threads==1) ui->actionMT1->setChecked(true); + else if(m_ft8threads==2) ui->actionMT2->setChecked(true); + else if(m_ft8threads==3) ui->actionMT3->setChecked(true); + else if(m_ft8threads==4) ui->actionMT4->setChecked(true); + else if(m_ft8threads==5) ui->actionMT5->setChecked(true); + else if(m_ft8threads==6) ui->actionMT6->setChecked(true); + else if(m_ft8threads==7) ui->actionMT7->setChecked(true); + else if(m_ft8threads==8) ui->actionMT8->setChecked(true); + else if(m_ft8threads==9) ui->actionMT9->setChecked(true); + else if(m_ft8threads==10) ui->actionMT10->setChecked(true); + else if(m_ft8threads==11) ui->actionMT11->setChecked(true); + else if(m_ft8threads==12) ui->actionMT12->setChecked(true); + qDebug() << "m_ft8threads is " << m_ft8threads; + dec_data.params.nmt = m_ft8threads; + + ui->actionHide_FT8_dupe_messages->setChecked(m_settings->value("HideFT8Dupes",true).toBool()); + + m_ft8Sensitivity=m_settings->value("FT8Sensitivity",3).toInt(); + if(!(m_ft8Sensitivity>0 && m_ft8Sensitivity<=3)) m_ft8Sensitivity=3; + if(m_ft8Sensitivity==1) ui->actionFT8SensMin->setChecked(true); + else if(m_ft8Sensitivity==2) ui->actionlowFT8thresholds->setChecked(true); + else if(m_ft8Sensitivity==3) ui->actionFT8subpass->setChecked(true); + + m_ft8DecoderStart=m_settings->value("FT8DecoderStart",3).toInt(); + if(!(m_ft8DecoderStart>=0 && m_ft8DecoderStart<=4)) m_ft8DecoderStart=3; + if(m_ft8DecoderStart==0) ui->actionStartTwoStage->setChecked(true); + else if(m_ft8DecoderStart==1) ui->actionStartThreeStage->setChecked(true); + else if(m_ft8DecoderStart==2) ui->actionStartEarly->setChecked(true); + else if(m_ft8DecoderStart==3) ui->actionStartNormal->setChecked(true); + else if(m_ft8DecoderStart==4) ui->actionStartLate->setChecked(true); + + m_FT8WideDxCallSearch=m_settings->value("FT8WideDXCallSearch",true).toBool(); + ui->actionFT8WidebandDXCallSearch->setChecked(m_FT8WideDxCallSearch); + //ft8md + + ui->sbTxPercent->setValue (m_settings->value ("PctTx", 20).toInt ()); + on_sbTxPercent_valueChanged (ui->sbTxPercent->value ()); + ui->RoundRobin->setCurrentText(m_settings->value("RoundRobin",tr("Random")).toString()); + m_dBm=m_settings->value("dBm",37).toInt(); + m_send_RR73=m_settings->value("RR73",false).toBool(); + m_score=m_settings->value("Score",0).toInt(); + if(m_send_RR73) { + m_send_RR73=false; + on_txrb4_doubleClicked(); + } + ui->WSPR_prefer_type_1_check_box->setChecked (m_settings->value ("WSPRPreferType1", true).toBool ()); + m_uploadWSPRSpots=m_settings->value("UploadSpots",false).toBool(); + ui->cbNoOwnCall->setChecked(m_settings->value("NoOwnCall",false).toBool()); + ui->band_hopping_group_box->setChecked (m_settings->value ("BandHopping", false).toBool()); + // setup initial value of tx attenuator + m_block_pwr_tooltip = true; + ui->outAttenuation->setValue (m_settings->value ("OutAttenuation", 0).toInt ()); + m_block_pwr_tooltip = false; + ui->sbCQTxFreq->setValue (m_settings->value ("CQTxFreq", 260).toInt()); + m_noSuffix=m_settings->value("NoSuffix",false).toBool(); + int n=m_settings->value("GUItab",0).toInt(); + if (SpecOp::FOX==m_specOp) { + ui->tabWidget->setCurrentIndex(n); + } else { + // We need this to initialize the height of tab 1 correctly + ui->pbFreeText->setVisible(false); + ui->cbSendMsg->setVisible(false); + ui->tabWidget->setCurrentIndex(1); + ui->tabWidget->setCurrentIndex(n); + } + outBufSize=m_settings->value("OutBufSize",4096).toInt(); + ui->cbHoldTxFreq->setChecked (m_settings->value ("HoldTxFreq", false).toBool ()); + HoldTxFreqStatus = m_settings->value ("HoldTxFreq", false).toBool (); + ui->cbCQonly->setChecked (m_settings->value ("CQonly", false).toBool ()); + ui->cbBypass->setChecked (m_settings->value ("BypassFilters", false).toBool ()); + m_pwrBandTxMemory=m_settings->value("pwrBandTxMemory").toHash(); + m_pwrBandTuneMemory=m_settings->value("pwrBandTuneMemory").toHash(); + ui->actionEnable_AP_FT8->setChecked (m_settings->value ("FT8AP", false).toBool()); + ui->actionEnable_AP_JT65->setChecked (m_settings->value ("JT65AP", false).toBool()); + ui->actionAuto_Clear_Avg->setChecked (m_settings->value ("AutoClearAvg", false).toBool()); + ui->actionDisable_clicks_on_waterfall->setChecked (m_settings->value ("DisableClicksOnWaterfall", false).toBool()); + ui->decodes_splitter->restoreState(m_settings->value("SplitterState").toByteArray()); + ui->sbNB->setValue(m_settings->value("Blanker",0).toInt()); + ui->sbEchoAvg->setValue(m_settings->value("EchoAvg",10).toInt()); + { + auto const& coeffs = m_settings->value ("PhaseEqualizationCoefficients" + , QList<QVariant> {0., 0., 0., 0., 0.}).toList (); + m_phaseEqCoefficients.clear (); + for (auto const& coeff : coeffs) + { + m_phaseEqCoefficients.append (coeff.value<double> ()); + } + } + m_settings->endGroup(); + + // use these initialisation settings to tune the audio o/p buffer + // size and audio thread priority + m_settings->beginGroup ("Tune"); + m_audioThreadPriority = static_cast<QThread::Priority> (m_settings->value ("Audio/ThreadPriority", QThread::TimeCriticalPriority).toInt () % 8); + m_settings->endGroup (); + + m_specOp=m_config.special_op_id(); + checkMSK144ContestType(); + if (displayMsgAvg) on_actionMessage_averaging_triggered(); + if (displayFoxLog) on_fox_log_action_triggered (); + if (displayContestLog) on_contest_log_action_triggered (); + if (displayActiveStations) on_actionActiveStations_triggered(); + if (displayQSYMessageCreator) on_actionQSYMessage_Creator_triggered(); + if (displayQSYMonitor) on_actionQSY_Monitor_triggered(); + +#ifdef WIN32 + if (m_config.alert_Enabled()) { // testing and initializing the default audio device for playing audible alerts + QAudioOutput info(QAudioDeviceInfo::defaultOutputDevice()); + QString audioPath = QCoreApplication::applicationDirPath() + "/sounds" + m_config.voicesPath() + "/"; + QAudioFormat format; + format.setCodec("audio/pcm"); + format.setSampleRate (48000); + format.setChannelCount (1); + format.setSampleSize (16); + format.setSampleType(QAudioFormat::SignedInt); + QAudioOutput* audio; + audio = new QAudioOutput(format, this); + QFile *effect = new QFile(this); + effect->setFileName(QString("%1/%2").arg(audioPath, "Testing.wav")); + effect->open(QIODevice::ReadOnly); + audio->start(effect); + } +#endif +} + +void MainWindow::checkMSK144ContestType() +{ + if(SpecOp::NONE != m_specOp) + { + if(m_mode=="MSK144" && SpecOp::EU_VHF < m_specOp) + { + MessageBox::warning_message (this, tr ("Improper mode"), + "Mode will be changed to FT8. MSK144 not available if Fox, Hound, Field Day, FT Roundup, WW Digi. or ARRL Digi contest is selected."); + on_actionFT8_triggered(); + } + } +} + +void MainWindow::set_application_font (QFont const& font) +{ + // check if dark style is enabled, this check is also effective during the program start + if (ui->actionUse_Dark_Style->isChecked()) { + QFile f(":qdarkstyle/style.qss"); + if (!f.exists()) { + printf("Unable to set stylesheet, file not found\n"); + } else { + qApp->setFont (font); + QString ss; + f.open(QFile::ReadOnly | QFile::Text); + QTextStream ts(&f); + qApp->setStyleSheet(ts.readAll() + "* {" + font_as_stylesheet (font) + '}'); + m_useDarkStyle = true; + m_wideGraph->setDarkStyle(m_useDarkStyle); + check_button_color(); + ui->tabWidget->setTabShape(QTabWidget::Rounded); + } + } else { + m_useDarkStyle = false; + m_wideGraph->setDarkStyle(m_useDarkStyle); + check_button_color(); + ui->tabWidget->setTabShape(QTabWidget::Triangular); + qApp->setFont (font); + // set font in the application style sheet as well in case it has + // been modified in the style sheet which has priority + QString ss; + if (qApp->styleSheet ().size ()) { + auto sheet = qApp->styleSheet (); + sheet.remove ("file:///"); + QFile sf {sheet}; + if (sf.open (QFile::ReadOnly | QFile::Text)) + { + QString tmp = sf.readAll(); + if (tmp != NULL) ss = sf.readAll () + tmp; + else qDebug() << "tmp==NULL at sf.readAll"; + } + } + qApp->setStyleSheet (ss + "* {" + font_as_stylesheet (font) + '}'); + } + + // ensure a balanced layout + qreal pointSize = m_config.text_font().pointSizeF(); + if (m_config.PWR_and_SWR()) { + ui->label->setMinimumWidth (2.8*pointSize + 8); + ui->label->setAlignment(Qt::AlignCenter); + ui->outAttenuation->setMinimumWidth (2.8*pointSize + 8); + } + if (pointSize < 11) { +// ui->tabWidget->setMaximumHeight(210); // UR for AL + if (ui->actionUse_Dark_Style->isChecked()) { +// ui->tabWidget->setMaximumHeight(225); // UR for normal + widescreen + ui->houndButton->setMinimumWidth(50); // UR for normal + widescreen + ui->ft8Button->setMinimumWidth(50); // UR for normal + widescreen + ui->ft4Button->setMinimumWidth(50); // UR for normal + widescreen + ui->msk144Button->setMinimumWidth(50); // UR for normal + widescreen + ui->q65Button->setMinimumWidth(50); // UR for normal + widescreen + ui->jt65Button->setMinimumWidth(50); // UR for normal + widescreen + } else { +// ui->tabWidget->setMaximumHeight(225); // UR for normal + widescreen + ui->houndButton->setMaximumWidth(40); // UR for normal + widescreen + ui->ft8Button->setMaximumWidth(40); // UR for normal + widescreen + ui->ft4Button->setMaximumWidth(40); // UR for normal + widescreen + ui->msk144Button->setMaximumWidth(40); // UR for normal + widescreen + ui->q65Button->setMaximumWidth(40); // UR for normal + widescreen + ui->jt65Button->setMaximumWidth(40); // UR for normal + widescreen + ui->houndButton->setMinimumWidth(0); // UR for normal + widescreen + ui->ft8Button->setMinimumWidth(0); // UR for normal + widescreen + ui->ft4Button->setMinimumWidth(0); // UR for normal + widescreen + ui->msk144Button->setMinimumWidth(0); // UR for normal + widescreen + ui->q65Button->setMinimumWidth(0); // UR for normal + widescreen + ui->jt65Button->setMinimumWidth(0); // UR for normal + widescreen + } + } else { +// ui->tabWidget->setMaximumHeight(255); // UR for AL +// ui->tabWidget->setMaximumHeight(500); // UR for normal + widescreen + ui->houndButton->setMinimumWidth(50); // UR for normal + widescreen + ui->ft8Button->setMinimumWidth(50); // UR for normal + widescreen + ui->ft4Button->setMinimumWidth(50); // UR for normal + widescreen + ui->msk144Button->setMinimumWidth(50); // UR for normal + widescreen + ui->q65Button->setMinimumWidth(50); // UR for normal + widescreen + ui->jt65Button->setMinimumWidth(50); // UR for normal + widescreen + } + if (m_config.largerTabWidget()) ui->tabWidget->setMaximumHeight(1000); + for (auto& widget : qApp->topLevelWidgets ()) + { + widget->updateGeometry (); + } +} + +void MainWindow::setDecodedTextFont (QFont const& font) +{ + ui->decodedTextBrowser->setContentFont (font); + ui->decodedTextBrowser2->setContentFont (font); + ui->houndQueueTextBrowser->setContentFont(font); + ui->houndQueueTextBrowser->displayHoundToBeCalled(" "); + ui->houndQueueTextBrowser->setText(""); + + ui->foxTxListTextBrowser->setContentFont(font); + ui->foxTxListTextBrowser->displayHoundToBeCalled(" "); + ui->foxTxListTextBrowser->setText(""); + + auto style_sheet = "QLabel {" + font_as_stylesheet (font) + '}'; + ui->lh_decodes_headings_label->setStyleSheet (ui->lh_decodes_headings_label->styleSheet () + style_sheet); + ui->rh_decodes_headings_label->setStyleSheet (ui->rh_decodes_headings_label->styleSheet () + style_sheet); + if (m_msgAvgWidget) { + m_msgAvgWidget->changeFont (font); + } + if (m_foxLogWindow) { + m_foxLogWindow->set_log_view_font (font); + } + if (m_contestLogWindow) { + m_contestLogWindow->set_log_view_font (font); + m_contestLogWindow->set_nQSO(m_logBook.contest_log()->n_qso()); + } + if(m_ActiveStationsWidget != NULL) { + m_ActiveStationsWidget->changeFont(font); + } + updateGeometry (); +} + +void MainWindow::fixStop() +{ + m_hsymStop=179; + if(m_mode=="WSPR") { + m_hsymStop=396; + } else if(m_mode=="Echo") { + m_hsymStop=9; + } else if (m_mode=="JT4"){ + m_hsymStop=176; + if(m_config.decode_at_52s()) m_hsymStop=179; + } else if (m_mode=="JT9"){ + m_hsymStop=173; + if(m_config.decode_at_52s()) m_hsymStop=179; + } else if (m_mode=="JT65"){ + m_hsymStop=174; + if(m_config.decode_at_52s()) m_hsymStop=179; + } else if (m_mode=="Q65"){ + m_hsymStop=48; // 13.8 s +// if(m_TRperiod==15 && m_config.decode_at_52s()) m_hsymStop=50; // 14.1 s for Q65-15 EME + if(m_TRperiod==30) { + m_hsymStop=96; // 27.6 s + if(m_config.decode_at_52s()) m_hsymStop=100; // 28.8 s + } + if(m_TRperiod==60) m_hsymStop=196; // 56.4 s + if(m_TRperiod==120) m_hsymStop=408; // 117.5 s + if(m_TRperiod==300) m_hsymStop=1030; // 296.6 s + } else if (m_mode=="FreqCal"){ + m_hsymStop=((int(m_TRperiod/0.288))/8)*8; + } else if (m_mode=="FT8") { + if (m_multithreadFT8 && !(m_specOp==SpecOp::HOUND && m_config.superFox())) { + if (m_ft8DecoderStart==0) m_hsymStop=49; + else if (m_ft8DecoderStart==1) { + m_hsymStop=50; + m_earlyDecode2=46; + } + else if (m_ft8DecoderStart==2) m_hsymStop=48; + else if (m_ft8DecoderStart==3) m_hsymStop=49; + else if (m_ft8DecoderStart==4) m_hsymStop=50; + } else { + m_hsymStop=50; + m_earlyDecode2=47; + } + } else if (m_mode=="FT4") { + m_hsymStop=21; + } else if(m_mode=="FST4" or m_mode=="FST4W") { + int stop[] = {39,85,187,387,1003,3107,6232}; + int stop_EME[] = {48,95,197,396,1012,3107,6232}; + int i=0; + if(m_TRperiod==30) i=1; + if(m_TRperiod==60) i=2; + if(m_TRperiod==120) i=3; + if(m_TRperiod==300) i=4; + if(m_TRperiod==900) i=5; + if(m_TRperiod==1800) i=6; + if(m_config.decode_at_52s()) { + m_hsymStop=stop_EME[i]; + } else { + m_hsymStop=stop[i]; + } + } +} + +//-------------------------------------------------------------- dataSink() +void MainWindow::dataSink(qint64 frames) +{ + static float s[NSMAX]; + char line[80]; + int k(frames); + auto fname {QDir::toNativeSeparators(m_config.writeable_data_dir ().absoluteFilePath ("refspec.dat")).toLocal8Bit ()}; + + if(m_diskData) { + dec_data.params.ndiskdat=1; + } else { + dec_data.params.ndiskdat=0; + m_wideGraph->setDiskUTC(-1); + } + + m_bUseRef=m_wideGraph->useRef(); + if(!m_diskData) { + refspectrum_(&dec_data.d2[k-m_nsps/2],&m_bClearRefSpec,&m_bRefSpec, + &m_bUseRef, fname.constData (), (FCL)fname.size ()); + } + m_bClearRefSpec=false; + + if(m_mode=="MSK144" or m_bFast9) { + fastSink(frames); + if(m_bFastMode) return; + } + +// Get power, spectrum, and ihsym + dec_data.params.nfa=m_wideGraph->nStartFreq(); + dec_data.params.nfb=m_wideGraph->Fmax(); + if(m_mode=="FST4") { + dec_data.params.nfa=ui->sbF_Low->value(); + dec_data.params.nfb=ui->sbF_High->value(); + } + int nsps=m_nsps; + if(m_bFastMode) nsps=6912; + int nsmo=m_wideGraph->smoothYellow()-1; + bool bLowSidelobes=m_config.lowSidelobes(); + int npct=0; + if(m_mode.startsWith("FST4")) npct=ui->sbNB->value(); + symspec_(&dec_data,&k,&nsps,&m_inGain,&bLowSidelobes,&nsmo,&m_px,s, + &m_df3,&m_ihsym,&m_npts8,&m_pxmax,&npct); + if(m_mode=="WSPR" or m_mode=="FST4W") wspr_downsample_(dec_data.d2,&k); + if(m_ihsym <=0) return; + if(ui) ui->signal_meter_widget->setValue(m_px,m_pxmax); // Update thermometer + if(m_monitoring || m_diskData) { + m_wideGraph->dataSink2(s,m_df3,m_ihsym,m_diskData,m_px); + } + if(m_mode=="MSK144") return; + + fixStop(); + if (m_mode == "FreqCal" + // only calculate after 1st chunk, also skip chunk where rig + // changed frequency + && !(m_ihsym % 8) && m_ihsym > 8 && m_ihsym <= m_hsymStop) { + int RxFreq=ui->RxFreqSpinBox->value (); + int nkhz=(m_freqNominal+RxFreq)/1000; + int ftol = ui->sbFtol->value (); + freqcal_(&dec_data.d2[0], &k, &nkhz, &RxFreq, &ftol, &line[0], (FCL)80); + QString t=QString::fromLatin1(line); + DecodedText decodedtext {t}; + ui->decodedTextBrowser->displayDecodedText (decodedtext, m_config.my_callsign(), + m_mode, m_config.DXCC(), m_logBook, m_currentBand, m_config.ppfx()); + if (ui->measure_check_box->isChecked ()) { + // Append results text to file "fmt.all". + QFile f {m_config.writeable_data_dir ().absoluteFilePath ("fmt.all")}; + if (f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append)) { + QTextStream out(&f); + out << t +#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0) + << Qt::endl +#else + << endl +#endif + ; + f.close(); + } else { + MessageBox::warning_message (this, tr ("File Open Error") + , tr ("Cannot open \"%1\" for append: %2") + .arg (f.fileName ()).arg (f.errorString ())); + } + } + if(m_ihsym==m_hsymStop && ui->actionFrequency_calibration->isChecked()) { + freqCalStep(); + } + if(m_position != 0) ui->decodedTextBrowser->horizontalScrollBar()->setValue(m_position); + } + + if(m_ihsym==3*m_hsymStop/4) { + m_dialFreqRxWSPR=m_freqNominal; + } + + if(m_mode=="FT8") { + to_jt9(m_ihsym,-1,-1); //Allow jt9 to bail out early, if necessary + if(m_ihsym==40 and m_decoderBusy) { + qDebug() << "Clearing hung decoder status"; + decodeDone(); //Clear a hung decoder status + } + } + + // ft8md + static QDateTime last {QDateTime::currentDateTimeUtc().addSecs(-300)}; // ft8md + static bool lastdelayed {false}; // ft8md + + if (m_mode=="FT8" && m_multithreadFT8) { + if(m_diskData) m_delay=0; + + int ihsymdelay=0; + if(m_delay > 0) { + float fdelta=float(m_delay)*0.345; // 1/(0.29*10) + if(fmod(fdelta,1.0)>0.49) ihsymdelay=qCeil(fdelta)+m_ihsym; + else ihsymdelay=qFloor(fdelta)+m_ihsym; + } + //cycling approximately once per 269..301 milliseconds + if((m_delay==0 && m_ihsym == m_hsymStop) + || (m_delay > 0 && ihsymdelay >= m_hsymStop)) { + QDateTime now = QDateTime::currentDateTimeUtc(); + //prevent dupe decoding + if(lastdelayed && !m_modeChanged) { + if(last.secsTo(now)<12) { + lastdelayed=false; + return; + } + lastdelayed=false; + } + if(m_delay>0) lastdelayed=true; + } + } + // end of ft8md + + bool bCallDecoder=false; + + if(m_multithreadFT8 && m_ft8DecoderStart==1) m_earlyDecode2 = 46; // ft8md + + if(m_ihsym==m_hsymStop) bCallDecoder=true; + if(m_mode=="FT8" && !m_diskData && !(m_multithreadFT8 && m_ft8DecoderStart>1)) { //ft8md Try to call MTD two times when "Very early" has been selected + if(m_ihsym==m_earlyDecode) bCallDecoder=true; + if(m_ihsym==m_earlyDecode2 && !(m_multithreadFT8 && m_ft8DecoderStart!=1)) bCallDecoder=true; + } + + if(bCallDecoder) { + if(m_mode=="Echo") { + float dBerr=0.0; + int nfrit=0; + if(m_astroWidget) nfrit=m_astroWidget->nfRIT(); + int nauto=0; + if(m_auto) nauto=1; + int nqual=0; + float f1=1500.0 + m_fDither; + float xlevel=0.0; + float sigdb=0.0; + float dfreq=0.0; + float width=m_fSpread; + echocom_.nclearave=m_nclearave; + int nDop=m_fAudioShift; + if(m_astroWidget && m_astroWidget->DopplerMethod()==2) nDop=0; //Using CFOM + int nDopTotal=m_fDop; + int navg=ui->sbEchoAvg->value(); + int ndf=0; + int idir=1; + if(!ui->rbFixedTone->isChecked() and !m_diskData) { + ndf=ui->sbToneSpacing->value(); + save_echo_params_(&nDopTotal,&nDop,&nfrit,&f1,&width,&ndf,&itone[0],dec_data.d2,&idir); + } + if(m_diskData) { + idir=-1; + save_echo_params_(&nDopTotal,&nDop,&nfrit,&f1,&width,&ndf,&itone[0],dec_data.d2,&idir); + if(ndf==0 and ui->rbEchoMessage->isChecked()) ui->rbFixedTone->setChecked(true); + } + + bool bEchoCall=ui->rbEchoMessage->isChecked(); + QString txcall=ui->leEchoMessage->text(); + static char crxcall[7]; + avecho_(dec_data.d2,&nDop,&nfrit,&nauto,&ndf,&navg,&nqual,&f1,&xlevel,&sigdb, + &dBerr,&dfreq,&width,&m_diskData,&bEchoCall,txcall.toLatin1().constData(), + &crxcall[0],(FCL)6,(FCL)6); + crxcall[6]=0; + QString rxcall {QString::fromLatin1(crxcall)}; + + //Don't restart Monitor after an Echo transmission + if(m_bEchoTxed and !m_auto) { + monitor(false); + m_bEchoTxed=false; + } + + if(m_monitoring or m_auto or m_diskData) { + QString t0,t1; + if(m_diskData) { + t0=t0.asprintf("%06d ",m_UTCdisk); + } else { + QDateTime now=QDateTime::currentDateTimeUtc(); + int ihr=now.toString("hh").toInt(); + int imin=now.toString("mm").toInt(); + int isec=now.toString("ss").toInt(); + if(m_auto) isec=isec - isec%6; + if(!m_auto) isec=isec - isec%3; + t0=t0.asprintf("%02d%02d%02d ",ihr,imin,isec); + t1=now.toString("yyMMdd_"); + } + int n=t0.toInt(); + int nsec=((n/10000)*3600) + (((n/100)%100)*60) + (n%100); + if(!m_echoRunning or echocom_.nsum<2) m_echoSec0=nsec; + float hour=n/10000 + ((n/100)%100)/60.0 + (n%100)/3600.0; + m_echoRunning=true; + if(ndf<0 or ndf>30) ndf=0; + QString t; + t = t.asprintf("%7.4f %5.2f %7d %7.1f %5d %5d %6d %6.1f %7.1f %3d",hour,xlevel, + nDopTotal,width,echocom_.nsum,nqual,qRound(dfreq),sigdb,dBerr,ndf); + t = t0 + t + " " + rxcall; + if(!bEchoCall) t=t.left(78); + if(ui) ui->decodedTextBrowser->insertText(t); + t=t1 + t; + write_all("Rx",t); + if(m_position != 0) ui->decodedTextBrowser->horizontalScrollBar()->setValue(m_position); + } + + if(m_echoGraph->isVisible()) m_echoGraph->plotSpec(); + if(m_saveAll and !m_diskData) { + if(ui->rbEchoMessage->isChecked()) ndf=ui->sbToneSpacing->value(); + int idir=1; + save_echo_params_(&m_fDop,&nDop,&nfrit,&f1,&width,&ndf,&itone[0],dec_data.d2,&idir); + m_fSpread=width; + } + m_nclearave=0; + } + + if(m_mode=="FreqCal") return; + + if(m_dialFreqRxWSPR==0) m_dialFreqRxWSPR=m_freqNominal; + m_dataAvailable=true; + dec_data.params.npts8=(m_ihsym*m_nsps)/16; + dec_data.params.newdat=1; + dec_data.params.nagain=0; + dec_data.params.nagainfil=0; + dec_data.params.nzhsym=m_hsymStop; + if(m_mode=="FT8" and m_ihsym==m_earlyDecode and !m_diskData && !(m_multithreadFT8 && m_ft8DecoderStart>1)) dec_data.params.nzhsym=m_earlyDecode; + if(m_mode=="FT8" and m_ihsym==m_earlyDecode2 and !m_diskData && !(m_multithreadFT8 && m_ft8DecoderStart!=1)) dec_data.params.nzhsym=m_earlyDecode2; + QDateTime now {QDateTime::currentDateTimeUtc ()}; + m_dateTime = now.toString ("yyyy-MMM-dd hh:mm"); + if(m_mode!="WSPR") { + if (m_mode=="FT8" && m_multithreadFT8 && m_ihsym>47) last=now; // ft8md + decode(); //Start decoder + } + + if(m_mode=="FT8" and !(m_diskData or (m_multithreadFT8 && m_ft8DecoderStart<2)) and (m_ihsym==m_earlyDecode or m_ihsym==m_earlyDecode2)) return; + if (!m_diskData) + { + if (!(m_mode=="FT8" && m_multithreadFT8)) Q_EMIT reset_audio_input_stream (true); // reports dropped samples + } + if(!m_diskData and (m_saveAll or m_saveDecoded or m_mode=="WSPR")) { + //Always save unless "Save None"; may delete later + if(m_TRperiod < 60) { + int n=fmod(double(now.time().second()),m_TRperiod); + if(n<(m_TRperiod/2)) n=n+m_TRperiod; + if(m_mode=="Echo") n+=3; + auto const& period_start=now.addSecs(-n); + m_fnameWE=m_config.save_directory().absoluteFilePath (period_start.toString("yyMMdd_hhmmss")); + } else { + auto const& period_start = now.addSecs (-(now.time ().minute () % (int(m_TRperiod) / 60)) * 60); + m_fnameWE=m_config.save_directory ().absoluteFilePath (period_start.toString ("yyMMdd_hhmm")); + } + int samples=m_TRperiod*12000; + if(m_mode=="FT4") samples=21*3456; + // the following is potential a threading hazard - not a good + // idea to pass pointer to be processed in another thread + m_saveWAVWatcher.setFuture (QtConcurrent::run (std::bind (&MainWindow::save_wave_file, + this, m_fnameWE, &dec_data.d2[0], samples, m_config.my_callsign(), + m_config.my_grid(), m_mode, m_nSubMode, m_freqNominalPeriod, m_hisCall, m_hisGrid))); + if (m_mode=="WSPR") { + auto c2name {(m_fnameWE + ".c2").toLocal8Bit ()}; + int nsec=120; + int nbfo=1500; + double f0m1500=m_freqNominal/1000000.0 + nbfo - 1500; + int err = savec2_(c2name.constData (),&nsec,&f0m1500, (FCL)c2name.size()); + if (err!=0) MessageBox::warning_message (this, tr ("Error saving c2 file"), c2name); + } + } + if(m_mode=="WSPR") { + QStringList t2; + QStringList depth_args; + t2 << "-f" << QString {"%1"}.arg (m_dialFreqRxWSPR / 1e6, 0, 'f', 6); + if((m_ndepth&7)==1) depth_args << "-qB"; //2 pass w subtract, no Block detection, no shift jittering + if((m_ndepth&7)==2) depth_args << "-C" << "500" << "-o" << "4"; //3 pass, subtract, Block detection, OSD + if((m_ndepth&7)==3) depth_args << "-C" << "500" << "-o" << "4" << "-d"; //3 pass, subtract, Block detect, OSD, more candidates + QStringList degrade; + degrade << "-d" << QString {"%1"}.arg (m_config.degrade(), 4, 'f', 1); + m_cmndP1.clear (); + if(m_diskData) { + m_cmndP1 << depth_args << "-a" + << QDir::toNativeSeparators (m_config.writeable_data_dir ().absolutePath()) << m_path; + } else { + m_cmndP1 << depth_args << "-a" + << QDir::toNativeSeparators (m_config.writeable_data_dir ().absolutePath()) + << t2 << m_fnameWE + ".wav"; + } + if (ui) ui->DecodeButton->setChecked (true); + p1Timer.start(1000); + m_decoderBusy = true; + statusUpdate (); + } + m_rxDone=true; + } +} + +void MainWindow::startP1() +{ + p1.start (QDir::toNativeSeparators (QDir {QApplication::applicationDirPath ()}.absoluteFilePath ("wsprd")), m_cmndP1); +} + +QString MainWindow::save_wave_file (QString const& name, short const * data, int samples, + QString const& my_callsign, QString const& my_grid, QString const& mode, qint32 sub_mode, + Frequency frequency, QString const& his_call, QString const& his_grid) const +{ + // + // This member function runs in a thread and should not access + // members that may be changed in the GUI thread or any other thread + // without suitable synchronization. + // + QAudioFormat format; + format.setCodec ("audio/pcm"); + format.setSampleRate (12000); + format.setChannelCount (1); + format.setSampleSize (16); + format.setSampleType (QAudioFormat::SignedInt); + auto source = QString {"%1; %2"}.arg (my_callsign).arg (my_grid); + auto comment = QString {"Mode=%1%2; Freq=%3%4"} + .arg (mode) + .arg (QString {(mode.contains ('J') && !mode.contains ('+')) + || mode.startsWith ("FST4") || mode.startsWith ('Q') + ? QString {"; Sub Mode="} + QString::number (int (samples / 12000)) + QChar {'A' + sub_mode} + : QString {}}) + .arg (Radio::frequency_MHz_string (frequency)) + .arg (QString {mode!="WSPR" ? QString {"; DXCall=%1; DXGrid=%2"} + .arg (his_call) + .arg (his_grid).toLocal8Bit () : ""}); + BWFFile::InfoDictionary list_info { + {{{'I','S','R','C'}}, source.toLocal8Bit ()}, + {{{'I','S','F','T'}}, program_title (revision ()).simplified ().toLocal8Bit ()}, + {{{'I','C','R','D'}}, QDateTime::currentDateTimeUtc () + .toString ("yyyy-MM-ddTHH:mm:ss.zzzZ").toLocal8Bit ()}, + {{{'I','C','M','T'}}, comment.toLocal8Bit ()}, + }; + auto file_name = name + ".wav"; + BWFFile wav {format, file_name, list_info}; + if (!wav.open (BWFFile::WriteOnly) + || 0 > wav.write (reinterpret_cast<char const *> (data) + , sizeof (short) * samples)) + { + return file_name + ": " + wav.errorString (); + } + return QString {}; +} + +//-------------------------------------------------------------- fastSink() +void MainWindow::fastSink(qint64 frames) +{ + int k (frames); + bool decodeNow=false; + filtered = false; + ignored = false; + m_muted = false; + if(k < m_k0) { //New sequence ? + memcpy(fast_green2,fast_green,4*703); //Copy fast_green[] to fast_green2[] + memcpy(fast_s2,fast_s,4*703*64); //Copy fast_s[] into fast_s2[] + fast_jh2=fast_jh; + if(!m_diskData) memset(dec_data.d2,0,2*30*12000); //Zero the d2[] array + m_bFastDecodeCalled=false; + m_bDecoded=false; + } + + QDateTime tnow=QDateTime::currentDateTimeUtc(); + int ihr=tnow.toString("hh").toInt(); + int imin=tnow.toString("mm").toInt(); + int isec=tnow.toString("ss").toInt(); + isec=isec - fmod(double(isec),m_TRperiod); + int nutc0=10000*ihr + 100*imin + isec; + if(m_diskData) nutc0=m_UTCdisk; + char line[80]; + bool bmsk144=((m_mode=="MSK144") and (m_monitoring or m_diskData)); + line[0]=0; + + int RxFreq=ui->RxFreqSpinBox->value (); + int nTRpDepth=m_TRperiod + 1000*(m_ndepth & 3); + qint64 ms0 = QDateTime::currentMSecsSinceEpoch(); +// ::memcpy(dec_data.params.mycall, (m_baseCall+" ").toLatin1(),sizeof dec_data.params.mycall); + ::memcpy(dec_data.params.mycall,(m_config.my_callsign () + " ").toLatin1(),sizeof dec_data.params.mycall); + QString hisCall {ui->dxCallEntry->text ()}; + bool bshmsg=ui->cbShMsgs->isChecked(); + bool bswl=ui->cbSWL->isChecked(); +// ::memcpy(dec_data.params.hiscall,(Radio::base_callsign (hisCall) + " ").toLatin1 ().constData (), sizeof dec_data.params.hiscall); + ::memcpy(dec_data.params.hiscall,(hisCall + " ").toLatin1 ().constData (), sizeof dec_data.params.hiscall); + ::memcpy(dec_data.params.mygrid, (m_config.my_grid()+" ").toLatin1(), sizeof dec_data.params.mygrid); + auto data_dir {m_config.writeable_data_dir ().absolutePath ().toLocal8Bit ()}; + float pxmax = 0; + float rmsNoGain = 0; + int ftol = ui->sbFtol->value (); + hspec_(dec_data.d2,&k,&nutc0,&nTRpDepth,&RxFreq,&ftol,&bmsk144, + &m_bTrain,m_phaseEqCoefficients.constData(),&m_inGain,&dec_data.params.mycall[0], + &dec_data.params.hiscall[0],&bshmsg,&bswl, + data_dir.constData (),fast_green,fast_s,&fast_jh,&pxmax,&rmsNoGain,&line[0],(FCL)12, + (FCL)12,(FCL)data_dir.size (),(FCL)80); + float px = fast_green[fast_jh]; + QString t; + t = t.asprintf(" Rx noise: %5.1f ",px); + ui->signal_meter_widget->setValue(rmsNoGain,pxmax); // Update thermometer + m_fastGraph->plotSpec(m_diskData,m_UTCdisk); + + if(bmsk144 and (line[0]!=0)) { + QString message {QString::fromLatin1 (line)}; + DecodedText decodedtext {message.replace (QChar::LineFeed, "")}; + + QString text = decodedtext.string().replace("<","").replace(">",""); // for Wait features + + // Filtering for MSK144 + QString text2 = ""; + QStringList tw=text.mid(24).split(" ",SkipEmptyParts); + if (m_config.filters_for_word2()) { + if (tw.size () < 2) { + text2 = "___"; // prevent segfault errors with free text messages + } else if (tw[1].length() == 2 && tw[1].contains(QRegularExpression{"\\w\\w"})) { // directional calls + if (tw.size () > 2) { + text2 = tw[2]; // for directional calls analyze word 3 for filtering + } else { + text2 = "___"; // prevent segfault errors with free text messages + } + } else { + text2 = tw[1]; // otherwise analyze word 2 for filtering + } + if (!(SpecOp::NONE==m_specOp && m_config.AlwaysPass () // Always pass messages with keywords from Always Pass list + && ( + (text2.startsWith(m_config.Pass1()) && (m_config.Pass1()!="")) + || (text2.startsWith(m_config.Pass2()) && (m_config.Pass2()!="")) + || (text2.startsWith(m_config.Pass3()) && (m_config.Pass3()!="")) + || (text2.startsWith(m_config.Pass4()) && (m_config.Pass4()!="")) + || (text2.startsWith(m_config.Pass5()) && (m_config.Pass5()!="")) + || (text2.startsWith(m_config.Pass6()) && (m_config.Pass6()!="")) + || (text2.startsWith(m_config.Pass7()) && (m_config.Pass7()!="")) + || (text2.startsWith(m_config.Pass8()) && (m_config.Pass8()!="")) + || (text2.startsWith(m_config.Pass9()) && (m_config.Pass9()!="")) + || (text2.startsWith(m_config.Pass10()) && (m_config.Pass10()!="")) + || (text2.startsWith(m_config.Pass11()) && (m_config.Pass11()!="")) + || (text2.startsWith(m_config.Pass12()) && (m_config.Pass12()!="")) + ))) { + + // Filtering out messages with keywords from Blacklist + if (SpecOp::NONE==m_specOp && m_config.Blacklisted () + && ( + (text2.startsWith(m_config.Blacklist1()) && (m_config.Blacklist1()!="")) + || (text2.startsWith(m_config.Blacklist2()) && (m_config.Blacklist2()!="")) + || (text2.startsWith(m_config.Blacklist3()) && (m_config.Blacklist3()!="")) + || (text2.startsWith(m_config.Blacklist4()) && (m_config.Blacklist4()!="")) + || (text2.startsWith(m_config.Blacklist5()) && (m_config.Blacklist5()!="")) + || (text2.startsWith(m_config.Blacklist6()) && (m_config.Blacklist6()!="")) + || (text2.startsWith(m_config.Blacklist7()) && (m_config.Blacklist7()!="")) + || (text2.startsWith(m_config.Blacklist8()) && (m_config.Blacklist8()!="")) + || (text2.startsWith(m_config.Blacklist9()) && (m_config.Blacklist9()!="")) + || (text2.startsWith(m_config.Blacklist10()) && (m_config.Blacklist10()!="")) + || (text2.startsWith(m_config.Blacklist11()) && (m_config.Blacklist11()!="")) + || (text2.startsWith(m_config.Blacklist12()) && (m_config.Blacklist12()!="")) + )) { + if (!ui->cbBypass->isChecked()) filtered = true; + if (!(m_config.filters_for_Wait_and_Pounce_only() or ui->cbBypass->isChecked())) return; + // reset dB score when filtered + if (pounce && (ui->respondComboBox->currentText()=="CQ: Max Dist" + or ui->respondComboBox->currentText()=="CQ: Max dB" + or ui->respondComboBox->currentText()=="CQ: Min dB")) { + Dpoints=0; + maxDPoints=0; + dBpoints=-28; + dBpoints2=99; + maxdBPoints=-28; + mindBPoints=99; + } + + // Filtering out everything but messages with keywords from Whitelist + } else if (SpecOp::NONE==m_specOp && m_config.Whitelisted () + && !(text2.startsWith(m_config.Whitelist1()) && (m_config.Whitelist1()!="")) + && !(text2.startsWith(m_config.Whitelist2()) && (m_config.Whitelist2()!="")) + && !(text2.startsWith(m_config.Whitelist3()) && (m_config.Whitelist3()!="")) + && !(text2.startsWith(m_config.Whitelist4()) && (m_config.Whitelist4()!="")) + && !(text2.startsWith(m_config.Whitelist5()) && (m_config.Whitelist5()!="")) + && !(text2.startsWith(m_config.Whitelist6()) && (m_config.Whitelist6()!="")) + && !(text2.startsWith(m_config.Whitelist7()) && (m_config.Whitelist7()!="")) + && !(text2.startsWith(m_config.Whitelist8()) && (m_config.Whitelist8()!="")) + && !(text2.startsWith(m_config.Whitelist9()) && (m_config.Whitelist9()!="")) + && !(text2.startsWith(m_config.Whitelist10()) && (m_config.Whitelist10()!="")) + && !(text2.startsWith(m_config.Whitelist11()) && (m_config.Whitelist11()!="")) + && !(text2.startsWith(m_config.Whitelist12()) && (m_config.Whitelist12()!="")) + ) { + if (!ui->cbBypass->isChecked()) filtered = true; + if (!(m_config.filters_for_Wait_and_Pounce_only() or ui->cbBypass->isChecked())) return; + // reset dB score when filtered + if (pounce && (ui->respondComboBox->currentText()=="CQ: Max Dist" + or ui->respondComboBox->currentText()=="CQ: Max dB" + or ui->respondComboBox->currentText()=="CQ: Min dB")) { + Dpoints=0; + maxDPoints=0; + dBpoints=-28; + dBpoints2=99; + maxdBPoints=-28; + mindBPoints=99; + } + } + + // search logbook for filtering + if (ui->actionHideTerritory1->isChecked() or ui->actionHideTerritory2->isChecked() or + ui->actionHideTerritory3->isChecked() or ui->actionHideTerritory4->isChecked() or + ui->actionHideB4->isChecked() or ui->actionHideEU->isChecked() or ui->actionHideAS->isChecked() or + ui->actionHideNA->isChecked() or ui->actionHideSA->isChecked() or ui->actionHideAF->isChecked() or + ui->actionHideOC->isChecked() or ui->actionHideAN->isChecked()) { + QString deCall; + QString deGrid; + decodedtext.deCallAndGrid(/*out*/deCall,deGrid); + // search for country names + if (ui->actionHideTerritory1->isChecked() or ui->actionHideTerritory2->isChecked() or + ui->actionHideTerritory3->isChecked() or ui->actionHideTerritory4->isChecked()) { + auto const& looked_up = m_logBook.countries ()->lookup (deCall); + auto countryName = looked_up.entity_name; + // do some obvious abbreviations + countryName.replace ("Islands", "Is."); + countryName.replace ("Island", "Is."); + countryName.replace ("North ", "N. "); + countryName.replace ("Northern ", "N. "); + countryName.replace ("South ", "S. "); + countryName.replace ("East ", "E. "); + countryName.replace ("Eastern ", "E. "); + countryName.replace ("West ", "W. "); + countryName.replace ("Western ", "W. "); + countryName.replace ("Central ", "C. "); + countryName.replace (" and ", " & "); + countryName.replace ("Republic", "Rep."); + countryName.replace ("United States of America", "U.S.A."); + countryName.replace ("United States", "U.S.A."); + countryName.replace ("Fed. Rep. of ", ""); + countryName.replace ("French ", "Fr."); + countryName.replace ("Asiatic", "AS"); + countryName.replace ("European", "EU"); + countryName.replace ("African", "AF"); + if (ui->actionHideTerritory1->isChecked() && countryName.contains(m_config.Territory1()) + && (m_config.Territory1()!="") && !ui->cbBypass->isChecked()) filtered = true; + if (ui->actionHideTerritory2->isChecked() && countryName.contains(m_config.Territory2()) + && (m_config.Territory2()!="") && !ui->cbBypass->isChecked()) filtered = true; + if (ui->actionHideTerritory3->isChecked() && countryName.contains(m_config.Territory3()) + && (m_config.Territory3()!="") && !ui->cbBypass->isChecked()) filtered = true; + if (ui->actionHideTerritory4->isChecked() && countryName.contains(m_config.Territory4()) + && (m_config.Territory4()!="") && !ui->cbBypass->isChecked()) filtered = true; + } + // search for callsigns worked B4 on band + if (ui->actionHideB4->isChecked()) { + bool callB4onBand; + bool countryB4onBand; + bool gridB4onBand; + bool continentB4onBand; + bool CQZoneB4onBand; + bool ITUZoneB4onBand; + auto const& looked_up = m_logBook.countries ()->lookup (deCall); + m_logBook.match (deCall, m_mode, deGrid, looked_up, callB4onBand, countryB4onBand, gridB4onBand, + continentB4onBand, CQZoneB4onBand, ITUZoneB4onBand, m_currentBand); + if (callB4onBand && ui->actionHideB4->isChecked() && !ui->cbBypass->isChecked()) filtered = true; + } + // search for continents + if (ui->actionHideEU->isChecked() or ui->actionHideAS->isChecked() or ui->actionHideNA->isChecked() + or ui->actionHideSA->isChecked() or ui->actionHideAF->isChecked() or ui->actionHideOC->isChecked() + or ui->actionHideAN->isChecked()) { + auto const& looked_up = m_logBook.countries ()->lookup (deCall); + QString continent = AD1CCty::continent (looked_up.continent); + if (ui->actionHideEU->isChecked() && continent == "EU" && !ui->cbBypass->isChecked()) filtered = true; + if (ui->actionHideAS->isChecked() && continent == "AS" && !ui->cbBypass->isChecked()) filtered = true; + if (ui->actionHideNA->isChecked() && continent == "NA" && !ui->cbBypass->isChecked()) filtered = true; + if (ui->actionHideSA->isChecked() && continent == "SA" && !ui->cbBypass->isChecked()) filtered = true; + if (ui->actionHideAF->isChecked() && continent == "AF" && !ui->cbBypass->isChecked()) filtered = true; + if (ui->actionHideOC->isChecked() && continent == "OC" && !ui->cbBypass->isChecked()) filtered = true; + if (ui->actionHideAN->isChecked() && continent == "AN" && !ui->cbBypass->isChecked()) filtered = true; + } + } + } + } else { + if (!(SpecOp::NONE==m_specOp && m_config.AlwaysPass () // Always pass messages with keywords from Always Pass list + && ( + (text.contains(m_config.Pass1()) && (m_config.Pass1()!="")) + || (text.contains(m_config.Pass2()) && (m_config.Pass2()!="")) + || (text.contains(m_config.Pass3()) && (m_config.Pass3()!="")) + || (text.contains(m_config.Pass4()) && (m_config.Pass4()!="")) + || (text.contains(m_config.Pass5()) && (m_config.Pass5()!="")) + || (text.contains(m_config.Pass6()) && (m_config.Pass6()!="")) + || (text.contains(m_config.Pass7()) && (m_config.Pass7()!="")) + || (text.contains(m_config.Pass8()) && (m_config.Pass8()!="")) + || (text.contains(m_config.Pass9()) && (m_config.Pass9()!="")) + || (text.contains(m_config.Pass10()) && (m_config.Pass10()!="")) + || (text.contains(m_config.Pass11()) && (m_config.Pass11()!="")) + || (text.contains(m_config.Pass12()) && (m_config.Pass12()!="")) + ))) { + + // Filtering out messages with keywords from Blacklist + if (SpecOp::NONE==m_specOp && m_config.Blacklisted () + && ( + (text.contains(m_config.Blacklist1()) && (m_config.Blacklist1()!="")) + || (text.contains(m_config.Blacklist2()) && (m_config.Blacklist2()!="")) + || (text.contains(m_config.Blacklist3()) && (m_config.Blacklist3()!="")) + || (text.contains(m_config.Blacklist4()) && (m_config.Blacklist4()!="")) + || (text.contains(m_config.Blacklist5()) && (m_config.Blacklist5()!="")) + || (text.contains(m_config.Blacklist6()) && (m_config.Blacklist6()!="")) + || (text.contains(m_config.Blacklist7()) && (m_config.Blacklist7()!="")) + || (text.contains(m_config.Blacklist8()) && (m_config.Blacklist8()!="")) + || (text.contains(m_config.Blacklist9()) && (m_config.Blacklist9()!="")) + || (text.contains(m_config.Blacklist10()) && (m_config.Blacklist10()!="")) + || (text.contains(m_config.Blacklist11()) && (m_config.Blacklist11()!="")) + || (text.contains(m_config.Blacklist12()) && (m_config.Blacklist12()!="")) + )) { + if (!ui->cbBypass->isChecked()) filtered = true; + if (!(m_config.filters_for_Wait_and_Pounce_only() or ui->cbBypass->isChecked())) return; + // reset dB score when filtered + if (pounce && (ui->respondComboBox->currentText()=="CQ: Max Dist" + or ui->respondComboBox->currentText()=="CQ: Max dB" + or ui->respondComboBox->currentText()=="CQ: Min dB")) { + Dpoints=0; + maxDPoints=0; + dBpoints=-28; + dBpoints2=99; + maxdBPoints=-28; + mindBPoints=99; + } + + // Filtering out everything but messages with keywords from Whitelist + } else if (SpecOp::NONE==m_specOp && m_config.Whitelisted () + && !(text.contains(m_config.Whitelist1()) && (m_config.Whitelist1()!="")) + && !(text.contains(m_config.Whitelist2()) && (m_config.Whitelist2()!="")) + && !(text.contains(m_config.Whitelist3()) && (m_config.Whitelist3()!="")) + && !(text.contains(m_config.Whitelist4()) && (m_config.Whitelist4()!="")) + && !(text.contains(m_config.Whitelist5()) && (m_config.Whitelist5()!="")) + && !(text.contains(m_config.Whitelist6()) && (m_config.Whitelist6()!="")) + && !(text.contains(m_config.Whitelist7()) && (m_config.Whitelist7()!="")) + && !(text.contains(m_config.Whitelist8()) && (m_config.Whitelist8()!="")) + && !(text.contains(m_config.Whitelist9()) && (m_config.Whitelist9()!="")) + && !(text.contains(m_config.Whitelist10()) && (m_config.Whitelist10()!="")) + && !(text.contains(m_config.Whitelist11()) && (m_config.Whitelist11()!="")) + && !(text.contains(m_config.Whitelist12()) && (m_config.Whitelist12()!="")) + ) { + if (!ui->cbBypass->isChecked()) filtered = true; + if (!(m_config.filters_for_Wait_and_Pounce_only() or ui->cbBypass->isChecked())) return; + // reset dB score when filtered + if (pounce && (ui->respondComboBox->currentText()=="CQ: Max Dist" + or ui->respondComboBox->currentText()=="CQ: Max dB" + or ui->respondComboBox->currentText()=="CQ: Min dB")) { + Dpoints=0; + maxDPoints=0; + dBpoints=-28; + dBpoints2=99; + maxdBPoints=-28; + mindBPoints=99; + } + } + + // search logbook for filtering + if (ui->actionHideTerritory1->isChecked() or ui->actionHideTerritory2->isChecked() or + ui->actionHideTerritory3->isChecked() or ui->actionHideTerritory4->isChecked() or + ui->actionHideB4->isChecked() or ui->actionHideEU->isChecked() or ui->actionHideAS->isChecked() or + ui->actionHideNA->isChecked() or ui->actionHideSA->isChecked() or ui->actionHideAF->isChecked() or + ui->actionHideOC->isChecked() or ui->actionHideAN->isChecked()) { + QString deCall; + QString deGrid; + decodedtext.deCallAndGrid(/*out*/deCall,deGrid); + // search for country names + if (ui->actionHideTerritory1->isChecked() or ui->actionHideTerritory2->isChecked() or + ui->actionHideTerritory3->isChecked() or ui->actionHideTerritory4->isChecked()) { + auto const& looked_up = m_logBook.countries ()->lookup (deCall); + auto countryName = looked_up.entity_name; + // do some obvious abbreviations + countryName.replace ("Islands", "Is."); + countryName.replace ("Island", "Is."); + countryName.replace ("North ", "N. "); + countryName.replace ("Northern ", "N. "); + countryName.replace ("South ", "S. "); + countryName.replace ("East ", "E. "); + countryName.replace ("Eastern ", "E. "); + countryName.replace ("West ", "W. "); + countryName.replace ("Western ", "W. "); + countryName.replace ("Central ", "C. "); + countryName.replace (" and ", " & "); + countryName.replace ("Republic", "Rep."); + countryName.replace ("United States of America", "U.S.A."); + countryName.replace ("United States", "U.S.A."); + countryName.replace ("Fed. Rep. of ", ""); + countryName.replace ("French ", "Fr."); + countryName.replace ("Asiatic", "AS"); + countryName.replace ("European", "EU"); + countryName.replace ("African", "AF"); + if (ui->actionHideTerritory1->isChecked() && countryName.contains(m_config.Territory1()) + && (m_config.Territory1()!="") && !ui->cbBypass->isChecked()) filtered = true; + if (ui->actionHideTerritory2->isChecked() && countryName.contains(m_config.Territory2()) + && (m_config.Territory2()!="") && !ui->cbBypass->isChecked()) filtered = true; + if (ui->actionHideTerritory3->isChecked() && countryName.contains(m_config.Territory3()) + && (m_config.Territory3()!="") && !ui->cbBypass->isChecked()) filtered = true; + if (ui->actionHideTerritory4->isChecked() && countryName.contains(m_config.Territory4()) + && (m_config.Territory4()!="") && !ui->cbBypass->isChecked()) filtered = true; + } + // search for callsigns worked B4 on band + if (ui->actionHideB4->isChecked()) { + bool callB4onBand; + bool countryB4onBand; + bool gridB4onBand; + bool continentB4onBand; + bool CQZoneB4onBand; + bool ITUZoneB4onBand; + auto const& looked_up = m_logBook.countries ()->lookup (deCall); + m_logBook.match (deCall, m_mode, deGrid, looked_up, callB4onBand, countryB4onBand, gridB4onBand, + continentB4onBand, CQZoneB4onBand, ITUZoneB4onBand, m_currentBand); + if (callB4onBand && ui->actionHideB4->isChecked() && !ui->cbBypass->isChecked()) filtered = true; + } + // search for continents + if (ui->actionHideEU->isChecked() or ui->actionHideAS->isChecked() or ui->actionHideNA->isChecked() + or ui->actionHideSA->isChecked() or ui->actionHideAF->isChecked() or ui->actionHideOC->isChecked() + or ui->actionHideAN->isChecked()) { + auto const& looked_up = m_logBook.countries ()->lookup (deCall); + QString continent = AD1CCty::continent (looked_up.continent); + if (ui->actionHideEU->isChecked() && continent == "EU" && !ui->cbBypass->isChecked()) filtered = true; + if (ui->actionHideAS->isChecked() && continent == "AS" && !ui->cbBypass->isChecked()) filtered = true; + if (ui->actionHideNA->isChecked() && continent == "NA" && !ui->cbBypass->isChecked()) filtered = true; + if (ui->actionHideSA->isChecked() && continent == "SA" && !ui->cbBypass->isChecked()) filtered = true; + if (ui->actionHideAF->isChecked() && continent == "AF" && !ui->cbBypass->isChecked()) filtered = true; + if (ui->actionHideOC->isChecked() && continent == "OC" && !ui->cbBypass->isChecked()) filtered = true; + if (ui->actionHideAN->isChecked() && continent == "AN" && !ui->cbBypass->isChecked()) filtered = true; + } + } + } + } + + // hide or ignore callsigns for MSK144 + if (ui->actionHideIgnored->isChecked() or ui->actionHideToday->isChecked() or ui->actionIgnoreIgnored->isChecked() or ui->actionIgnoreToday->isChecked()) { + QString today = QDateTime::currentDateTimeUtc().toString ("yyyy-MM-dd"); + QString yesterday = QDateTime::currentDateTimeUtc().addDays(-1).toString ("yyyy-MM-dd"); + QString deCall; + QString deGrid; + decodedtext.deCallAndGrid(/*out*/deCall,deGrid); + if (ui->actionHideIgnored->isChecked() && !ui->cbBypass->isChecked() && ignoreList.contains(deCall + ",")) filtered = true; + if (ui->actionHideToday->isChecked() && !ui->cbBypass->isChecked() && ( + txLog.contains(QRegularExpression{today + ",[0-9][0-9]:[0-9][0-9]:[0-9][0-9]," + (deCall + ",")}) + or (m_config.twoDays() && txLog.contains(QRegularExpression{yesterday + ",[0-9][0-9]:[0-9][0-9]:[0-9][0-9]," + (deCall + ",")})))) { + filtered = true; + } + if (ui->actionIgnoreIgnored->isChecked() && ignoreList.contains(deCall + ",")) { + ignored = true; + m_muted = true; + } + if (ui->actionIgnoreToday->isChecked() && (txLog.contains(QRegularExpression{today + ",[0-9][0-9]:[0-9][0-9]:[0-9][0-9]," + (deCall + ",")}) + or (m_config.twoDays() && txLog.contains(QRegularExpression{yesterday + ",[0-9][0-9]:[0-9][0-9]:[0-9][0-9]," + (deCall + ",")})))) { + ignored = true; + m_muted = true; + } + } + if (ui->actionIgnoreB4->isChecked() && (pounce or m_auto)) { + QString deCall; + QString deGrid; + decodedtext.deCallAndGrid(/*out*/deCall,deGrid); + bool callB4onBand; + bool countryB4onBand; + bool gridB4onBand; + bool continentB4onBand; + bool CQZoneB4onBand; + bool ITUZoneB4onBand; + auto const& looked_up = m_logBook.countries ()->lookup (deCall); + m_logBook.match (deCall, m_mode, deGrid, looked_up, callB4onBand, countryB4onBand, gridB4onBand, + continentB4onBand, CQZoneB4onBand, ITUZoneB4onBand, m_currentBand); + if (callB4onBand && ui->actionIgnoreB4->isChecked() && !ui->cbBypass->isChecked()) { + ignored = true; + m_muted = true; + } + } + + // Stop Wait & Call timeout when in QSO with this station for MSK144 + if (ui->DX_Call_Button->isChecked() && m_hisCall!="" && text.contains(" " + m_config.my_callsign() + " " + m_hisCall)) { + stopWCTimer.stop(); // stop any Wait & Call timeout + if (ui->DX_Call_Button->isChecked()) ui->DX_Call_Button->click (); // disable Wait & Call + no_wait_and_call = false; // reset Wait & Call + } + + // Wait & Reply for MSK144 + if (text.contains(" " + m_config.my_callsign() + " " + m_hisCall) && m_hisCall!="" && + !text.contains("73 ") && m_mode=="MSK144" && m_config.Wait_features_enabled() + && !ui->autoButton->isChecked() + && (!(ui->actionFull_Duplex_Mode->isChecked() && m_txing))) { + tx_watchdog (false); + m_bDoubleClicked = true; + processMessage(decodedtext); + auto_tx_mode(true); + stopWRTimer.start(int(12000.0*m_TRperiod)); // Wait & Reply Tx max 12*TRperiod + } + + // Wait & Call for MSK144 + if (m_mode=="MSK144" && wait_and_call && m_specOp!=SpecOp::FOX && ui->cbAutoSeq->isChecked() && + m_hisCall!="" && (text.contains("CQ " + m_hisCall) or text.contains("CQ DX " + m_hisCall) or text.contains(m_hisCall + " RR73") + or text.contains(m_hisCall + " RRR") or text.contains(m_hisCall + " 73")) && m_config.Wait_features_enabled() + && (!(ui->actionFull_Duplex_Mode->isChecked() && m_txing))) { + m_bDoubleClicked = true; + processMessage(decodedtext); + auto_tx_mode(true); + no_wait_and_call = true; + stopWCTimer.start(int(6200.0*m_TRperiod)); // Wait & Call Tx max 6*TRperiod + } + + // CQ: First for MSK144 + if(((pounce && text.contains(" CQ ") && m_config.Wait_features_enabled()) + or (m_auto && m_bCallingCQ && text.contains(" " + m_config.my_callsign() + " "))) && !ignored + && !filtered && !selected && ui->respondComboBox->isVisible() && ui->respondComboBox->currentText()=="CQ: First" + && (!(ui->actionFull_Duplex_Mode->isChecked() && m_txing))) { + m_bDoubleClicked=true; + selected = true; + auto_tx_mode(true); + processMessage(decodedtext); + auto now = QDateTime::currentDateTimeUtc(); + m_dateTimeQSOOn = now.addSecs (-(m_ntx - 1) * int(m_TRperiod) - int(fmod(double(now.time().second()),m_TRperiod))); + QTimer::singleShot (6000, [=] {selected = false;}); + if (pounce) stopWCTimer.start(int(6200.0*m_TRperiod)); // Tx max 6*TRperiod + } + + // CQ: Max Dist for MSK144 + if((pounce or m_auto) && ui->respondComboBox->isVisible() && ui->respondComboBox->currentText()=="CQ: Max Dist" + && (!(ui->actionFull_Duplex_Mode->isChecked() && m_txing))) { + QString deCall; + QString deGrid; + decodedtext.deCallAndGrid(/*out*/deCall,deGrid); + if (!filtered && !ignored && (deGrid.contains(grid_regexp) or m_bCallingCQ) && ( + (pounce && text.contains(" CQ ") && !txLog.contains(deCall) && m_config.Wait_features_enabled()) or + (m_bCallingCQ && text.contains(" " + m_config.my_callsign() + " ") && !text.contains("73 ")) + )) { + double utch=0.0; + int nAz,nEl,nDmiles,nDkm,nHotAz,nHotABetter; + azdist_(const_cast <char *> ((m_config.my_grid () + " ").left (6).toLatin1().constData()), + const_cast <char *> ((deGrid + " ").left (6).toLatin1().constData()),&utch, + &nAz,&nEl,&nDmiles,&nDkm,&nHotAz,&nHotABetter,6,6); + Dpoints=nDkm; + if (!deGrid.contains(grid_regexp)) Dpoints=1; + if(Dpoints>maxDPoints) { + maxDPoints=Dpoints; + m_deCall=deCall; + m_bDoubleClicked=true; + if ((pounce && text.contains(" CQ ") && m_config.Wait_features_enabled()) or m_auto) { + auto_tx_mode(true); + processMessage(decodedtext); + if (pounce) stopWCTimer.start(int(6200.0*m_TRperiod)); // Tx max 6*TRperiod + } + ui->dxCallEntry->setText(deCall); + genStdMsgs(QString::number(decodedtext.snr())); + ui->RxFreqSpinBox->setValue(decodedtext.frequencyOffset()); + setTxMsg(m_ntx); + m_currentMessageType=m_ntx; + auto now = QDateTime::currentDateTimeUtc(); + m_dateTimeQSOOn = now.addSecs (-(m_ntx - 1) * int(m_TRperiod) - int(fmod(double(now.time().second()),m_TRperiod))); + } + } + } + + // CQ: Max dB for MSK144 + if((pounce or m_auto) && ui->respondComboBox->isVisible() && ui->respondComboBox->currentText()=="CQ: Max dB" + && (!(ui->actionFull_Duplex_Mode->isChecked() && m_txing))) { + QString deCall; + QString deGrid; + decodedtext.deCallAndGrid(/*out*/deCall,deGrid); + if (!filtered && !ignored && ( + (pounce && text.contains(" CQ ") && !txLog.contains(deCall) && m_config.Wait_features_enabled()) or + (m_bCallingCQ && text.contains(" " + m_config.my_callsign() + " ") && !text.contains("73 ")) + )) { + dBpoints=decodedtext.string().mid(7,3).toInt(); + if(dBpoints>maxdBPoints) { + maxdBPoints=dBpoints; + m_deCall=deCall; + m_bDoubleClicked=true; + if ((pounce && text.contains(" CQ ") && m_config.Wait_features_enabled()) or m_auto) { + auto_tx_mode(true); + processMessage(decodedtext); + if (pounce) stopWCTimer.start(int(6200.0*m_TRperiod)); // Tx max 6*TRperiod + } + ui->dxCallEntry->setText(deCall); + genStdMsgs(QString::number(decodedtext.snr())); + ui->RxFreqSpinBox->setValue(decodedtext.frequencyOffset()); + setTxMsg(m_ntx); + m_currentMessageType=m_ntx; + auto now = QDateTime::currentDateTimeUtc(); + m_dateTimeQSOOn = now.addSecs (-(m_ntx - 1) * int(m_TRperiod) - int(fmod(double(now.time().second()),m_TRperiod))); + } + } + } + + // CQ: Min dB for MSK144 + if((pounce or m_auto) && ui->respondComboBox->isVisible() && ui->respondComboBox->currentText()=="CQ: Min dB" + && (!(ui->actionFull_Duplex_Mode->isChecked() && m_txing))) { + QString deCall; + QString deGrid; + decodedtext.deCallAndGrid(/*out*/deCall,deGrid); + if (!filtered && !ignored && ( + (pounce && text.contains(" CQ ") && !txLog.contains(deCall) && m_config.Wait_features_enabled()) or + (m_bCallingCQ && text.contains(" " + m_config.my_callsign() + " ") && !text.contains("73 ")) + )) { + dBpoints2=decodedtext.string().mid(7,3).toInt(); + if(dBpoints2<mindBPoints) { + mindBPoints=dBpoints2; + m_deCall=deCall; + m_bDoubleClicked=true; + if ((pounce && text.contains(" CQ ") && m_config.Wait_features_enabled()) or m_auto) { + auto_tx_mode(true); + processMessage(decodedtext); + if (pounce) stopWCTimer.start(int(6200.0*m_TRperiod)); // Tx max 6*TRperiod + } + ui->dxCallEntry->setText(deCall); + genStdMsgs(QString::number(decodedtext.snr())); + ui->RxFreqSpinBox->setValue(decodedtext.frequencyOffset()); + setTxMsg(m_ntx); + m_currentMessageType=m_ntx; + auto now = QDateTime::currentDateTimeUtc(); + m_dateTimeQSOOn = now.addSecs (-(m_ntx - 1) * int(m_TRperiod) - int(fmod(double(now.time().second()),m_TRperiod))); + } + } + } + // show distance and bearing for MSK144 + if (!filtered or m_config.filters_for_Wait_and_Pounce_only()) { + QString distance; + QString deCall; + QString deGrid; + decodedtext.deCallAndGrid(deCall,deGrid); + if ((m_config.showDistance() || m_config.showAzimuth()) && deGrid.contains(grid_regexp)) { + double utch=0.0; + int nAz,nEl,nDmiles,nDkm,nHotAz,nHotABetter; + QString my_Grid = m_config.my_grid(); + if (my_Grid.length() < 5) my_Grid = m_config.my_grid().left(4)+"mm"; + QString de_Grid= deGrid.left(4)+"mm"; + azdist_(const_cast <char *> (my_Grid.toLatin1().constData()), + const_cast <char *> (de_Grid.toLatin1().constData()),&utch, + &nAz,&nEl,&nDmiles,&nDkm,&nHotAz,&nHotABetter,(FCL)6,(FCL)6); + if (m_config.showDistance()) { + int nd=nDkm; + if(m_config.miles()) nd=nDmiles; + distance = QString::number(nd); + if(m_config.miles()) distance += " mi"; + if(!m_config.miles()) distance += " km"; + } + if (m_config.showAzimuth()) { + if (distance.length()) distance += " / "; + distance += QString::number(nAz) + "°"; + } + } + + // mute audible alerts when callsign is on the Ignored List for MSK144 + if (m_config.alert_Enabled() && !ui->cbBypass->isChecked() && deCall!="" && ignoreList.contains(deCall + ",")) m_muted = true; + + // insert blank line for MSK144 + int ntime=6; + if ((m_config.insert_blank() or m_config.alert_Enabled()) && !BlankLineInserted && (text.left(ntime) != m_tBlankLine) && text.left(4).contains(QRegularExpression {"\\d\\d\\d\\d"}) && !m_diskData) { + ui->decodedTextBrowser->new_period (); + if (m_config.insert_blank () && (!filtered or m_config.filters_for_Wait_and_Pounce_only())) { + QString band; + if(((QDateTime::currentMSecsSinceEpoch() / 1000 - m_secBandChanged) > 4*int(m_TRperiod)/4) or m_displayBand) { + band = ' ' + m_config.bands ()->find (m_freqNominal); + } + if (m_config.insert_blank ()) { + if (ui->actionUse_Dark_Style->isChecked()) { + if (m_config.detailed_blank()) { + if (m_config.DXCC()) { + ui->decodedTextBrowser->insertText(("------ " + m_dateTimeSeqStart.toString("yyyy-MM-dd - hh:mm:ss' UTC - '") + m_currentBandPeriod + " - " + m_mode + " ------"), "#a2a2a2", "#000000"); + } else { + ui->decodedTextBrowser->insertText(("------ " + m_dateTimeSeqStart.toString("yyyy-MM-dd - hh:mm:ss' UTC - '") + m_currentBandPeriod + " - " + m_mode), "#a2a2a2", "#000000"); + } + } else { + ui->decodedTextBrowser->insertText(band.rightJustified(40, '-'), "#a2a2a2", "#000000"); + } + } else { + if (m_config.detailed_blank()) { + if (m_config.DXCC()) { + ui->decodedTextBrowser->insertLineSpacer ("------ " + m_dateTimeSeqStart.toString("yyyy-MM-dd - hh:mm:ss' UTC - '") + m_currentBandPeriod + " - " + m_mode + " ------"); + } else { + ui->decodedTextBrowser->insertLineSpacer ("------ " + m_dateTimeSeqStart.toString("yyyy-MM-dd - hh:mm:ss' UTC - '") + m_currentBandPeriod + " - " + m_mode); + } + } else { + ui->decodedTextBrowser->insertLineSpacer (band.rightJustified (40, '-')); + } + } + } + BlankLineInserted = true; + m_tBlankLine = text.left(ntime); + } + } + + // display decodes for the fast modes must be done before highlighting any call or grid for MSK144 + bool haveFSpread {false}; + float fSpread {0.}; + bool bDisplayPoints {false}; + m_points = 0; + + ui->decodedTextBrowser->displayDecodedText (decodedtext, m_config.my_callsign (), m_mode, m_config.DXCC (), + m_logBook, m_currentBandPeriod, m_config.ppfx (), + ui->cbCQonly->isVisible() && ui->cbCQonly->isChecked(), + haveFSpread, fSpread, bDisplayPoints, m_points, distance, m_muted); + if(m_position != 0) ui->decodedTextBrowser->horizontalScrollBar()->setValue(m_position); + + // display "73" messages for us also in the right pane + if (m_mode=="MSK144" && text.mid(22).contains(m_baseCall + " " + m_hisCall + " 73")) { + ui->decodedTextBrowser2->displayDecodedText (decodedtext, m_config.my_callsign (), m_mode, m_config.DXCC (), + m_logBook, m_currentBand, m_config.ppfx (), false, false, 0.0, false, -99, "", m_muted); + } + } + + // Ensure that Tx stops when "73" is received and repeat_Tx is enabled for MSK144 + if (m_config.repeat_Tx() && m_mode=="MSK144" && m_hisCall!="" && text.contains(m_baseCall) && text.contains(m_hisCall + " 73") && m_send_RR73) + QTimer::singleShot (int(750*m_TRperiod), [=] {cease_auto_Tx_after_QSO();}); + + // highlight orange and blue callsigns for MSK144 + if(m_config.highlight_orange() or (m_config.highlight_blue()) or ui->actionHighlight_Whitelist_entries->isChecked()) { + QString deCall; + QString deGrid; + decodedtext.deCallAndGrid(/*out*/deCall,deGrid); + QStringList tw; + tw=text.mid(22).split(" ",SkipEmptyParts); + if (m_config.highlight_orange() && deCall.size()>2 && (m_config.highlight_orange_callsigns().contains(deCall + ",") + or m_config.highlight_orange_callsigns().contains(deCall.left(3) + ";") or m_config.highlight_orange_callsigns().contains(deCall.left(2) + ";"))) { + ui->decodedTextBrowser->highlight_callsign(deCall, QColor(225,75,0), QColor(255,255,255), true); + if (m_config.alert_Enabled() && m_config.alert_Wanted() && !m_muted) play_Wanted = true; + } + if (m_config.highlight_orange() && deGrid.size()>3 && m_config.highlight_orange_callsigns().contains(deGrid)) { + ui->decodedTextBrowser->highlight_callsign(deGrid, QColor(225,75,0), QColor(255,255,255), true); + if (m_config.alert_Enabled() && m_config.alert_Wanted() && !m_muted) play_Wanted = true; + } + if (m_config.highlight_blue() && deCall.size()>2 && (m_config.highlight_blue_callsigns().contains(deCall + ",") + or m_config.highlight_blue_callsigns().contains(deCall.left(3) + ";") or m_config.highlight_blue_callsigns().contains(deCall.left(2) + ";"))) { + ui->decodedTextBrowser->highlight_callsign(deCall, QColor(0,100,255), QColor(255,255,255), true); + if (m_config.alert_Enabled() && m_config.alert_Wanted() && !m_muted) play_Wanted = true; + } + if (m_config.highlight_blue() && deGrid.size()>3 && m_config.highlight_blue_callsigns().contains(deGrid)) { + ui->decodedTextBrowser->highlight_callsign(deGrid, QColor(0,100,255), QColor(255,255,255), true); + if (m_config.alert_Enabled() && m_config.alert_Wanted() && !m_muted) play_Wanted = true; + } + // highlight directional calls + if (tw.size () > 2) { + if (m_config.highlight_orange() && tw[0]=="CQ" && m_config.highlight_orange_callsigns().contains("," + tw[1] + ",")) { + ui->decodedTextBrowser->highlight_callsign(tw[1], QColor(225,75,0), QColor(255,255,255), true); + if (m_config.alert_Enabled() && m_config.alert_Wanted() && !m_muted && tw[1]!="") play_Wanted = true; + } + if (m_config.highlight_blue() && tw[0]=="CQ" && m_config.highlight_blue_callsigns().contains("," + tw[1] + ",")) { + ui->decodedTextBrowser->highlight_callsign(tw[1], QColor(0,100,255), QColor(255,255,255), true); + if (m_config.alert_Enabled() && m_config.alert_Wanted() && !m_muted && tw[1]!="") play_Wanted = true; + } + } + // highlight Whitelist entries + if (ui->actionHighlight_Whitelist_entries->isChecked() && deCall.size()>2 && + ((deCall.contains(m_config.Whitelist1()) && m_config.Whitelist1() != "") + or (deCall.contains(m_config.Whitelist2()) && m_config.Whitelist2() != "") + or (deCall.contains(m_config.Whitelist3()) && m_config.Whitelist3() != "") + or (deCall.contains(m_config.Whitelist4()) && m_config.Whitelist4() != "") + or (deCall.contains(m_config.Whitelist5()) && m_config.Whitelist5() != "") + or (deCall.contains(m_config.Whitelist6()) && m_config.Whitelist6() != "") + or (deCall.contains(m_config.Whitelist7()) && m_config.Whitelist7() != "") + or (deCall.contains(m_config.Whitelist8()) && m_config.Whitelist8() != "") + or (deCall.contains(m_config.Whitelist9()) && m_config.Whitelist9() != "") + or (deCall.contains(m_config.Whitelist10()) && m_config.Whitelist10() != "") + or (deCall.contains(m_config.Whitelist11()) && m_config.Whitelist11() != "") + or (deCall.contains(m_config.Whitelist12()) && m_config.Whitelist12() != ""))) { + ui->decodedTextBrowser->highlight_callsign(deCall, QColor(170,0,127), QColor(255,255,255), true); + if (m_config.alert_Enabled() && m_config.alert_Wanted() && !m_muted) play_Wanted = true; + } + } + + // highlight callsigns worked B4 on band or worked today or from the Ignore List for MSK144 + if(ui->actionHighlightB4->isChecked() or ui->actionHighlightToday->isChecked() or ui->actionHighlightIgnored->isChecked() + or ui->actionHighlightTerritory1->isChecked() or ui->actionHighlightTerritory2->isChecked() + or ui->actionHighlightTerritory3->isChecked() or ui->actionHighlightTerritory4->isChecked()) { + QString today = QDateTime::currentDateTimeUtc().toString ("yyyy-MM-dd"); + QString yesterday = QDateTime::currentDateTimeUtc().addDays(-1).toString ("yyyy-MM-dd"); + QString deCall; + QString deGrid; + decodedtext.deCallAndGrid(/*out*/deCall,deGrid); + bool callB4onBand; + bool countryB4onBand; + bool gridB4onBand; + bool continentB4onBand; + bool CQZoneB4onBand; + bool ITUZoneB4onBand; + if (ui->actionHighlightB4->isChecked()) { + auto const& looked_up = m_logBook.countries ()->lookup (deCall); + m_logBook.match (deCall, m_mode, deGrid, looked_up, callB4onBand, countryB4onBand, gridB4onBand, + continentB4onBand, CQZoneB4onBand, ITUZoneB4onBand, m_currentBand); + if (callB4onBand) ui->decodedTextBrowser->highlight_callsign(deCall, QColor(195,195,195), QColor(0,0,0), true); + } + if (ui->actionHighlightToday->isChecked() && ( + txLog.contains(QRegularExpression{today + ",[0-9][0-9]:[0-9][0-9]:[0-9][0-9]," + (deCall + ",")}) + or (m_config.twoDays() && txLog.contains(QRegularExpression{yesterday + ",[0-9][0-9]:[0-9][0-9]:[0-9][0-9]," + (deCall + ",")})))) { + ui->decodedTextBrowser->highlight_callsign(deCall, QColor(100,100,100), QColor(255,255,0), true); + } + if (ui->actionHighlightIgnored->isChecked() && ignoreList.contains(deCall + ",")) { + ui->decodedTextBrowser->highlight_callsign(deCall, QColor(85,0,0), QColor(255,255,0), true); + } + // search for country names + if (ui->actionHighlightTerritory1->isChecked() or ui->actionHighlightTerritory2->isChecked() or + ui->actionHighlightTerritory3->isChecked() or ui->actionHighlightTerritory4->isChecked()) { + auto const& looked_up = m_logBook.countries ()->lookup (deCall); + auto countryName = looked_up.entity_name; + // do some obvious abbreviations + countryName.replace ("Islands", "Is."); + countryName.replace ("Island", "Is."); + countryName.replace ("North ", "N. "); + countryName.replace ("Northern ", "N. "); + countryName.replace ("South ", "S. "); + countryName.replace ("East ", "E. "); + countryName.replace ("Eastern ", "E. "); + countryName.replace ("West ", "W. "); + countryName.replace ("Western ", "W. "); + countryName.replace ("Central ", "C. "); + countryName.replace (" and ", " & "); + countryName.replace ("Republic", "Rep."); + countryName.replace ("United States of America", "U.S.A."); + countryName.replace ("United States", "U.S.A."); + countryName.replace ("Fed. Rep. of ", ""); + countryName.replace ("French ", "Fr."); + countryName.replace ("Asiatic", "AS"); + countryName.replace ("European", "EU"); + countryName.replace ("African", "AF"); + if (ui->actionHighlightTerritory1->isChecked() && countryName.contains(m_config.Territory1()) + && (m_config.Territory1()!="") && !ui->cbBypass->isChecked()) ui->decodedTextBrowser->highlight_callsign(deCall, QColor(115,43,245), QColor(255,255,255), true); + if (ui->actionHighlightTerritory2->isChecked() && countryName.contains(m_config.Territory2()) + && (m_config.Territory2()!="") && !ui->cbBypass->isChecked()) ui->decodedTextBrowser->highlight_callsign(deCall, QColor(115,43,245), QColor(255,255,255), true); + if (ui->actionHighlightTerritory3->isChecked() && countryName.contains(m_config.Territory3()) + && (m_config.Territory3()!="") && !ui->cbBypass->isChecked()) ui->decodedTextBrowser->highlight_callsign(deCall, QColor(115,43,245), QColor(255,255,255), true); + if (ui->actionHighlightTerritory4->isChecked() && countryName.contains(m_config.Territory4()) + && (m_config.Territory4()!="") && !ui->cbBypass->isChecked()) ui->decodedTextBrowser->highlight_callsign(deCall, QColor(115,43,245), QColor(255,255,255), true); + } + } + + // Highlight DX Call/Grid for MSK144 + if (!pounce && (m_config.highlight_DXcall () or m_config.alert_Enabled()) && (m_hisCall!="") && ((text.contains(QRegularExpression {"(\\w+) " + m_hisCall})) + || (decodedtext.string().contains("<...> " + m_hisCall)))) { + if (m_config.alert_Enabled() && m_config.alert_DXcall() && !m_muted) play_DXcall = true; + if (m_config.highlight_DXcall()) { + // repeated highlighting to override JTAlert + ui->decodedTextBrowser->highlight_callsign(m_hisCall, QColor(255,0,0), QColor(255,255,255), true); + QTimer::singleShot (500, [=] {ui->decodedTextBrowser->highlight_callsign(m_hisCall, QColor(255,0,0), QColor(255,255,255), true);}); + QTimer::singleShot (1000, [=] {ui->decodedTextBrowser->highlight_callsign(m_hisCall, QColor(255,0,0), QColor(255,255,255), true);}); + QTimer::singleShot (2500, [=] {ui->decodedTextBrowser->highlight_callsign(m_hisCall, QColor(255,0,0), QColor(255,255,255), true);}); + } + } + if (!pounce && (m_config.highlight_DXgrid () or m_config.alert_Enabled()) && (m_hisGrid!="") && (decodedtext.string().contains(m_hisGrid.left(4)))) { + if (m_config.highlight_DXgrid()) ui->decodedTextBrowser->highlight_callsign(m_hisGrid.left(4), QColor(0,0,200), QColor(255,255,255), true); + if (m_config.alert_Enabled() && m_config.alert_DXcall() && !m_muted) play_DXcall = true; + } + QTimer::singleShot (100, [=] { + if (m_config.alert_Enabled() && ((m_config.alert_DXcall() && play_DXcall && m_hisCall!="") or (m_config.alert_Wanted() && play_Wanted))) { +#ifdef WIN32 + QAudioOutput info(QAudioDeviceInfo::defaultOutputDevice()); + QString audioPath = QCoreApplication::applicationDirPath() + "/sounds" + m_config.voicesPath() + "/"; + QAudioFormat format; + format.setCodec("audio/pcm"); + format.setSampleRate (48000); + format.setChannelCount (1); + format.setSampleSize (16); + format.setSampleType(QAudioFormat::SignedInt); + QAudioOutput* audio; + audio = new QAudioOutput(format, this); + connect(audio, SIGNAL(stateChanged(QAudio::State)), this, SLOT(handleStateChanged(QAudio::State))); + QFile *effect1 = new QFile(this); + if (m_config.alert_DXcall() && play_DXcall) effect1->setFileName(QString("%1/%2").arg(audioPath, "DXcall.wav")); + else if (m_config.alert_Wanted() && play_Wanted) effect1->setFileName(QString("%1/%2").arg(audioPath, "Wanted.wav")); + effect1->open(QIODevice::ReadOnly); + audio->start(effect1); +#else + QString audioPath = QCoreApplication::applicationDirPath() + "/sounds" + m_config.voicesPath() + "/"; + if (m_config.alert_DXcall() && play_DXcall) QSound::play(audioPath + "DXcall.wav"); // for Linux and macOS + else if (m_config.alert_DXcall() && play_Wanted) QSound::play(audioPath + "Wanted.wav"); // for Linux and macOS +#endif + play_DXcall = false; + play_Wanted = false; + } + }); + + m_bDecoded=true; + auto_sequence (decodedtext, ui->sbFtol->value (), std::numeric_limits<unsigned>::max ()); + postDecode (true, decodedtext.string ()); +// writeAllTxt(message); + write_all("Rx",message); + bool stdMsg = decodedtext.report(m_baseCall, + Radio::base_callsign(ui->dxCallEntry->text()),m_rptRcvd); + if (stdMsg) pskPost (decodedtext); + if(ui->actionEnable_QSY_Popups->isChecked() || m_qsymonitorWidget) showQSYMessage(message); + } + + float fracTR=float(k)/(12000.0*m_TRperiod); + decodeNow=false; + if(fracTR>0.92) { + m_dataAvailable=true; + fast_decode_done(); + m_bFastDone=true; + } + + m_k0=k; + if(m_diskData and m_k0 >= dec_data.params.kin - 7 * 512) decodeNow=true; + if(!m_diskData and m_tRemaining<0.35 and !m_bFastDecodeCalled) decodeNow=true; + if(m_mode=="MSK144") decodeNow=false; + + if(decodeNow) { + m_dataAvailable=true; + m_t0=0.0; + m_t1=k/12000.0; + m_kdone=k; + dec_data.params.newdat=1; + if(!m_decoderBusy) { + m_bFastDecodeCalled=true; + decode(); + } + } + + if(decodeNow or m_bFastDone) { + if(!m_diskData and (m_saveAll or m_saveDecoded)) { + QDateTime now {QDateTime::currentDateTimeUtc()}; + int n=fmod(double(now.time().second()),m_TRperiod); + if(n<(m_TRperiod/2)) n=n+m_TRperiod; + auto const& period_start = now.addSecs (-n); + m_fnameWE = m_config.save_directory ().absoluteFilePath (period_start.toString ("yyMMdd_hhmmss")); + if(m_saveAll or m_bAltV or (m_bDecoded and m_saveDecoded) or (m_mode!="MSK144")) { + m_bAltV=false; + // the following is potential a threading hazard - not a good + // idea to pass pointer to be processed in another thread + m_saveWAVWatcher.setFuture (QtConcurrent::run (std::bind (&MainWindow::save_wave_file, + this, m_fnameWE, &dec_data.d2[0], int(m_TRperiod*12000.0), m_config.my_callsign(), + m_config.my_grid(), m_mode, m_nSubMode, m_freqNominal, m_hisCall, m_hisGrid))); + } + if(m_mode!="MSK144") { + killFileTimer.start (int(750.0*m_TRperiod)); //Kill 3/4 period from now + } + } + m_bFastDone=false; + } + float tsec=0.001*(QDateTime::currentMSecsSinceEpoch() - ms0); + m_fCPUmskrtd=0.9*m_fCPUmskrtd + 0.1*tsec; +} + +void MainWindow::showSoundInError(const QString& errorMsg) +{ + if (m_splash && m_splash->isVisible ()) m_splash->hide (); + MessageBox::critical_message (this, tr ("Error in Sound Input"), errorMsg); +} + +void MainWindow::showSoundOutError(const QString& errorMsg) +{ + if (m_splash && m_splash->isVisible ()) m_splash->hide (); + MessageBox::critical_message (this, tr ("Error in Sound Output"), errorMsg); +} + +void MainWindow::showStatusMessage(const QString& statusMsg) +{ + statusBar()->showMessage(statusMsg, 5000); +} + +void MainWindow::showQSYMessage(QString message) +{ + QString the_line = message; + QString qCall = QString(Radio::base_callsign(m_config.my_callsign ())); + QString qDXCall = QString(Radio::base_callsign(ui->dxCallEntry->text())); + if(the_line.mid(22).contains(QString("."))) { + if(!(the_line.contains("OKQSY") || the_line.contains("NOQSY"))) { + QStringList bhList = the_line.split(" ",SkipEmptyParts); + QString the_message = ""; + QString the_call = ""; + for (const QString &element : bhList) { + if(element.contains(QString("."))) { + the_message = element.mid(element.indexOf("." ) + 1); + the_call = element.mid(0,element.indexOf("." )); + if(the_message.length() > 0) { + QString finalMatch = ""; + QRegularExpression re1("[A-Z479][V0123456789ABCDEFGHIJKLRW][0-9]{3}"); + QRegularExpressionMatch match = re1.match(the_message); + if(match.hasMatch()) { + finalMatch = match.captured(); + if(the_call == qCall && ui->actionEnable_QSY_Popups->isChecked()) { + if(m_QSYMessageWidget) m_QSYMessageWidget->write_settings(); + m_QSYMessageWidget.reset (new QSYMessage(finalMatch, qCall, m_settings, &m_config)); + + //connect to signal finish + connect (this, &MainWindow::finished, &QSYMessage::close); + + //connect to signal from QSYMessage + connect (m_QSYMessageWidget.data (), &QSYMessage::sendReply, this, &MainWindow::reply_tx5,static_cast<Qt::ConnectionType>(Qt::UniqueConnection)); + m_QSYMessageWidget->setWindowFlags(m_QSYMessageWidget->windowFlags() | Qt::WindowStaysOnTopHint); + m_QSYMessageWidget->show(); + m_QSYMessageWidget->raise(); + m_QSYMessageWidget->activateWindow(); + } + if(m_qsymonitorWidget && finalMatch.mid(0,1) !='Z') m_qsymonitorWidget->getQSYData(QString(bhList[0]) + " " + the_call + " " + finalMatch); + if (m_config.alert_Enabled() && m_config.alert_QSYmessage() && (the_line.contains(qCall) or the_line.contains(qDXCall))) alertQSYmessage(); + } + } + } + } + } + else if (((the_line.mid(22).contains(qDXCall + QString(".") + "OKQSY") || the_line.mid(22).contains(qDXCall +QString(".") + "NOQSY"))) && ui->actionEnable_QSY_Popups->isChecked()) { + QString yesOrNo = " "; + if (the_line.contains("OKQSY")) { + yesOrNo = QString(" OKQSY"); + } else { + yesOrNo = QString(" NOQSY"); + } + on_stopTxButton_clicked(); + QString qNewMessage = QString("$ ") + qDXCall + yesOrNo; + if(m_QSYMessageWidget) m_QSYMessageWidget->write_settings(); + m_QSYMessageWidget.reset (new QSYMessage(qNewMessage, qDXCall, m_settings, &m_config)); + + //connect to signal finish + connect (this, &MainWindow::finished, &QSYMessage::close); + m_QSYMessageWidget->show(); + m_QSYMessageWidget->raise(); + m_QSYMessageWidget->activateWindow(); + if (m_config.alert_Enabled() && m_config.alert_QSYmessage() && (the_line.contains(qCall) or the_line.contains(qDXCall))) alertQSYmessage(); + } + } +} + +void MainWindow::on_actionSettings_triggered() // Setup Dialog (Settings dialog) +{ + inSettings = true; + keep_frequency = true; + m_config.read_CALL3_version(); + // things that might change that we need know about + auto callsign = m_config.my_callsign (); + auto my_grid = m_config.my_grid (); + SpecOp nContest0=m_specOp; + auto psk_on = m_config.spot_to_psk_reporter (); + if (QDialog::Accepted == m_config.exec ()) { + checkMSK144ContestType(); + if (m_config.my_callsign () != callsign) { + m_baseCall = Radio::base_callsign (m_config.my_callsign ()); + ui->tx1->setEnabled (elide_tx1_not_allowed () || ui->tx1->isEnabled ()); + morse_(const_cast<char *> (m_config.my_callsign ().toLatin1().constData()), + const_cast<int *> (icw), &m_ncw, (FCL)m_config.my_callsign().length()); + } + if (m_config.my_callsign () != callsign || m_config.my_grid () != my_grid) { + statusUpdate (); + } + on_dxGridEntry_textChanged (m_hisGrid); // recalculate distances in case of units change + enable_DXCC_entity (m_config.DXCC ()); // sets text window proportions and (re)inits the logbook + + pskSetLocal (); + // this will close the connection to PSKReporter if it has been + // disabled + if (psk_on && !m_config.spot_to_psk_reporter ()) + { + m_psk_Reporter.sendReport (true); + } + + m_tci_audio = (m_config.tci_audio() && m_config.is_tci()); // update m_tci_audio + bool was_monitoring = m_monitoring; + if (m_monitoring && (m_config.restart_tci () or !m_tci_audio)) on_monitorButton_clicked (false); + if (!m_tci_audio) { + if(m_config.restart_audio_input () && !m_config.audio_input_device ().isNull ()) { + Q_EMIT startAudioInputStream (m_config.audio_input_device () + , m_rx_audio_buffer_frames + , m_detector, m_downSampleFactor + , m_config.audio_input_channel ()); + } + + if(m_config.restart_audio_output () && !m_config.audio_output_device ().isNull ()) { + Q_EMIT initializeAudioOutputStream (m_config.audio_output_device () + , AudioDevice::Mono == m_config.audio_output_channel () ? 1 : 2 + , m_tx_audio_buffer_frames); + } + } + if (was_monitoring && (m_config.restart_tci () or !m_tci_audio) && !m_monitoring && !m_transmitting && g_iptt!=1) { + if(m_mode=="MSK144") { + if (m_tci_audio) { + if (ui->bandComboBox->currentText()!="OOB") { + Q_EMIT m_config.transceiver_trfrequency(1000.0); + } else { + rigFailure("TCI audio cannot be started as frequency is OOB"); + } + } else { + Q_EMIT transmitFrequency (1000.0); + } + } else { + if (m_tci_audio) { + if (ui->bandComboBox->currentText()!="OOB") { + Q_EMIT m_config.transceiver_trfrequency(ui->TxFreqSpinBox->value () - m_XIT); + } else { + rigFailure("TCI audio cannot be started as frequency is OOB"); + } + } else { + Q_EMIT transmitFrequency (ui->TxFreqSpinBox->value() - m_XIT); + } + } + on_monitorButton_clicked (true); // reset audio streams + } + + if (rigFailed or ui->bandComboBox->currentText()=="OOB") displayDialFrequency (); // reset frequency only when needed + bool vhf {m_config.enable_VHF_features()}; + m_wideGraph->setVHF(vhf); + if (!vhf) ui->sbSubmode->setValue (0); + + setup_status_bar (vhf); + bool b = vhf && (m_mode=="JT4" or m_mode=="JT65" or + m_mode=="JT9" or m_mode=="MSK144" or m_mode=="Q65"); + if (b) { + VHF_features_enabled(b); + set_mode (m_mode); + VHF_features_enabled(b); + } + + m_config.transceiver_online (); + if(!m_bFastMode) setXIT (ui->TxFreqSpinBox->value ()); + if ((m_config.single_decode () && !m_mode.startsWith ("FST4")) || m_mode=="JT4") { + ui->lh_decodes_title_label->setText(tr ("Single-Period Decodes")); + ui->rh_decodes_title_label->setText(tr ("Average Decodes")); + } + + update_watchdog_label (); + if(!m_splitMode) ui->cbCQTx->setChecked(false); + if(!m_config.enable_VHF_features()) { + ui->actionInclude_averaging->setVisible(false); + ui->actionInclude_correlation->setVisible (false); + ui->actionInclude_averaging->setChecked(false); + ui->actionInclude_correlation->setChecked(false); + ui->actionEnable_AP_JT65->setVisible(false); + ui->actionAuto_Clear_Avg->setVisible(false); + } + if(!(m_config.enable_VHF_features() && m_mode=="Q65")) { + ui->actionDisable_clicks_on_waterfall->setVisible(false); + } + m_specOp=m_config.special_op_id(); + if(m_specOp!=nContest0) { + ui->tx1->setEnabled(true); + ui->txb1->setEnabled(true); + set_mode(m_mode); + } + chkFT4(); + if(SpecOp::EU_VHF==m_specOp and m_config.my_grid().size()<6) { + MessageBox::information_message (this, + "EU VHF Contest messages require a 6-character locator."); + } + if((m_specOp==SpecOp::FOX or m_specOp==SpecOp::HOUND) and + m_mode!="FT8") { + MessageBox::information_message (this, + "Fox-and-Hound operation is available only in FT8 mode.\nGo back and change your selection."); + } + ui->labDXped->setVisible(SpecOp::NONE != m_specOp); + set_mode(m_mode); + + // ensure a balanced layout + qreal pointSize = m_config.text_font().pointSizeF(); + if (m_config.PWR_and_SWR()) { + ui->label->setMinimumWidth (2.8*pointSize + 8); + ui->label->setAlignment(Qt::AlignCenter); + ui->outAttenuation->setMinimumWidth (2.8*pointSize + 8); + } + + configActiveStations(); + check_button_color(); + rigFailed = false; + keep_frequency = false; + inSettings = false; + } else { + keep_frequency = false; + inSettings = false; + } +} + +void MainWindow::on_monitorButton_clicked (bool checked) +{ + if (!m_transmitting) { + auto prior = m_monitoring; + monitor (checked); + if (checked && !prior) { + if (m_config.monitor_last_used () && m_mode!="Echo") { + // put rig back where it was when last in control + setRig (m_lastMonitoredFrequency); + setXIT (ui->TxFreqSpinBox->value ()); + } + // ensure FreqCal triggers + if(m_mode=="FST4W") { + on_sbFST4W_RxFreq_valueChanged(ui->sbFST4W_RxFreq->value()); + } else { + on_RxFreqSpinBox_valueChanged (ui->RxFreqSpinBox->value ()); + } + } + //Get Configuration in/out of strict split and mode checking + m_config.sync_transceiver (true, checked); + } else { + ui->monitorButton->setChecked (false); // disallow + } + if(m_mode=="Echo") m_echoRunning=false; + check_button_color(); +} + +void MainWindow::monitor (bool state) +{ + ui->monitorButton->setChecked (state); + if (state) { + m_diskData = false; // no longer reading WAV files + if (!m_monitoring) { + float t_rxdelay=0.001*(QDateTime::currentMSecsSinceEpoch() - m_msEchoTxStart); + int ms=int(1000*(m_tEcho-t_rxdelay)); + if (m_tci_audio) { + if (ui->bandComboBox->currentText()!="OOB") { + if(ms>=10) { + QTimer::singleShot (ms, [=] {Q_EMIT m_config.transceiver_audio(true);}); + } else { + Q_EMIT m_config.transceiver_audio(true); + } + } else { + rigFailure("TCI audio cannot be started as frequency is OOB"); + } + } else { + if(ms>=10) { + QTimer::singleShot (ms, [=] {resumeAudioInputStream();}); + } else { + Q_EMIT resumeAudioInputStream (); + } + } + } + } else { + if (m_tci_audio) { + if (ui->bandComboBox->currentText()!="OOB") { + Q_EMIT m_config.transceiver_audio(false); + } else { + rigFailure("TCI audio cannot be stopped as frequency is OOB"); + } + } else { + Q_EMIT suspendAudioInputStream (); + } + } + m_monitoring = state; + check_button_color(); +} + +void MainWindow::on_actionAbout_triggered() //Display "About" +{ + CAboutDlg {this}.exec (); +} + +void MainWindow::on_autoButton_clicked (bool checked) +{ + if (ui->DX_Call_Button->isChecked() && m_specOp==SpecOp::HOUND && m_config.superFox() && !m_bDoubleClicked) return; // for Wait & Call + m_config.transceiver_tune (false); // reset rig tuning + if (checked && ui->tuneButton->isChecked() && !(m_mode=="WSPR" || m_mode=="FST4W")) return; // not allowed while tuning + stopWRTimer.stop(); // stop any Wait & Reply timeout + if (!checked && ui->DX_Call_Button->isChecked()) { + stopWCTimer.stop(); // stop any Wait & Call timeout + ui->DX_Call_Button->click (); // disable Wait & Call + no_wait_and_call = false; // reset Wait & Call + } + m_specOp=m_config.special_op_id(); + ui->pbBandHopping->setChecked(false); // disable band hopping when Tx is enabled + if (checked) { + m_auto = checked; + QTimer::singleShot (3000, [=] {pounce = false;}); // ensure to select only CQ messages + } else { + pounce = false; + m_auto = false; + m_bCallingCQ = false; + ui->autoButton->setChecked(false); // ensure autoButton is unchecked + filtered = false; + ignored = false; + m_muted = false; + Dpoints=0; // reset points + maxDPoints=0; // reset points + dBpoints=-28; // reset points + dBpoints2=99; // reset points + maxdBPoints=-28; // reset points + mindBPoints=99; // reset points + } + m_maxPoints=-1; + if (checked && ui->respondComboBox->isVisible() && ui->respondComboBox->currentText() != "CQ: None" + && CALLING == m_QSOProgress) { + m_bAutoReply = false; // ready for next + m_bCallingCQ = true; // allows tail-enders to be picked up + } + statusUpdate (); + m_bEchoTxOK=false; + if(m_mode=="Echo" and m_auto) { + m_nclearave=1; + echocom_.nsum=0; + } + m_tAutoOn=QDateTime::currentMSecsSinceEpoch()/1000; + if(m_mode=="Echo") m_echoRunning=false; + check_button_color(); +} + +void MainWindow::on_sbTxPercent_valueChanged (int n) +{ + update_dynamic_property (ui->sbTxPercent, "notx", !n); +} + +void MainWindow::auto_tx_mode (bool state) +{ + ui->autoButton->setChecked (state); + on_autoButton_clicked (state); +} + +void MainWindow::keyPressEvent (QKeyEvent * e) +{ + if(SpecOp::FOX == m_specOp) { + switch (e->key()) { + case Qt::Key_Return: + doubleClickOnCall2(Qt::KeyboardModifier(Qt::ShiftModifier + Qt::ControlModifier + Qt::AltModifier)); + return; + case Qt::Key_Enter: + doubleClickOnCall2(Qt::KeyboardModifier(Qt::ShiftModifier + Qt::ControlModifier + Qt::AltModifier)); + return; + case Qt::Key_Backspace: + qDebug() << "Key Backspace"; + return; + case Qt::Key_X: + if(e->modifiers() & Qt::AltModifier) { + foxTest(); + return; + } + } + QMainWindow::keyPressEvent (e); + } + + // Why shall RETURN switch Tx on when in Hound mode? Makes little sense and confuses many OMs! +// if(SpecOp::HOUND == m_specOp) { +// switch (e->key()) { +// case Qt::Key_Return: +// auto_tx_mode(true); +// return; +// case Qt::Key_Enter: +// auto_tx_mode(true); +// return; +// } +// QMainWindow::keyPressEvent (e); +// } + + int n; + bool bAltF1F6=m_config.alternate_bindings(); + switch(e->key()) + { + case Qt::Key_A: + if(m_mode=="Q65" && e->modifiers() & Qt::AltModifier) { + m_EMECall.clear(); + qmapcom.ndecodes=0; + readWidebandDecodes(); + } + return; + case Qt::Key_B: + if(m_mode=="FT4" && e->modifiers() & Qt::AltModifier) { + on_pbBestSP_clicked(); + } + return; + case Qt::Key_C: + if(e->modifiers() & Qt::AltModifier) { + int n=ui->respondComboBox->currentIndex()+1; + if(n>2) n=0; + ui->respondComboBox->setCurrentIndex(n); + } + return; + case Qt::Key_D: + if(m_mode != "WSPR" && e->modifiers() & Qt::ShiftModifier) { + if(!m_decoderBusy) { + dec_data.params.newdat=0; + dec_data.params.nagain=0; + decode(); + return; + } + } + break; + case Qt::Key_F1: + if(bAltF1F6) { + auto_tx_mode(true); + on_txb6_clicked(); + return; + } else { + on_actionOnline_User_Guide_triggered(); + return; + } + case Qt::Key_F2: + if(bAltF1F6) { + auto_tx_mode(true); + on_txb2_clicked(); + return; + } else { + on_actionSettings_triggered(); + return; + } + case Qt::Key_F3: + if(bAltF1F6) { + auto_tx_mode(true); + on_txb3_clicked(); + return; + } else { + on_actionKeyboard_shortcuts_triggered(); + return; + } + case Qt::Key_F4: + if(bAltF1F6) { + auto_tx_mode(true); + on_txb4_clicked(); + return; + } else { + clearDX (); + ui->dxCallEntry->setFocus(); + return; + } + case Qt::Key_F5: + if(bAltF1F6) { + auto_tx_mode(true); + on_txb5_clicked(); + return; + } else { + on_actionSpecial_mouse_commands_triggered(); + return; + } + case Qt::Key_F6: + if(bAltF1F6) { + int n=ui->respondComboBox->currentIndex()+1; + if(n>2) n=0; + ui->respondComboBox->setCurrentIndex(n); + } else { + if(e->modifiers() & Qt::ShiftModifier) { + on_actionDecode_remaining_files_in_directory_triggered(); + } else { + on_actionOpen_next_in_directory_triggered(); + } + } + return; + case Qt::Key_F11: + if((e->modifiers() & Qt::ControlModifier) and (e->modifiers() & Qt::ShiftModifier)) { + m_bandEdited = true; + band_changed(m_freqNominal-1000); + } else { + n=11; + if(e->modifiers() & Qt::ControlModifier) n+=100; + if(e->modifiers() & Qt::ShiftModifier) { + int offset=60; + if(m_mode=="FT4") offset=90; + ui->TxFreqSpinBox->setValue(ui->TxFreqSpinBox->value()-offset); + } else{ + bumpFqso(n); + } + } + return; + case Qt::Key_F12: + if((e->modifiers() & Qt::ControlModifier) and (e->modifiers() & Qt::ShiftModifier)) { + m_bandEdited = true; + band_changed(m_freqNominal+1000); + } else { + n=12; + if(e->modifiers() & Qt::ControlModifier) n+=100; + if(e->modifiers() & Qt::ShiftModifier) { + int offset=60; + if(m_mode=="FT4") offset=90; + ui->TxFreqSpinBox->setValue(ui->TxFreqSpinBox->value()+offset); + } else { + bumpFqso(n); + } + } + return; + case Qt::Key_Escape: + m_nextCall=""; + on_stopTxButton_clicked(); + abortQSO(); + return; + case Qt::Key_E: + if((e->modifiers() & Qt::ShiftModifier) and m_specOp!=SpecOp::FOX and m_specOp!=SpecOp::HOUND) { + ui->txFirstCheckBox->setChecked(false); + return; + } + else if((e->modifiers() & Qt::ControlModifier) and m_specOp!=SpecOp::FOX and m_specOp!=SpecOp::HOUND) { + ui->txFirstCheckBox->setChecked(true); + return; + } + break; + case Qt::Key_F: + if(e->modifiers() & Qt::ControlModifier) { + if(ui->tabWidget->currentIndex()==0) { + ui->tx5->clearEditText(); + ui->tx5->setFocus(); + } + return; + } + break; + case Qt::Key_G: + if(e->modifiers() & Qt::AltModifier) { + genStdMsgs (m_rpt, true); + return; + } + break; + case Qt::Key_H: + if(e->modifiers() & Qt::AltModifier) { + on_stopTxButton_clicked(); + return; + } + break; + case Qt::Key_I: + if(e->modifiers() & Qt::ControlModifier) { + addCallsignToignoreList(); + return; + } + break; + case Qt::Key_L: + if(e->modifiers() & Qt::ControlModifier) { + lookup(); + genStdMsgs(m_rpt); + return; + } + break; + case Qt::Key_O: + if(e->modifiers() & Qt::ControlModifier) { + on_actionOpen_triggered(); + return; + } + else if(e->modifiers() & Qt::AltModifier) { + bool ok; + auto call = QInputDialog::getText (this, tr ("Change Operator"), tr ("New operator:"), + QLineEdit::Normal, m_config.opCall (), &ok); + if (ok) { + m_config.opCall (call); + } + return; + } + break; + case Qt::Key_R: + if(m_mode=="Q65" and e->modifiers() & Qt::ShiftModifier and + e->modifiers() & Qt::ControlModifier) { + if(m_specOp==SpecOp::Q65_PILEUP) { + refreshPileupList(); + } else { + m_fetched=0; + readWidebandDecodes(); + } + return; + } + if(e->modifiers() & Qt::AltModifier) { + if(!m_send_RR73) on_txrb4_doubleClicked(); + return; + } + if(e->modifiers() & Qt::ControlModifier) { + if(m_send_RR73) on_txrb4_doubleClicked(); + return; + } + break; + case Qt::Key_X: + + if(e->modifiers() & Qt::AltModifier) { + //foxTest(); + return; + } + } + + QMainWindow::keyPressEvent (e); +} + +void MainWindow::handleVerifyMsg(int status, QDateTime ts, QString callsign, QString code, unsigned int hz, QString const &response) +{ + (void)status; + (void)code; + if (response.length() > 0) { + QString msg = FoxVerifier::formatDecodeMessage(ts, callsign, hz, response); + if (msg.length() > 0) { + // Hound label + if ((ui->labDXped->text().contains("Hound") && msg.contains(" verified"))) { + verified = true; + ui->labDXped->setStyleSheet("QLabel {background-color: #00ff00; color: black;}"); + } + ui->decodedTextBrowser->displayDecodedText(DecodedText{msg}, m_config.my_callsign(), m_mode, m_config.DXCC(), + m_logBook, m_currentBand, m_config.ppfx(), false, false, 0.0, false, -99, "", true); + write_all("Ck",msg); + } + } + LOG_INFO(QString("FoxVerifier response for [%1]: - [%2]").arg(callsign).arg(response).toStdString()); +} + +QString MainWindow::userAgent() { + // see User-Agent format definition https://www.rfc-editor.org/rfc/rfc9110#name-user-agent + // + QString platform = "(" + QSysInfo::prettyProductName()+"; "+QSysInfo::productType() + " " + QSysInfo::productVersion() + "; " + + QSysInfo::currentCpuArchitecture() + "; " + + QString("rv:%1").arg(QSysInfo::kernelVersion()) + ")"; + QString userAgent = QString{"WSJT-X/" + version() + "_" + m_revision}.simplified() + " " +platform; + return userAgent; + } + +void MainWindow::bumpFqso(int n) //bumpFqso() +{ + int i; + bool ctrl = (n>=100); + n=n%100; + i=ui->RxFreqSpinBox->value(); + bool bTrackTx=ui->TxFreqSpinBox->value() == i; + if(n==11) i--; + if(n==12) i++; + if (ui->RxFreqSpinBox->isEnabled ()) { + ui->RxFreqSpinBox->setValue (i); + } + if(ctrl and m_mode=="WSPR") { + ui->WSPRfreqSpinBox->setValue(i); + } else { + if(ctrl and bTrackTx) { + ui->TxFreqSpinBox->setValue (i); + } + } +} + +void MainWindow::displayDialFrequency () +{ + if (ui->actionUse_Dark_Style->isChecked()) ui->bandComboBox->setStyleSheet("QLineEdit {background-color: #31363b}"); // initialize dark style at startup + Frequency dial_frequency {m_rigState.ptt () && m_rigState.split () ? + m_rigState.tx_frequency () : m_rigState.frequency ()}; + + // lookup band + auto const& band_name = m_config.bands ()->find (dial_frequency); + if (m_lastBand != band_name or m_freqNominalPeriod != m_freqNominal) + { + // only change this when necessary as we get called a lot and it + // would trash any user input to the band combo box line edit + if (m_lastBand != band_name) { + ui->bandComboBox->setCurrentText (band_name.size () ? band_name : m_config.bands ()->oob ()); + m_wideGraph->setRxBand (band_name); + m_lastBand = band_name; + band_changed(dial_frequency); + } + // prevent wrong frequencies for all.txt, PSK Reporter and highlighting for late decodes after band changes + m_displayBand = false; + no_decodes_to_UDP = true; // prevent wrong frequencies for devices connected via UDP + QTimer::singleShot ((int(600.0*m_TRperiod)), [=] { + m_freqNominalPeriod = m_freqNominal; + m_currentBandPeriod = m_currentBand; + m_displayBand = true; + no_decodes_to_UDP = false; // prevent wrong frequencies for devices connected via UDP + pskSetLocal (); // prevent wrong frequencies for PSK Reporter antenna description + }); + } + + // search working frequencies for one we are within 10kHz of (1 Mhz + // of on VHF and up) + bool valid {false}; + quint64 min_offset {99999999}; + for (auto const& item : *m_config.frequencies ()) + { + // we need to do specific checks for above and below here to + // ensure that we can use unsigned Radio::Frequency since we + // potentially use the full 64-bit unsigned range. + auto const& working_frequency = item.frequency_; + auto const& offset = dial_frequency > working_frequency ? + dial_frequency - working_frequency : + working_frequency - dial_frequency; + if (offset < min_offset) { + min_offset = offset; + } + } + if (min_offset < 10000u || (m_config.enable_VHF_features() && min_offset < 1000000u)) { + valid = true; + } + + update_dynamic_property (ui->labDialFreq, "OOB", !valid); + ui->labDialFreq->setText (Radio::pretty_frequency_MHz_string (dial_frequency)); + if(m_mode=="MSK144" && !msk144qsy) m_msk144basefreq = dial_frequency; // MSK144 QSY + + if (ui->actionBand_Buttons->isChecked()) check_button_color(); // update band buttons when dialling the VFO +} + +void MainWindow::stopWRTimeout() +{ + auto_tx_mode(false); +} + +void MainWindow::stopWCTimeout() +{ + if (ui->DX_Call_Button->isChecked()) { + ui->DX_Call_Button->click (); + auto_tx_mode(false); + } + no_wait_and_call = false; +} + +void MainWindow::statusChanged() +{ + m_specOp=m_config.special_op_id(); // update m_specOp + if (m_specOp==SpecOp::Q65_PILEUP && m_mode != "Q65") on_actionQ65_triggered(); + QTimer::singleShot (50, [=] { // only allow Wait & Call where it is appropriate + if((m_mode.startsWith("JT") or m_mode=="WSPR" or m_mode=="Echo" or m_mode=="FST4W" + or (m_specOp!=SpecOp::NONE and m_specOp!=SpecOp::HOUND) + or !ui->cbAutoSeq->isChecked() or m_hisCall=="") && ui->DX_Call_Button->isChecked()) + ui->DX_Call_Button->click (); + }); + statusUpdate (); + QFile f {m_config.temp_dir ().absoluteFilePath ("wsjtx_status.txt")}; + if(f.open(QFile::WriteOnly | QIODevice::Text)) { + QTextStream out(&f); + QString tmpGrid = m_hisGrid; + if (!tmpGrid.size ()) tmpGrid="n/a"; // Not Available + out << qSetRealNumberPrecision (12) << (m_freqNominal / 1.e6) + << ";" << m_mode << ";" << m_hisCall << ";" + << ui->rptSpinBox->value() << ";" << m_mode << ";" << tmpGrid +#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0) + << Qt::endl +#else + << endl +#endif + ; + f.close(); + } else { + if (m_splash && m_splash->isVisible ()) m_splash->hide (); + MessageBox::warning_message (this, tr ("Status File Error") + , tr ("Cannot open \"%1\" for writing: %2") + .arg (f.fileName ()).arg (f.errorString ())); + } + on_dxGridEntry_textChanged(m_hisGrid); + if (m_specOp!=SpecOp::HOUND) { + ui->txb2->setEnabled(true); + ui->txrb2->setEnabled(true); + ui->txb4->setEnabled(true); + ui->txrb4->setEnabled(true); + ui->txb5->setEnabled(true); + ui->txrb5->setEnabled(true); + ui->txb6->setEnabled(true); + ui->txrb6->setEnabled(true); + ui->houndButton->setChecked(false); + } + if (m_specOp==SpecOp::FOX) { + if (m_config.superFox()) ui->comboBoxCQ->setCurrentIndex(0); // No directional calls supported yet for SuperFox mode + } + if (m_config.enable_VHF_features() && (m_mode=="JT4" or m_mode=="Q65" or m_mode=="JT65")) { + ui->actionInclude_averaging->setVisible(true); + ui->actionAuto_Clear_Avg->setVisible(true); + } else { + ui->actionInclude_averaging->setVisible(false); + ui->actionAuto_Clear_Avg->setVisible(false); + } + if (m_config.enable_VHF_features() && m_mode=="Q65") { + ui->actionDisable_clicks_on_waterfall->setVisible(true); + } else { + ui->actionDisable_clicks_on_waterfall->setVisible(false); + } + if (m_mode=="JT4" or m_mode=="Q65" or m_mode=="JT65") { + if (ui->actionInclude_averaging->isVisible() && ui->actionInclude_averaging->isChecked()) { + ui->lh_decodes_title_label->setText(tr ("Single-Period Decodes")); + ui->rh_decodes_title_label->setText(tr ("Average Decodes")); + } else { + if (m_config.enable_VHF_features()) { + ui->lh_decodes_title_label->setText(tr ("Band Activity")); + ui->rh_decodes_title_label->setText(tr ("Decodes containing My Call")); + } else { + ui->lh_decodes_title_label->setText(tr ("Band Activity")); + ui->rh_decodes_title_label->setText(tr ("Rx Frequency")); + } + } + } + if (m_mode=="Q65" && m_config.enable_VHF_features()) { + ui->pb15A->setVisible(true); + ui->pb15C->setVisible(true); + ui->pb30B->setVisible(true); + ui->pb60C->setVisible(true); + ui->pb60D->setVisible(true); + ui->pb60E->setVisible(true); + } else { + ui->pb15C->setVisible(false); + ui->pb15A->setVisible(false); + ui->pb30B->setVisible(false); + ui->pb60C->setVisible(false); + ui->pb60D->setVisible(false); + ui->pb60E->setVisible(false); + } + if (SpecOp::FOX==m_specOp) { + ui->pbFreeText->setVisible(true); + ui->cbSendMsg->setVisible(true); + ui->txb6->click(); + if (m_config.superFox()) { + ui->sbNslots->setVisible(true); + m_XIT=0; + if(ui->cbSendMsg->isChecked()) { + ui->sbNslots->setValue(2); + m_Nslots=2; + } else { + ui->sbNslots->setValue(5); + m_Nslots=5; + } + } else { + ui->sbNslots->setVisible(true); + ui->sbNslots->setValue(m_Nslots0); + } + } else { + ui->sbNslots->setVisible(true); + ui->pbFreeText->setVisible(false); + ui->cbSendMsg->setVisible(false); + ui->sbNslots->setValue(m_Nslots0); + } + if (SpecOp::HOUND==m_specOp) ui->cbRxAll->setVisible(!m_config.superFox()); + if ((SpecOp::HOUND!=m_specOp && SpecOp::FOX!=m_specOp) or !m_config.superFox()) { + m_wideGraph->setSuperFox(false); + m_wideGraph->setSuperHound(false); + } + if (ui->tx1->text()=="" && !(m_mode=="FT8" && (SpecOp::HOUND==m_specOp or SpecOp::FOX==m_specOp)) + && !m_bDoubleClicked) ui->txb6->click(); + if (ui->actionBand_Buttons->isChecked()) { + ui->actionVHF_UHF_Buttons->setVisible(true); + } else { + ui->actionVHF_UHF_Buttons->setVisible(false); + } + check_button_color(); +} + +bool MainWindow::eventFilter (QObject * object, QEvent * event) +{ + switch (event->type()) + { + case QEvent::KeyPress: + // fall through + case QEvent::MouseButtonPress: + // reset the Tx watchdog + tx_watchdog (false); + break; + + case QEvent::ChildAdded: + // ensure our child widgets get added to our event filter + add_child_to_event_filter (static_cast<QChildEvent *> (event)->child ()); + break; + + case QEvent::ChildRemoved: + // ensure our child widgets get d=removed from our event filter + remove_child_from_event_filter (static_cast<QChildEvent *> (event)->child ()); + break; + + default: break; + } + return QObject::eventFilter(object, event); +} + +void MainWindow::createStatusBar() //createStatusBar +{ + tx_status_label.setAlignment (Qt::AlignHCenter); + tx_status_label.setMinimumSize (QSize {100, 18}); + tx_status_label.setStyleSheet ("QLabel{color: #000000; background-color: #00ff00}"); + tx_status_label.setFrameStyle (QFrame::Panel | QFrame::Sunken); + statusBar()->addWidget (&tx_status_label); + + config_label.setAlignment (Qt::AlignHCenter); + config_label.setMinimumSize (QSize {80, 18}); + config_label.setFrameStyle (QFrame::Panel | QFrame::Sunken); + statusBar()->addWidget (&config_label); + config_label.hide (); // only shown for non-default configuration + + mode_label.setAlignment (Qt::AlignHCenter); + mode_label.setMinimumSize (QSize {80, 18}); + mode_label.setFrameStyle (QFrame::Panel | QFrame::Sunken); + statusBar()->addWidget (&mode_label); + + ndecodes_label.setAlignment (Qt::AlignHCenter); + ndecodes_label.setMinimumSize (QSize {30, 18}); + ndecodes_label.setFrameStyle (QFrame::Panel | QFrame::Sunken); + statusBar()->addWidget (&ndecodes_label); + + last_tx_label.setAlignment (Qt::AlignHCenter); + last_tx_label.setMinimumSize (QSize {150, 18}); + last_tx_label.setFrameStyle (QFrame::Panel | QFrame::Sunken); + statusBar()->addWidget (&last_tx_label); + + if (m_config.PWR_and_SWR()) statusBar ()->addPermanentWidget (&band_hopping_label); + band_hopping_label.setAlignment (Qt::AlignHCenter); + band_hopping_label.setMinimumSize (QSize {80, 18}); + band_hopping_label.setFrameStyle (QFrame::Panel | QFrame::Sunken); + + statusBar()->addPermanentWidget(&progressBar); + progressBar.setMinimumSize (QSize {150, 18}); + + statusBar ()->addPermanentWidget (&watchdog_label); + update_watchdog_label (); +} + +void MainWindow::setup_status_bar (bool vhf) +{ + auto submode = current_submode (); + if (vhf && submode != QChar::Null) { + QString t{m_mode + " " + submode}; + if(m_mode=="Q65") t=m_mode + "-" + QString::number(m_TRperiod) + submode; + mode_label.setText (t); + } else { + mode_label.setText (m_mode); + } + if ("JT9" == m_mode) { + mode_label.setStyleSheet ("QLabel{color: #000000; background-color: #ff6ec7}"); + } else if ("JT4" == m_mode) { + mode_label.setStyleSheet ("QLabel{color: #000000; background-color: #cc99ff}"); + } else if ("Echo" == m_mode) { + mode_label.setStyleSheet ("QLabel{color: #000000; background-color: #66ffff}"); + } else if ("JT65" == m_mode) { + mode_label.setStyleSheet ("QLabel{color: #000000; background-color: #66ff66}"); + } else if ("Q65" == m_mode) { + mode_label.setStyleSheet ("QLabel{color: #000000; background-color: #99ff33}"); + } else if ("MSK144" == m_mode) { + mode_label.setStyleSheet ("QLabel{color: #000000; background-color: #ff6666}"); + } else if ("FT4" == m_mode) { + mode_label.setStyleSheet ("QLabel{color: #000000; background-color: #ff0099}"); + } else if ("FT8" == m_mode) { + mode_label.setStyleSheet ("QLabel{color: #000000; background-color: #ff6699}"); + } else if ("FST4" == m_mode) { + mode_label.setStyleSheet ("QLabel{color: #000000; background-color: #99ff66}"); + } else if ("FST4W" == m_mode) { + mode_label.setStyleSheet ("QLabel{color: #000000; background-color: #6699ff}"); + } else if ("FreqCal" == m_mode) { + mode_label.setStyleSheet ("QLabel{color: #000000; background-color: #ff9933}"); + } + keep_last_tx_label = true; + last_tx_label.setText (QString {}); + if (m_mode.contains (QRegularExpression {R"(^(Echo))"})) { + if (band_hopping_label.isVisible ()) statusBar ()->removeWidget (&band_hopping_label); + } else if (m_mode=="WSPR") { + mode_label.setStyleSheet ("QLabel{color: #000000; background-color: #ff66ff}"); + if (!band_hopping_label.isVisible ()) { + statusBar ()->addWidget (&band_hopping_label); + band_hopping_label.show (); + band_hopping_label.setMinimumSize (QSize {80, 18}); + } + } else { + if (band_hopping_label.isVisible ()) statusBar ()->removeWidget (&band_hopping_label); + } +} + +bool MainWindow::subProcessFailed (QProcess * process, int exit_code, QProcess::ExitStatus status) +{ + if (m_valid && (exit_code || QProcess::NormalExit != status)) + { + QStringList arguments; + for (auto argument: process->arguments ()) + { + if (argument.contains (' ')) argument = '"' + argument + '"'; + arguments << argument; + } + if (m_splash && m_splash->isVisible ()) m_splash->hide (); + MessageBox::critical_message (this, tr ("Subprocess Error") + , tr ("Subprocess failed with exit code %1") + .arg (exit_code) + , tr ("Running: %1\n%2") + .arg (process->program () + ' ' + arguments.join (' ')) + .arg (QString {process->readAllStandardError()})); + return true; + } + return false; +} + +void MainWindow::subProcessError (QProcess * process, QProcess::ProcessError) +{ + if (m_valid) + { + QStringList arguments; + for (auto argument: process->arguments ()) + { + if (argument.contains (' ')) argument = '"' + argument + '"'; + arguments << argument; + } + if (m_splash && m_splash->isVisible ()) m_splash->hide (); + MessageBox::critical_message (this, tr ("Subprocess error") + , tr ("Running: %1\n%2") + .arg (process->program () + ' ' + arguments.join (' ')) + .arg (process->errorString ())); + m_valid = false; // ensures exit if still constructing + QTimer::singleShot (0, this, SLOT (close ())); + } +} + +void MainWindow::closeEvent(QCloseEvent * e) +{ + m_valid = false; // suppresses subprocess errors + m_config.transceiver_offline (); + writeSettings (); + if(m_astroWidget) m_astroWidget.reset (); + if(m_QSYMessageCreatorWidget) { + QCloseEvent closeEvent; + QApplication::sendEvent(m_QSYMessageCreatorWidget.data(), &closeEvent); + m_QSYMessageCreatorWidget.reset (); + } + if(m_QSYMessageWidget) { + QCloseEvent closeEvent; + QApplication::sendEvent(m_QSYMessageWidget.data(), &closeEvent); + m_QSYMessageWidget.reset (); + } + if(m_qsymonitorWidget) { + QCloseEvent closeEvent; + QApplication::sendEvent(m_qsymonitorWidget.data(), &closeEvent); + m_qsymonitorWidget.reset (); + } + m_guiTimer.stop (); + m_prefixes.reset (); + m_shortcuts.reset (); + m_mouseCmnds.reset (); + m_colorHighlighting.reset (); + if(m_mode!="MSK144" and m_mode!="FT8") killFile(); + float sw=0.0; + int nw=400; + int nh=100; + int irow=-99; + plotsave_(&sw,&nw,&nh,&irow); + to_jt9(m_ihsym,999,-1); //Tell jt9 to terminate + if (!proc_jt9.waitForFinished(1000)) proc_jt9.close(); + mem_jt9->detach(); + Q_EMIT finished (); + QMainWindow::closeEvent (e); +} + +void MainWindow::on_stopButton_clicked() //stopButton +{ + ui->pbBandHopping->setChecked(false); // disable band hopping + monitor (false); + m_loopall=false; + if(m_bRefSpec) { + MessageBox::information_message (this, tr ("Reference spectrum saved")); + m_bRefSpec=false; + } + if (ui->DX_Call_Button->isChecked()) ui->DX_Call_Button->click (); + stopWRTimer.stop(); // Stop any Wait & Reply timeout + stopWCTimer.stop(); // Stop any Wait & Call timeout + no_wait_and_call = false; + m_specOp=m_config.special_op_id(); + if (ui->respondComboBox->isVisible() and ui->respondComboBox->currentIndex()!=0 and !m_diskData) { + Dpoints=0; // reset points + maxDPoints=0; // reset points + dBpoints=-28; // reset points + dBpoints2=99; // reset points + maxdBPoints=-28; // reset points + mindBPoints=99; // reset points + if (!(m_mode=="Q65" or m_mode=="JT65")) { + clearDX(); // clear dxCallEntry + ui->dxGridEntry->clear (); // clear dxGridEntry + if (!keepTx5) ui->tx5->setCurrentText(""); // clear tx5 + } + } + pounce = false; + ui->autoButton->setChecked(false); // ensure auoButton is unchecked + filtered = false; + ignored = false; + m_muted = false; + check_button_color(); +} + +void MainWindow::on_pbBandHopping_clicked() +{ + if (m_auto) ui->pbBandHopping->setChecked(false); // don't allow band hopping when in QSO +} + +void MainWindow::on_actionRelease_Notes_triggered () +{ + QDesktopServices::openUrl (QUrl {"https://wsjt.sourceforge.io/Release_Notes.txt"}); +} + +void MainWindow::on_actionFT8_DXpedition_Mode_User_Guide_triggered() +{ + QDesktopServices::openUrl (QUrl {"https://wsjt.sourceforge.io/FT8_DXpedition_Mode.pdf"}); +} + +void MainWindow::on_actionSuperFox_User_Guide_triggered() +{ + QDesktopServices::openUrl (QUrl {"https://wsjt.sourceforge.io/SuperFox_User_Guide.pdf"}); +} + +void MainWindow::on_actionQSG_FST4_triggered() +{ + QDesktopServices::openUrl (QUrl {"https://wsjt.sourceforge.io/FST4_Quick_Start.pdf"}); +} + +void MainWindow::on_actionQSG_Q65_triggered() +{ + QDesktopServices::openUrl (QUrl {"https://wsjt.sourceforge.io/Q65_Quick_Start.pdf"}); +} + +void MainWindow::on_actionQSG_X250_M3_triggered() +{ + QDesktopServices::openUrl (QUrl {"https://wsjt.sourceforge.io/WSJTX_2.5.0_MAP65_3.0_Quick_Start.pdf"}); +} + +void MainWindow::on_actionQuick_Start_Guide_to_WSJT_X_2_7_and_QMAP_triggered() +{ + QDesktopServices::openUrl (QUrl {"https://wsjt.sourceforge.io/Quick_Start_WSJT-X_2.7_QMAP.pdf"}); +} + +void MainWindow::on_actionRecommended_Audio_Settings_triggered() +{ + auto const& message = tr("It is very important to avoid audio harmonics and distorted audio signals.\n" + "This is usually achieved by the following step-by-step approach:\n\n" + "1. Select 'Fake it' in the Settings/Radio menu as your 'Split mode'. If your\n" + " rig does not support this, select 'Rig'. But really try to avoid 'None'!\n\n" + "2. Set the transmission power of your transceiver to maximum.\n\n" + "3. Set the Pwr slider to the minimum and click on the 'Tune' button.\n\n" + "4. Observe the actual transmission power of your rig as well as ALC.\n\n" + "5. Carefully increase the Pwr slider until you have reached the\n" + " maximum transmit powe of your transceiver.\n\n" + "6. VERY IMPORTANT: Now reduce the Pwr slider until you reach approx. \n" + " 90% of your max. Tx power. ALC should be close to zero.\n\n" + "7. This is the maximum audio level permitted with your setup.\n" + " Always stay with the Pwr slider below this max. value.\n\n" + "If possible, check your transmission from time to time with a webSDR\n" + "to ensure the signal is clean and not distorted."); + QTimer::singleShot (0, [=] { // don't block guiUpdate + MessageBox::warning_message(this, tr ("<b>Recommended Audio Settings</b>"), message); }); +} + +void MainWindow::on_actionOnline_User_Guide_triggered() //Display manual +{ + QDesktopServices::openUrl (QUrl {"https://wsjt.sourceforge.io/wsjtx-main_en.html"}); +} + +//Display local copy of manual +void MainWindow::on_actionLocal_User_Guide_triggered() +{ +#if defined (CMAKE_BUILD) + m_manual.display_html_file (m_config.doc_dir (), PROJECT_MANUAL); +#endif +} + +void MainWindow::on_actionWide_Waterfall_triggered() //Display Waterfalls +{ + m_wideGraph->showNormal(); +} + +void MainWindow::on_actionEcho_Graph_triggered() +{ + m_echoGraph->showNormal(); +} + +void MainWindow::on_actionFast_Graph_triggered() +{ + m_fastGraph->showNormal(); +} + +void MainWindow::on_actionSolve_FreqCal_triggered() +{ + auto data_dir {QDir::toNativeSeparators(m_config.writeable_data_dir().absolutePath()).toLocal8Bit ()}; + int iz,irc; + double a,b,rms,sigmaa,sigmab; + calibrate_(data_dir.constData(), &iz, &a, &b, &rms, &sigmaa, &sigmab, &irc, (FCL)data_dir.size()); + QString t2; + if(irc==-1) t2="Cannot open " + data_dir + "/fmt.all"; + if(irc==-2) t2="Cannot open " + data_dir + "/fcal2.out"; + if(irc==-3) t2="Insufficient data in fmt.all"; + if(irc==-4) t2 = tr ("Invalid data in fmt.all at line %1").arg (iz); + if(irc>0 or rms>1.0) t2="Check fmt.all for possible bad data."; + if (irc < 0 || irc > 0 || rms > 1.) { + MessageBox::warning_message (this, "Calibration Error", t2); + } + else if (MessageBox::Apply == MessageBox::query_message (this + , tr ("Good Calibration Solution") + , tr ("<pre>" + "%1%L2 ±%L3 ppm\n" + "%4%L5 ±%L6 Hz\n\n" + "%7%L8\n" + "%9%L10 Hz" + "</pre>") + .arg ("Slope: ", 12).arg (b, 0, 'f', 3).arg (sigmab, 0, 'f', 3) + .arg ("Intercept: ", 12).arg (a, 0, 'f', 2).arg (sigmaa, 0, 'f', 2) + .arg ("N: ", 12).arg (iz) + .arg ("StdDev: ", 12).arg (rms, 0, 'f', 2) + , QString {} + , MessageBox::Cancel | MessageBox::Apply)) { + m_config.set_calibration (Configuration::CalibrationParams {a, b}); + if (MessageBox::Yes == MessageBox::query_message (this + , tr ("Delete Calibration Measurements") + , tr ("The \"fmt.all\" file will be renamed as \"fmt.bak\""))) { + // rename fmt.all as we have consumed the resulting calibration + // solution + auto const& backup_file_name = m_config.writeable_data_dir ().absoluteFilePath ("fmt.bak"); + QFile::remove (backup_file_name); + QFile::rename (m_config.writeable_data_dir ().absoluteFilePath ("fmt.all"), backup_file_name); + } + } +} + +void MainWindow::on_actionCopyright_Notice_triggered() +{ + auto const& message = tr("If you make fair use of any part of WSJT-X under terms of the GNU " + "General Public License, you must display the following copyright " + "notice prominently in your derivative work:\n\n" + "\"The algorithms, source code, look-and-feel of WSJT-X and related " + "programs, and protocol specifications for the modes FSK441, FST4, FT8, " + "JT4, JT6M, JT9, JT65, JTMS, QRA64, Q65, MSK144 are Copyright (C) " + "2001-2026 by one or more of the following authors: Joseph Taylor, " + "K1JT; Bill Somerville, G4WJS; Steven Franke, K9AN; Nico Palermo, " + "IV3NWV; Greg Beam, KI7MT; Michael Black, W9MDB; Edson Pereira, PY2SDR; " + "Philip Karn, KA9Q; Uwe Risse, DG2YCB; Brian Moran, N9ADG; Roger Rehr, " + "W3SZ; John Nelson, G4KLA; Charlie Suckling, DL3WDG; and other members " + "of the WSJT Development Group.\""); + MessageBox::warning_message(this, message); +} + +// Implement the MultiGeometryWidget::change_layout() operation. +void MainWindow::change_layout (std::size_t n) +{ + switch (n) + { + case 1: // SWL view + ui->menuBar->show (); + ui->lower_panel_widget->hide (); + trim_view (false); // ensure we can switch back + break; + + case 2: // hide menus view + ui->menuBar->hide (); + ui->lower_panel_widget->show (); + trim_view (true); + break; + + default: // normal view + ui->menuBar->setVisible (ui->cbMenus->isChecked ()); + ui->lower_panel_widget->show (); + trim_view (!ui->cbMenus->isChecked ()); + break; + } +} + +void MainWindow::on_actionSWL_Mode_triggered (bool checked) +{ + select_geometry (checked ? 1 : ui->cbMenus->isChecked () ? 0 : 2); +} + +// This allows the window to shrink by removing certain things +// and reducing space used by controls +void MainWindow::trim_view (bool checked) +{ + int spacing = checked ? 1 : 6; + if (checked) { + statusBar ()->removeWidget (&auto_tx_label); + } else { + statusBar ()->addWidget(&auto_tx_label); + } + if (m_mode != "FreqCal" && m_mode != "WSPR" && m_mode != "FST4W") { + ui->lh_decodes_title_label->setVisible(!checked); + ui->rh_decodes_title_label->setVisible(!checked); + } + ui->lh_decodes_headings_label->setVisible(!checked); + ui->rh_decodes_headings_label->setVisible(!checked); + ui->gridLayout_5->layout()->setSpacing(spacing); + ui->horizontalLayout_2->layout()->setSpacing(spacing); + ui->horizontalLayout_5->layout()->setSpacing(spacing); + ui->horizontalLayout_6->layout()->setSpacing(spacing); + ui->horizontalLayout_7->layout()->setSpacing(spacing); + ui->horizontalLayout_8->layout()->setSpacing(spacing); + ui->horizontalLayout_9->layout()->setSpacing(spacing); + ui->horizontalLayout_10->layout()->setSpacing(spacing); + ui->horizontalLayout_11->layout()->setSpacing(spacing); + ui->horizontalLayout_12->layout()->setSpacing(spacing); + ui->horizontalLayout_13->layout()->setSpacing(spacing); + ui->horizontalLayout_14->layout()->setSpacing(spacing); + ui->rh_decodes_widget->layout()->setSpacing(spacing); + ui->verticalLayout_2->layout()->setSpacing(spacing); + ui->verticalLayout_3->layout()->setSpacing(spacing); + ui->verticalLayout_5->layout()->setSpacing(spacing); + ui->verticalLayout_7->layout()->setSpacing(spacing); + ui->verticalLayout_8->layout()->setSpacing(spacing); + ui->tab->layout()->setSpacing(spacing); +} + +void MainWindow::on_actionAstronomical_data_toggled (bool checked) +{ + if (checked) + { + m_astroWidget.reset (new Astro {m_settings, &m_config}); + + // hook up termination signal + connect (this, &MainWindow::finished, m_astroWidget.data (), &Astro::close); + connect (m_astroWidget.data (), &Astro::tracking_update, [this] { + m_astroCorrection = {}; + setRig (); + setXIT (ui->TxFreqSpinBox->value ()); + displayDialFrequency (); + }); + connect (m_astroWidget.data (), &Astro::skedFreq, this, &MainWindow::skedFreq); + + m_astroWidget->showNormal(); + m_astroWidget->raise (); + m_astroWidget->activateWindow (); + m_astroWidget->nominal_frequency (m_freqNominal, m_freqTxNominal); + if (!programStart) m_astroWidget->setSkedFreq(m_skedFreq); + } else + { + m_astroWidget.reset (); + } +} + +void MainWindow::skedFreq(double freqMHz) +{ + m_skedFreq=freqMHz; + m_bandEdited=true; + Frequency f=qRound64(1000000.0*freqMHz); + band_changed(f); +} + +void MainWindow::on_actionQSYMessage_Creator_triggered() +{ + if (!m_QSYMessageCreatorWidget) { + m_QSYMessageCreatorWidget.reset (new QSYMessageCreator {m_settings, &m_config}); + // hook up termination signal + connect (this, &MainWindow::finished, &QSYMessageCreator::close); + //connect to signal from QSYMessageCreator + connect (m_QSYMessageCreatorWidget.data (), &QSYMessageCreator::sendMessage, this, &MainWindow::update_tx5); + connect (m_QSYMessageCreatorWidget.data (), &QSYMessageCreator::sendQSYMessageCreatorStatus, this, &MainWindow::setQSYMessageCreatorStatus); + } + m_QSYMessageCreatorValue = true; +// m_QSYMessageCreatorWidget->setWindowFlags(m_QSYMessageCreatorWidget->windowFlags() | Qt::WindowStaysOnTopHint); + m_QSYMessageCreatorWidget->showNormal(); + m_QSYMessageCreatorWidget->raise(); + m_QSYMessageCreatorWidget->activateWindow(); + m_QSYMessageCreatorWidget->getDxBase(QString(Radio::base_callsign(ui->dxCallEntry->text()))); + ui->actionEnable_QSY_Popups->setChecked(true); +} + +void MainWindow::on_actionQSY_Monitor_triggered() +{ + if (!m_qsymonitorWidget) { + m_qsymonitorWidget.reset (new QSYMonitor {m_settings, m_config.decoded_text_font (), &m_config}); + // hook up termination signal + connect (this, &MainWindow::finished, &QSYMonitor::close); + } + m_qsymonitorValue = true; + m_qsymonitorWidget->showNormal(); + m_qsymonitorWidget->raise(); + m_qsymonitorWidget->activateWindow(); +} + +void MainWindow::on_fox_log_action_triggered() +{ + if (!m_foxLogWindow) + { + m_foxLogWindow.reset (new FoxLogWindow {m_settings, &m_config, m_logBook.fox_log ()}); + + // Connect signals from fox log window + connect (this, &MainWindow::finished, m_foxLogWindow.data (), &FoxLogWindow::close); + connect (m_foxLogWindow.data (), &FoxLogWindow::reset_log_model, [this] () { + m_logBook.fox_log ()->reset (); + }); + } + m_foxLogWindow->showNormal (); + m_foxLogWindow->raise (); + m_foxLogWindow->activateWindow (); +} + +void MainWindow::on_contest_log_action_triggered() +{ + if (!m_contestLogWindow) + { + m_contestLogWindow.reset (new CabrilloLogWindow {m_settings, &m_config, m_logBook.contest_log ()->model ()}); + + // Connect signals from contest log window + connect (this, &MainWindow::finished, m_contestLogWindow.data (), &CabrilloLogWindow::close); + } + m_contestLogWindow->showNormal (); + m_contestLogWindow->raise (); + m_contestLogWindow->activateWindow (); + // connect signal from m_logBook.contest_log to m_contestLogWindow + connect(m_logBook.contest_log(), &CabrilloLog::qso_count_changed, m_contestLogWindow.data (), &CabrilloLogWindow::set_nQSO); + m_contestLogWindow->set_nQSO(m_logBook.contest_log()->n_qso()); +} + +void MainWindow::on_actionColors_triggered() +{ + if (!m_colorHighlighting) + { + m_colorHighlighting.reset (new ColorHighlighting {m_settings, m_config.decode_highlighting ()}); + connect (&m_config, &Configuration::decode_highlighting_changed, m_colorHighlighting.data (), &ColorHighlighting::set_items); + } + m_colorHighlighting->showNormal (); + m_colorHighlighting->raise (); + m_colorHighlighting->activateWindow (); +} + +void MainWindow::on_actionMessage_averaging_triggered() +{ + if(m_msgAvgWidget == NULL) { + m_msgAvgWidget.reset (new MessageAveraging {m_settings, m_config.decoded_text_font ()}); + + // Connect signals from Message Averaging window + connect (this, &MainWindow::finished, m_msgAvgWidget.data (), &MessageAveraging::close); + } + m_msgAvgWidget->showNormal(); + m_msgAvgWidget->raise(); + m_msgAvgWidget->activateWindow(); +} + +void MainWindow::on_actionActiveStations_triggered() +{ + if(m_ActiveStationsWidget == NULL) { + m_ActiveStationsWidget.reset (new ActiveStations {m_settings, m_config.decoded_text_font ()}); + // Connect signals from Message Averaging window + connect (this, &MainWindow::finished, m_ActiveStationsWidget.data (), &ActiveStations::close); + } + m_ActiveStationsWidget->showNormal(); + m_ActiveStationsWidget->raise(); + m_ActiveStationsWidget->activateWindow(); + configActiveStations(); + connect(m_ActiveStationsWidget.data(), SIGNAL(callSandP(int)),this,SLOT(callSandP2(int))); + // connect up another signal to handle clicks in the Activity window when in Fox mode + connect(m_ActiveStationsWidget.data(), SIGNAL(queueActiveWindowHound(QString)),this,SLOT(queueActiveWindowHound2(QString)),static_cast<Qt::ConnectionType>(Qt::UniqueConnection)); + connect(m_ActiveStationsWidget.data(), SIGNAL(activeStationsDisplay()),this,SLOT(ARRL_Digi_Display())); + m_ActiveStationsWidget->setScore(m_score); + if(m_mode=="Q65") m_ActiveStationsWidget->setRate(m_score); + QString as_mode = m_mode; + if(m_mode=="FT8" && SpecOp::FOX==m_specOp) as_mode="Fox Mode"; // TODO - active stations for hound mode? + m_ActiveStationsWidget->setupUi(as_mode); +} + +void MainWindow::on_actionOpen_triggered() //Open File +{ + monitor (false); + + QString fname; + fname=QFileDialog::getOpenFileName(this, "Open File", m_path, + "WSJT Files (*.wav)"); + if(!fname.isEmpty ()) { + m_path=fname; + int i1=fname.lastIndexOf("/"); + QString baseName=fname.mid(i1+1); + tx_status_label.setStyleSheet("QLabel{color: #000000; background-color: #99ffff}"); + tx_status_label.setText(" " + baseName + " "); + m_diskData=true; + on_stopButton_clicked(); + read_wav_file (fname); + } +} + +void MainWindow::read_wav_file (QString const& fname) +{ + if (m_mode=="FT8" && (m_multithreadFT8 or m_freqNominal>45000000)) { + m_nDecodes=0; // reset the decodes counter + ndecodes_label.setText(""); + earlyDecodes = ""; // reset dupe check + } + // call diskDat() when done + int i0=fname.lastIndexOf("_"); + int i1=fname.indexOf(".wav"); + int i3=fname.lastIndexOf("/"); + QString baseName=fname.mid(i3+1); + int i4=baseName.indexOf(".wav"); + m_nutc0=m_UTCdisk; + if (i1-i3 > 13) { + m_UTCdisk=baseName.mid(7, 6).toInt(); + if (i4-i3 > 6) { + m_UTCdiskDateTime = QDateTime::fromString("20" + baseName.mid(0, 13) + "Z", "yyyyMMdd_hhmmsst").toUTC(); + } else { + m_UTCdiskDateTime = QDateTime{}; + } + } else { + m_UTCdisk=fname.mid(i0+1,i1-i0-1).toInt(); + if (i0 > 6) { + m_UTCdiskDateTime = QDateTime::fromString("20" + fname.mid(i0 - 6, 13) + "Z", "yyyyMMdd_hhmmsst").toUTC(); + } else { + m_UTCdiskDateTime = QDateTime{}; + } + } + + if (m_config.insert_blank() && !(ui->actionInclude_averaging->isVisible() && ui->actionInclude_averaging->isChecked())) { // insert blank line + if(!fname.isEmpty ()) { + if (ui->actionUse_Dark_Style->isChecked()) { + ui->decodedTextBrowser->insertText(("----- " + baseName + " -----"), "#a2a2a2", "#000000"); + } else { + ui->decodedTextBrowser->insertLineSpacer("----- " + baseName + " -----"); + } + } + } + + m_wav_future_watcher.setFuture (QtConcurrent::run ([this, fname] { + auto basename = fname.mid (fname.lastIndexOf ('/') + 1); + auto pos = fname.indexOf (".wav", 0, Qt::CaseInsensitive); + int i1=fname.indexOf(".wav"); + int i3=fname.lastIndexOf("/"); + // global variables and threads do not mix well, this needs changing + dec_data.params.nutc = 0; + if (pos > 0) { + if (i1-i3 > 13) { + dec_data.params.nutc = basename.mid(7, 6).toInt(); + m_fileDateTime=basename.mid(0, 13); + } else { + if (pos == fname.indexOf ('_', -11) + 7) { + dec_data.params.nutc = fname.mid (pos - 6, 6).toInt (); + m_fileDateTime=fname.mid(pos-13,13); + } else { + dec_data.params.nutc = 100 * fname.mid (pos - 4, 4).toInt (); + m_fileDateTime=fname.mid(pos-11,11); + } + } + } + BWFFile file {QAudioFormat {}, fname}; + bool ok=file.open (BWFFile::ReadOnly); + if(ok) { + auto bytes_per_frame = file.format ().bytesPerFrame (); + int nsamples=m_TRperiod * RX_SAMPLE_RATE; + qint64 max_bytes = std::min (std::size_t (nsamples), + sizeof (dec_data.d2) / sizeof (dec_data.d2[0]))* bytes_per_frame; + auto n = file.read (reinterpret_cast<char *> (dec_data.d2), + std::min (max_bytes, file.size ())); + int frames_read = n / bytes_per_frame; + // zero unfilled remaining sample space + std::memset(&dec_data.d2[frames_read],0,max_bytes - n); + if (11025 == file.format ().sampleRate ()) { + short sample_size = file.format ().sampleSize (); + wav12_ (dec_data.d2, dec_data.d2, &frames_read, &sample_size); + } + dec_data.params.kin = frames_read; + dec_data.params.newdat = 1; + } else { + dec_data.params.kin = 0; + dec_data.params.newdat = 0; + } + + dec_data.params.yymmdd=basename.left(6).toInt(); + })); +} + +void MainWindow::on_actionOpen_next_in_directory_triggered() //Open Next +{ + if(m_decoderBusy) return; + monitor (false); + int i,len; + QFileInfo fi(m_path); + QStringList list; + list= fi.dir().entryList().filter(".wav",Qt::CaseInsensitive); + for (i = 0; i < list.size()-1; ++i) { + len=list.at(i).length(); + if(list.at(i)==m_path.right(len)) { + int n=m_path.length(); + QString fname=m_path.replace(n-len,len,list.at(i+1)); + m_path=fname; + int i1=fname.lastIndexOf("/"); + QString baseName=fname.mid(i1+1); + tx_status_label.setStyleSheet("QLabel{color: #000000; background-color: #99ffff}"); + tx_status_label.setText(" " + baseName + " "); + m_diskData=true; + read_wav_file (fname); + if(m_loopall and (i==list.size()-2)) { + m_loopall=false; + m_bNoMoreFiles=true; + } + return; + } + } +} +//Open all remaining files +void MainWindow::on_actionDecode_remaining_files_in_directory_triggered() +{ + if(m_decoderBusy) return; + m_loopall=true; + on_actionOpen_next_in_directory_triggered(); +} + +void MainWindow::diskDat() //diskDat() +{ + m_wideGraph->setDiskUTC(dec_data.params.nutc); + if(dec_data.params.kin>0) { + int k; + int kstep=m_FFTSize; + m_diskData=true; + float db=m_config.degrade(); + float bw=m_config.RxBandwidth(); + if(db > 0.0) degrade_snr_(dec_data.d2,&dec_data.params.kin,&db,&bw); + for(int n=1; n<=m_hsymStop; n++) { // Do the waterfall spectra +// k=(n+1)*kstep; //### Why was this (n+1) ??? ### + k=n*kstep; + if(k > dec_data.params.kin) break; + dec_data.params.npts8=k/8; + dataSink(k); + qApp->processEvents(); //Update the waterfall + } + } else { + MessageBox::information_message(this, tr("No data read from disk. Wrong file format?")); + } +} + +//Delete ../save/*.wav +void MainWindow::on_actionDelete_all_wav_files_in_SaveDir_triggered() +{ + auto button = MessageBox::query_message (this, tr ("Confirm Delete"), + tr ("Are you sure you want to delete all *.wav and *.c2 files in \"%1\"?") + .arg (QDir::toNativeSeparators (m_config.save_directory ().absolutePath ()))); + if (MessageBox::Yes == button) { + Q_FOREACH (auto const& file + , m_config.save_directory ().entryList ({"*.wav", "*.c2"}, QDir::Files | QDir::Writable)) { + m_config.save_directory ().remove (file); + } + } +} + +void MainWindow::on_actionDownload_EME_Ephemeris_Chart_triggered() +{ + bool ok{false}; + qint32 nyear = QInputDialog::getInt(this,tr("EME Chart"), + tr("Select Year"),QDate::currentDate().year(),2025,2040,1,&ok); + if(ok) { + QString URL="https://wsjt.sourceforge.io/EMEchart_2025.pdf"; + URL.replace("2025",QString::number(nyear)); + QDesktopServices::openUrl (QUrl {URL}); + } +} + +void MainWindow::on_actionNone_triggered() //Save None +{ + m_saveDecoded=false; + m_saveAll=false; + ui->actionNone->setChecked(true); +} + +void MainWindow::on_actionSave_decoded_triggered() +{ + m_saveDecoded=true; + m_saveAll=false; + ui->actionSave_decoded->setChecked(true); +} + +void MainWindow::on_actionSave_all_triggered() //Save All +{ + m_saveDecoded=false; + m_saveAll=true; + ui->actionSave_all->setChecked(true); +} + +void MainWindow::on_actionKeyboard_shortcuts_triggered() +{ + if (!m_shortcuts) + { + QFont font; + font.setPointSize (10); + m_shortcuts.reset (new HelpTextWindow {tr ("Keyboard Shortcuts"), + //: Keyboard shortcuts help window contents + tr (R"(<table cellspacing=1> + <tr><td><b>Esc </b></td><td>Stop Tx, abort QSO, clear next-call queue</td></tr> + <tr><td><b>F1 </b></td><td>Online User's Guide (Alt: transmit Tx6)</td></tr> + <tr><td><b>Shift+F1 </b></td><td>Copyright Notice</td></tr> + <tr><td><b>Ctrl+F1 </b></td><td>About WSJT-X</td></tr> + <tr><td><b>F2 </b></td><td>Open settings window (Alt: transmit Tx2)</td></tr> + <tr><td><b>F3 </b></td><td>Display keyboard shortcuts (Alt: transmit Tx3)</td></tr> + <tr><td><b>F4 </b></td><td>Clear DX Call, DX Grid, Tx messages 1-4 (Alt: transmit Tx4)</td></tr> + <tr><td><b>Alt+F4 </b></td><td>Exit program</td></tr> + <tr><td><b>F5 </b></td><td>Display special mouse commands (Alt: transmit Tx5)</td></tr> + <tr><td><b>F6 </b></td><td>Open next file in directory (Alt: toggle "Call 1st")</td></tr> + <tr><td><b>Shift+F6 </b></td><td>Decode all remaining files in directory</td></tr> + <tr><td><b>F7 </b></td><td>Display Message Averaging window</td></tr> + <tr><td><b>F11 </b></td><td>Move Rx frequency down 1 Hz</td></tr> + <tr><td><b>Ctrl+F11 </b></td><td>Move identical Rx and Tx frequencies down 1 Hz</td></tr> + <tr><td><b>Shift+F11 </b></td><td>Move Tx frequency down 60 Hz (FT8) or 90 Hz (FT4)</td></tr> + <tr><td><b>Ctrl+Shift+F11 </b></td><td>Move dial frequency down 1000 Hz</td></tr> + <tr><td><b>F12 </b></td><td>Move Rx frequency up 1 Hz</td></tr> + <tr><td><b>Ctrl+F12 </b></td><td>Move identical Rx and Tx frequencies up 1 Hz</td></tr> + <tr><td><b>Shift+F12 </b></td><td>Move Tx frequency up 60 Hz (FT8) or 90 Hz (FT4)</td></tr> + <tr><td><b>Ctrl+Shift+F12 </b></td><td>Move dial frequency up 1000 Hz</td></tr> + <tr><td><b>Alt+1-6 </b></td><td>Set now transmission to this number on Tab 1</td></tr> + <tr><td><b>Ctl+1-6 </b></td><td>Set next transmission to this number on Tab 1</td></tr> + <tr><td><b>Alt+A </b></td><td>Clear Active Stations for QMAP</td></tr> + <tr><td><b>Alt+B </b></td><td>Toggle "Best S+P" status</td></tr> + <tr><td><b>Alt+C </b></td><td>Toggle "Call 1st" checkbox</td></tr> + <tr><td><b>Alt+D </b></td><td>Decode again at QSO frequency</td></tr> + <tr><td><b>Shift+D </b></td><td>Full decode (both windows)</td></tr> + <tr><td><b>Ctrl+E </b></td><td>Turn on TX even/1st</td></tr> + <tr><td><b>Shift+E </b></td><td>Turn off TX even/1st</td></tr> + <tr><td><b>Alt+E </b></td><td>Erase</td></tr> + <tr><td><b>Ctrl+F </b></td><td>Edit the free text message box</td></tr> + <tr><td><b>Alt+G </b></td><td>Generate standard messages</td></tr> + <tr><td><b>Alt+H </b></td><td>Halt Tx</td></tr> + <tr><td><b>Ctrl+I </b></td><td>Add Dx Call to the Ignore List</td></tr> + <tr><td><b>Ctrl+L </b></td><td>Lookup callsign in database, generate standard messages</td></tr> + <tr><td><b>Alt+M </b></td><td>Monitor</td></tr> + <tr><td><b>Alt+N </b></td><td>Toggle "Enable Tx"</td></tr> + <tr><td><b>Ctrl+O </b></td><td>Open a .wav file</td></tr> + <tr><td><b>Alt+O </b></td><td>Change operator</td></tr> + <tr><td><b>Alt+Q </b></td><td>Open "Log QSO" window</td></tr> + <tr><td><b>Ctrl+R </b></td><td>Set Tx4 message to RRR (not in FT4)</td></tr> + <tr><td><b>Alt+R </b></td><td>Set Tx4 message to RR73</td></tr> + <tr><td><b>Ctrl+Shift+R </b></td><td>Refresh Active Stations window</td></tr> + <tr><td><b>Alt+S </b></td><td>Stop monitoring</td></tr> + <tr><td><b>Alt+T </b></td><td>Toggle Tune status</td></tr> + <tr><td><b>Alt+Z </b></td><td>Clear hung decoder status</td></tr> + +</table>)"), font}); + } + m_shortcuts->showNormal (); + m_shortcuts->raise (); +} + +void MainWindow::on_actionSpecial_mouse_commands_triggered() +{ + if (!m_mouseCmnds) + { + QFont font; + font.setPointSize (10); + m_mouseCmnds.reset (new HelpTextWindow {tr ("Special Mouse Commands"), + //: Mouse commands help window contents + tr (R"(<table cellpadding=5> + <tr> + <th align="right">Click on</th> + <th align="left">Action</th> + </tr> + <tr> + <td align="right">Waterfall:</td> + <td><b>Click</b> to set Rx frequency.<br/> + <b>Right-click</b> to set Tx frequency.<br/> + <b>Double-right-click</b> to set Rx and Tx frequencies. + </td> + </tr> + <tr> + <td align="right">Decoded text:</td> + <td><b>Double-click</b> to copy second callsign to Dx Call, locator to Dx Grid, change Rx<br/> + and Tx frequency to decoded signal's frequency, and generate standard messages.<br/> + Hold down <b>Alt</b> to prevent Tx from being enabled on <b>double-click</b>.<br/> + If <b>Hold Tx Freq</b> is checked or first callsign in message is your<br/> + own call, Tx frequency is not changed unless <b>Ctrl</b> is held down. + </td> + </tr> + <tr> + <td align="right">Dial Frequency:</td> + <td><b>Turn the mouse wheel</b> to change the kHz values, or:<br/> + <b>Right-click</b> to increase frequency by 1 kHz.<br/> + <b>Left-click</b> to decrease frequency by 1 kHz.<br/> + The mouse pointer must be over the Dial Frequency indicator. + </td> + </tr> + <tr> + <td align="right">H Button:</td> + <td><b>Click</b> to toggle FT8 Hound Mode On/Off.<br/> + <b>Right-click</b> to activate or deactivate SuperFox mode. + </td> + </tr> + <tr> + <td align="right">FT8 Button:</td> + <td><b>Click</b> to switch to FT8 Hound Mode.<br/> + <b>Right-click</b> to toggle last used Special Operating Activity On/Off. + </td> + </tr> + <tr> + <td align="right">Q65 Button:</td> + <td><b>Click</b> to switch to Q65 Mode.<br/> + <b>Right-click</b> to switch to Q65 Pileup Mode. + </td> + </tr> + <tr> + <td align="right">JT65 Button:</td> + <td><b>Click</b> to switch to JT65 Mode.<br/> + <b>Right-click</b> to switch to JT9 Mode. + </td> + </tr> + <tr> + <td align="right">Tx5 Button:</td> + <td><b>Right-click</b> to retain Tx5 free text. + </td> + </tr> + <tr> + <td align="right">Tx Even/1st:</td> + <td><b>Right-click</b> to freeze the state of the checkbox.<br/> + <b>Right-click on the FT8 Button</b> to unfreeze. + </td> + </tr> + <tr> + <td align="right">Enable Tx Button:</td> + <td><b>Click</b> to toggle Auto-Tx mode On/Off.<br/> + <b>Right-click</b> to toggle Wait & Pounce On/Off. + </td> + </tr> + <tr> + <td align="right">Erase button:</td> + <td><b>Click</b> to erase Rx Frequency window.<br/> + <b>Double-click</b> to erase Rx Frequency and Band Activity windows.<br/> + If <b>Alternate Erase button behavior</b> is checked:<br/> + <b>Click</b> to erase Band Activity window.<br/> + <b>Right-click</b> to erase Rx Frequency window.<br/> + <b>Double-click</b> to erase Rx Frequency and Band Activity windows. + </td> + </tr> + <tr> + <td align="right">DX Call Button:</td> + <td><b>Click</b> to toggle Wait & Call On/Off.<br/> + <b>Right-click</b> to clear the Dx Call, Dx Grid and Std Msgs. + </td> + </tr> + <tr> + <td align="right">Lookup Button:</td> + <td><b>Click</b> to search for callsign in database.<br/> + <b>Right-click</b> to search for Dx Call on qrz.com. + </td> + </tr> + <tr> + <td align="right">Add Button:</td> + <td><b>Click</b> to add callsign and locator to database.<br/> + <b>Right-click</b> to search for Dx Call on hamqth.com. + </td> + </tr> + <tr> + <td align="right">Ignore Button:</td> + <td><b>Click</b> to add callsign to the Ignore List.<br/> + <b>Right-click</b> to search for Dx Call on qrzcq.com. + </td> + </tr> + <tr> + <td align="right">Band Buttons:</td> + <td><b>Click</b> to toggle band / mode default frequencies.<br/> + <b>Right-click</b> to toggle FT8 DXpedition frequencies. + </td> + </tr> +</table>)"), font}); + } + m_mouseCmnds->showNormal (); + m_mouseCmnds->raise (); +} + +void MainWindow::on_DecodeButton_clicked (bool /* checked */) //Decode request +{ + if(m_mode=="MSK144") { + ui->DecodeButton->setChecked(false); + } else { + if(m_mode!="WSPR" && !m_decoderBusy) { + m_manualDecode=true; + dec_data.params.newdat=0; + dec_data.params.nagain=1; + decode(); + } + } +} + +void MainWindow::freezeDecode(int n) //freezeDecode() +{ + if((n%100)==2) { + if(m_mode=="FST4" and m_config.single_decode() and ui->sbFtol->value()>10) ui->sbFtol->setValue(10); + on_DecodeButton_clicked (true); + } +} + +void MainWindow::on_ClrAvgButton_clicked() +{ + m_nclearave=1; + if(m_mode=="Echo") { + echocom_.nsum=0; + m_echoGraph->clearAvg(); + m_wideGraph->restartTotalPower(); + } else { + if(m_msgAvgWidget != NULL) { + if(m_msgAvgWidget->isVisible()) m_msgAvgWidget->displayAvg(""); + } + if(m_mode=="Q65") ndecodes_label.setText("0 0"); + } +} + +void MainWindow::msgAvgDecode2() +{ + on_DecodeButton_clicked (true); +} + +void MainWindow::decode() //decode() +{ + if(m_decoderBusy) return; //Don't start decoder if it's already busy. + m_fetched=0; + QDateTime now = QDateTime::currentDateTimeUtc (); + if( m_dateTimeLastTX.isValid () ) { + qint64 isecs_since_tx = m_dateTimeLastTX.secsTo(now); + dec_data.params.lapcqonly= (isecs_since_tx > 300); + } else { + m_dateTimeLastTX = now.addSecs(-900); + dec_data.params.lapcqonly=true; + } + if(m_diskData) { + dec_data.params.lapcqonly=false; + } else { + dec_data.params.yymmdd=-1; + } + if(!m_dataAvailable or m_TRperiod==0.0) return; + ui->DecodeButton->setChecked (true); + if(!dec_data.params.nagain && m_diskData && m_TRperiod >= 60.) { + dec_data.params.nutc=dec_data.params.nutc/100; + } + if(dec_data.params.nagain==0 && dec_data.params.newdat==1 && (!m_diskData)) { + m_dateTimeSeqStart = qt_truncate_date_time_to (QDateTime::currentDateTimeUtc (), m_TRperiod * 1.e3); + auto t = m_dateTimeSeqStart.time (); + dec_data.params.nutc = t.hour () * 100 + t.minute (); + if (m_TRperiod < 60.) + { + dec_data.params.nutc = dec_data.params.nutc * 100 + t.second (); + } + } + + if(m_nPick==1 and !m_diskData) { + QDateTime t=QDateTime::currentDateTimeUtc(); + int ihr=t.toString("hh").toInt(); + int imin=t.toString("mm").toInt(); + int isec=t.toString("ss").toInt(); + isec=isec - fmod(double(isec),m_TRperiod); + dec_data.params.nutc=10000*ihr + 100*imin + isec; + } + if(m_nPick==2) dec_data.params.nutc=m_nutc0; + dec_data.params.nQSOProgress = m_QSOProgress; + dec_data.params.nfqso=m_wideGraph->rxFreq(); + dec_data.params.nftx = ui->TxFreqSpinBox->value (); + qint32 depth {m_ndepth}; + if (!ui->actionInclude_averaging->isVisible ()) depth &= ~16; + if (!ui->actionInclude_correlation->isVisible ()) depth &= ~32; + if (!ui->actionEnable_AP_DXcall->isVisible ()) depth &= ~64; + if (!ui->actionAuto_Clear_Avg->isVisible()) depth &= ~128; + dec_data.params.ndepth=depth; + dec_data.params.n2pass=1; + if(m_config.twoPass()) dec_data.params.n2pass=2; + dec_data.params.nranera=m_config.ntrials(); + dec_data.params.naggressive=m_config.aggressive(); + dec_data.params.nrobust=0; + dec_data.params.ndiskdat=0; + if(m_diskData) dec_data.params.ndiskdat=1; + dec_data.params.nfa=m_wideGraph->nStartFreq(); + dec_data.params.nfSplit=m_wideGraph->Fmin(); // Not used any more? + if(dec_data.params.nfSplit==8) dec_data.params.nfSplit=1; + + dec_data.params.nfb=m_wideGraph->Fmax(); + if(m_mode=="FT8" and SpecOp::HOUND==m_specOp and !ui->cbRxAll->isChecked() and + !m_config.superFox()) dec_data.params.nfb=1000; + if(m_mode=="FT8" and SpecOp::FOX == m_specOp ) dec_data.params.nfqso=200; + dec_data.params.b_even_seq=(dec_data.params.nutc%10)==0; + dec_data.params.b_superfox=(m_config.superFox() and (SpecOp::FOX == m_specOp or SpecOp::HOUND == m_specOp)); + if(dec_data.params.b_superfox and dec_data.params.b_even_seq and m_ihsym<50) return; + + dec_data.params.ntol=ui->sbFtol->value (); + if(m_mode=="FST4") { + dec_data.params.ntol=ui->sbFtol->value(); + if(m_config.single_decode()) { + dec_data.params.nfa=m_wideGraph->rxFreq() - ui->sbFtol->value(); + dec_data.params.nfb=m_wideGraph->rxFreq() + ui->sbFtol->value(); + } else { + dec_data.params.nfa=ui->sbF_Low->value(); + dec_data.params.nfb=ui->sbF_High->value(); + } + } + if(m_mode=="FST4W") dec_data.params.ntol=ui->sbFST4W_FTol->value(); + if(dec_data.params.nutc < m_nutc0) m_RxLog = 1; //Date and Time to file "ALL.TXT". + if(dec_data.params.newdat==1 and !m_diskData) m_nutc0=dec_data.params.nutc; + dec_data.params.ntxmode=9; + dec_data.params.nmode=9; + if(m_mode=="JT65") dec_data.params.nmode=65; + if(m_mode=="JT65") dec_data.params.ljt65apon = ui->actionEnable_AP_JT65->isVisible () && + ui->actionEnable_AP_JT65->isChecked (); + if(m_mode=="Q65") dec_data.params.nmode=66; + if(m_mode=="Q65") dec_data.params.ntxmode=66; + if(m_mode=="JT4") { + dec_data.params.nmode=4; + dec_data.params.ntxmode=4; + } + if(m_mode=="FT8") dec_data.params.nmode=8; + if(m_mode=="FT8") dec_data.params.lft8apon = ui->actionEnable_AP_FT8->isVisible () && + ui->actionEnable_AP_FT8->isChecked (); + if(m_mode=="FT8") dec_data.params.napwid=50; + if(m_mode=="FT4") { + dec_data.params.nmode=5; + m_BestCQpriority=""; + } + if(m_mode=="FST4") dec_data.params.nmode=240; + if(m_mode=="FST4W") dec_data.params.nmode=241; + dec_data.params.ntxmode=dec_data.params.nmode; // Is this used any more? + dec_data.params.ntrperiod=m_TRperiod; + dec_data.params.nsubmode=m_nSubMode; + dec_data.params.minw=0; + dec_data.params.nclearave=m_nclearave; + if(m_nclearave!=0) { + QFile f(m_config.temp_dir ().absoluteFilePath ("avemsg.txt")); + f.remove(); + } + dec_data.params.dttol=m_DTtol; + dec_data.params.emedelay=0.0; + if(m_config.decode_at_52s()) dec_data.params.emedelay=2.5; + dec_data.params.minSync=ui->syncSpinBox->isVisible () ? m_minSync : 0; + dec_data.params.nexp_decode=int(m_specOp); + if(dec_data.params.nexp_decode==5) dec_data.params.nexp_decode=1; //NA VHF, WW Digi, ARRL Digi contests + if(dec_data.params.nexp_decode==8) dec_data.params.nexp_decode=1; //and Q65 Pileup all use 4-character + if(dec_data.params.nexp_decode==9) dec_data.params.nexp_decode=1; //grid exchange + if(m_config.single_decode()) dec_data.params.nexp_decode += 32; + if(m_config.enable_VHF_features()) dec_data.params.nexp_decode += 64; + if(m_mode.startsWith("FST4")) dec_data.params.nexp_decode += 256*(ui->sbNB->value()+3); + dec_data.params.max_drift=ui->sbMaxDrift->value(); + QString hisGrid; + hisGrid=ui->dxGridEntry->text (); + QString hisCall; + hisCall=ui->dxCallEntry->text (); + + if(m_mode=="FT8" && m_multithreadFT8) + { + //FT8 block of parameters for multithreaded FT8 decoder + dec_data.params.nstophint = 0; // stophint should be false to avoid truncating decode process + dec_data.params.nQSOProgress = m_QSOProgress; + dec_data.params.nftx = ui->TxFreqSpinBox->value (); + if(m_freqNominal < 30000000) dec_data.params.napwid=5; // FT8AP decoding bandwidth for 'mycall hiscall ???' and RRR,RR73,73 messages + else if(m_freqNominal < 100000000) dec_data.params.napwid=15; + else dec_data.params.napwid=50; + dec_data.params.nmt=m_ft8threads; + dec_data.params.ncandthin=m_ncandthin; + dec_data.params.ndtcenter=0; // ft8mod was 100 * ui->DTCenterSpinBox->value(); + if (m_ihsym==m_earlyDecode or m_ihsym==m_earlyDecode2) { + dec_data.params.nft8cycles=2; + } else { + dec_data.params.nft8cycles=m_nFT8Cycles; + } + if(m_houndMode) { dec_data.params.nft8rxfsens=1; } else { dec_data.params.nft8rxfsens=m_nFT8RXfSens; } + dec_data.params.nft4depth=m_nFT4depth; + if(m_ft8Sensitivity==1) dec_data.params.lft8lowth=false; + else dec_data.params.lft8lowth=true; + if(m_ft8Sensitivity==3) dec_data.params.lft8subpass=true; + else dec_data.params.lft8subpass=false; + dec_data.params.ltxing=(m_auto && (QDateTime::currentMSecsSinceEpoch()-m_mslastTX) < 26000) ? 1 : 0; // ft8mdwas ( m_enableTx and jtdxTime etc. + dec_data.params.lhideft8dupes=ui->actionHide_FT8_dupe_messages->isChecked() ? 1 : 0; //ft8md ui->actionHide_FT8_dupe_messages->isChecked() ? 1 : 0; + dec_data.params.lhound=m_houndMode ? 1 : 0; + dec_data.params.lcommonft8b=m_commonFT8b; + m_bMyCallStd=stdCall(m_config.my_callsign ()); //ft8md + m_bHisCallStd=stdCall(m_hisCall); //ft8md + dec_data.params.lmycallstd=m_bMyCallStd; + dec_data.params.lhiscallstd=m_bHisCallStd; + dec_data.params.lapmyc=m_lapmyc; + dec_data.params.lmodechanged=false; // m_modeChanged ? 1 : 0; m_modeChanged=false; + dec_data.params.lbandchanged=m_band_changed ? 1 : 0; // m_band_changed=false; + dec_data.params.lmultinst=m_multInst ? 1 : 0; + dec_data.params.lskiptx1=m_skipTx1 ? 1 : 0; + dec_data.params.nlasttx=m_nlasttx; + //ft8md dec_data.params.lforcesync=ui->syncButton->isChecked() && m_mode=="FT8"; + dec_data.params.ndecoderstart=m_ft8DecoderStart; + dec_data.params.nsecbandchanged=m_nsecBandChanged; m_nsecBandChanged=0; + dec_data.params.nhint=m_hint ? 1 : 0; + dec_data.params.ndelay=m_delay; + dec_data.params.nfqso=m_wideGraph->rxFreq(); + dec_data.params.ndepth=m_ndepth; + dec_data.params.nranera=m_config.ntrials(); + dec_data.params.lmultift8=m_multithreadFT8; //ft8md + dec_data.params.ntrials10=0; //ft8md was =m_config.ntrials10(); + dec_data.params.ntrialsrxf10=0; //ft8md was m_config.ntrialsrxf10(); + dec_data.params.nprepass=4; //ft8md was m_config.npreampass(); + dec_data.params.naggressive=1; //ft8md was m_config.aggressive(); + dec_data.params.nharmonicsdepth=0; //ft8md was m_config.harmonicsdepth(); + dec_data.params.ntopfreq65=3000; //ft8md was m_config.ntopfreq65(); + dec_data.params.nsdecatt=1; //ft8md was m_config.nsingdecatt(); + dec_data.params.fmaskact=true; //ft8md was m_config.fmaskact(); + if (m_ihsym==m_earlyDecode or m_ihsym==m_earlyDecode2 or (m_specOp==SpecOp::HOUND && m_config.superFox())) { + dec_data.params.lmultift8 = false; // use the standard FT8 decoder for early decoding step + if (m_ihsym==m_earlyDecode2) dec_data.params.ndepth=2; + } + qDebug() << "dec_data.params.lmultift8 is" << dec_data.params.lmultift8; //ft8md + dec_data.params.ndiskdat=0; + if(m_diskData) dec_data.params.ndiskdat=1; + dec_data.params.nfa=m_wideGraph->nStartFreq(); + dec_data.params.nfSplit=m_wideGraph->Fmin(); + if(m_specOp==SpecOp::HOUND && !m_config.superFox() && !ui->cbRxAll->isChecked()) { + dec_data.params.nfb=1000; + } else { + dec_data.params.nfb=m_wideGraph->Fmax(); + } + dec_data.params.ntol=50; // this value is not being used + dec_data.params.ntrperiod=int(m_TRperiod); + dec_data.params.lwidedxcsearch=m_FT8WideDxCallSearch ? 1 : 0; + } + ::memcpy(dec_data.params.datetime, m_dateTime.toLatin1()+" ", sizeof dec_data.params.datetime); + ::memcpy(dec_data.params.mycall, (m_config.my_callsign()+" ").toLatin1(),12); + + ::memcpy(dec_data.params.mybcall, (Radio::base_callsign(m_config.my_callsign())+" ").toLatin1(),12); + ::memcpy(dec_data.params.hiscall,(hisCall+" ").toLatin1(),12); + if(hisCall.length()<3) { + hisCall.clear(); + ::memcpy(dec_data.params.hisbcall,(hisCall+" ").toLatin1(),12); + } else { + ::memcpy(dec_data.params.hisbcall,(Radio::base_callsign(hisCall)+" ").toLatin1(),12); + } + ::memcpy(dec_data.params.hisgrid,(hisGrid+" ").toLatin1(),6); + ::memcpy(dec_data.params.mygrid, (m_config.my_grid()+" ").toLatin1(),6); + + if(!hisCall.isEmpty() && !m_auto && hisCall != m_lastloggedcall) dec_data.params.lenabledxcsearch=true; //ft8md was && !m_enableTx + else dec_data.params.lenabledxcsearch=false; + + if (auto * to = reinterpret_cast<char *> (mem_jt9->data())) + { + char *from = (char*) dec_data.ipc; + int size=sizeof(struct dec_data); + if(dec_data.params.newdat==0) { + int noffset {offsetof (struct dec_data, params.nutc)}; + to += noffset; + from += noffset; + size -= noffset; + } + if(m_mode=="MSK144" or m_bFast9) { + float t0=m_t0; + float t1=m_t1; + qApp->processEvents(); //Update the waterfall + if(m_nPick > 0) { + t0=m_t0Pick; + t1=m_t1Pick; + } + static short int d2b[360000]; + narg[0]=dec_data.params.nutc; + if(m_kdone>int(12000.0*m_TRperiod)) { + m_kdone=int(12000.0*m_TRperiod); + } + narg[1]=m_kdone; + narg[2]=m_nSubMode; + narg[3]=dec_data.params.newdat; + narg[4]=dec_data.params.minSync; + narg[5]=m_nPick; + narg[6]=1000.0*t0; + narg[7]=1000.0*t1; + narg[8]=2; //Max decode lines per decode attempt + if(dec_data.params.minSync<0) narg[8]=50; + if(m_mode=="JT9") narg[9]=102; //Fast JT9 + if(m_mode=="MSK144") narg[9]=104; //MSK144 + narg[10]=ui->RxFreqSpinBox->value(); + narg[11]=ui->sbFtol->value (); + narg[12]=0; + narg[13]=-1; + narg[14]=m_config.aggressive(); + memcpy(d2b,dec_data.d2,2*360000); + watcher3.setFuture (QtConcurrent::run (std::bind (fast_decode_, &d2b[0], + &narg[0],&m_TRperiod, &m_msg[0][0], dec_data.params.mycall, + dec_data.params.hiscall, (FCL)8000, (FCL)12, (FCL)12))); + } else { + mem_jt9->lock (); + memcpy(to, from, qMin(mem_jt9->size(), size)); + mem_jt9->unlock (); + to_jt9(m_ihsym,1,-1); //Send m_ihsym to jt9[.exe] and start decoding + decodeBusy(true); + } + } + if((m_mode=="FT4" or (m_mode=="FT8" and m_ihsym==41) or m_diskData) and + m_ActiveStationsWidget != NULL) { + if(m_mode!="Q65") m_ActiveStationsWidget->erase(); //TEMP + } +} + +void::MainWindow::fast_decode_done() +{ + float t,tmax=-99.0; + dec_data.params.nagain=false; + dec_data.params.ndiskdat=false; +// if(m_msg[0][0]==0) m_bDecoded=false; + for(int i=0; m_msg[i][0] && i<100; i++) { + QString message=QString::fromLatin1(m_msg[i]); + m_msg[i][0]=0; + if(message.length()>80) message=message.left (80); + if(narg[13]/8==narg[12]) message=message.trimmed().replace("<...>",m_calls); + +//Left (Band activity) window + DecodedText decodedtext {message.replace (QChar::LineFeed, "")}; + if(!m_bFastDone) { + ui->decodedTextBrowser->displayDecodedText (decodedtext, m_config.my_callsign (), m_mode, m_config.DXCC (), + m_logBook, m_currentBandPeriod, m_config.ppfx (), false, false, 0.0, false, -99, "", m_muted); + if(m_position != 0) ui->decodedTextBrowser->horizontalScrollBar()->setValue(m_position); + } + + t=message.mid(10,5).toFloat(); + if(t>tmax) { + tmax=t; + m_bDecoded=true; + } + postDecode (true, decodedtext.string ()); + write_all("Rx",message); + + if(m_mode=="JT9" or m_mode=="MSK144") { +// find and extract any report for myCall + bool stdMsg = decodedtext.report(m_baseCall, + Radio::base_callsign(ui->dxCallEntry->text()), m_rptRcvd); + +// extract details and send to PSKreporter + if (stdMsg) pskPost (decodedtext); + } + if (tmax >= 0.0) auto_sequence (decodedtext, ui->sbFtol->value (), ui->sbFtol->value ()); + } + m_startAnother=m_loopall; + m_nPick=0; + ui->DecodeButton->setChecked (false); + m_bFastDone=false; +} + +void MainWindow::to_jt9(qint32 n, qint32 istart, qint32 idone) +{ + if (auto * dd = reinterpret_cast<dec_data_t *> (mem_jt9->data())) + { + mem_jt9->lock (); + dd->ipc[0]=n; + if(istart>=0) dd->ipc[1]=istart; + if(idone>=0) dd->ipc[2]=idone; + mem_jt9->unlock (); + } +} + +void MainWindow::decodeDone () +{ + if(m_mode=="Q65") m_wideGraph->drawRed(0,0); + if ("FST4W" == m_mode) + { + if (m_uploadWSPRSpots + && m_config.is_transceiver_online ()) { // need working rig control +#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0) + uploadTimer.start(QRandomGenerator::global ()->bounded (0, 20000)); // Upload delay +#else + uploadTimer.start(20000 * qrand()/((double)RAND_MAX + 1.0)); // Upload delay +#endif + } + } + auto tnow = QDateTime::currentDateTimeUtc (); + double tdone = fmod(double(tnow.time().second()),m_TRperiod); + int mswait; + if( tdone < 0.5*m_TRperiod ) { + mswait = 1000.0 * ( 0.6 * m_TRperiod - tdone ); + } else { + mswait = 1000.0 * ( 1.6 * m_TRperiod - tdone ); + } + m_bDecoded=m_nDecodes>0; + if(!m_diskData and !m_saveAll) { + if(m_saveDecoded and (m_nDecodes==0)) { + killFileTimer.start(mswait); //Kill at 3/4 period + } + } + + dec_data.params.nagain=0; + dec_data.params.ndiskdat=0; + m_nclearave=0; + ui->DecodeButton->setChecked (false); + decodeBusy(false); + m_RxLog=0; + if(SpecOp::FOX == m_specOp) { + houndCallers(); + if(ui->cbWorkDupes->isChecked()) QTimer::singleShot (5000, [=] {band_activity_cleared();}); + } + to_jt9(m_ihsym,-1,1); //Tell jt9 we know it has finished + + m_startAnother=m_loopall; + if(m_bNoMoreFiles) { + MessageBox::information_message(this, tr("No more files to open.")); + m_bNoMoreFiles=false; + } + + if((m_mode=="FT4" or m_mode=="FT8") + and m_latestDecodeTime>=0 and m_ActiveStationsWidget!=NULL) { + if(!m_diskData and (m_nDecodes==0)) { + m_latestDecodeTime = (QDateTime::currentMSecsSinceEpoch()/1000) % 86400; + m_latestDecodeTime = int(m_latestDecodeTime/m_TRperiod); + m_latestDecodeTime = int(m_latestDecodeTime*m_TRperiod); + } + ARRL_Digi_Display(); // Update the ARRL_DIGI display + } + + if(m_mode!="FT8" or dec_data.params.nzhsym==50 or (m_mode=="FT8" and m_multithreadFT8 and (m_hsymStop==dec_data.params.nzhsym))) m_nDecodes=0; //ft8md + + if(m_mode=="Q65" and (m_specOp==SpecOp::NA_VHF or m_specOp==SpecOp::ARRL_DIGI + or m_specOp==SpecOp::WW_DIGI or m_specOp==SpecOp::Q65_PILEUP) + and m_ActiveStationsWidget!=NULL) { + refreshPileupList(); + } +} + +void MainWindow::refreshPileupList() +{ + // Update the ActiveStations display for Q65 pileup situation... + int nlist=0; + char list[2000]; + char line[36]; + list[0]=0; + auto fname {QDir::toNativeSeparators(m_config.writeable_data_dir().absoluteFilePath("tsil.3q"))}; + get_q3list_(const_cast<char *> (fname.toLatin1().constData()), &m_diskData, &nlist, + &list[0], (FCL)fname.length(), (FCL)2000); + QString t=""; + QString t0=""; + for(int i=0; i<nlist; i++) { + memcpy(line,&list[36*i],36); + t0=QString::fromLatin1(line)+"\n"; + m_callers[i]=t0; + t+=t0; + } + m_ActiveStationsWidget->setClickOK(false); + m_ActiveStationsWidget->displayRecentStations("Q65-pileup",t); + m_ActiveStationsWidget->setClickOK(true); +} + +void MainWindow::read_log() +{ + static QFile f {QDir {QStandardPaths::writableLocation (QStandardPaths::DataLocation)}.absoluteFilePath ("wsjtx.log")}; + f.open(QIODevice::ReadOnly); + if(f.isOpen()) { + QTextStream in(&f); + QString line,callsign; + for(int i=0; i<99999; i++) { + line=in.readLine(); + if(line.length()<=0) break; + callsign=line.mid(40,6); + int n=callsign.indexOf(","); + if(n>0) callsign=callsign.left(n); + m_EMEworked[callsign]=true; + m_score++; + } + f.close(); + } + if(m_ActiveStationsWidget!=NULL) { + m_ActiveStationsWidget->setScore(m_score); + if(m_mode=="Q65") m_ActiveStationsWidget->setRate(m_score); + } +} + +void MainWindow::ARRL_Digi_Update(DecodedText dt) +{ + if(m_mode=="Q65") { + m_fetched=0; + readWidebandDecodes(); + return; + } + + // Extract information relevant for the ARRL Digi contest + QString deCall; + QString deGrid; + dt.deCallAndGrid(/*out*/deCall,deGrid); + ActiveCall ac; + RecentCall rc; + + if(deGrid.contains(grid_regexp)) { + if(!m_activeCall.contains(deCall) or deGrid!=m_activeCall.value(deCall).grid4) { + // Transmitting station's call is not already in QMap "m_activeCall", or grid has changed. + // Insert the call, grid, and associated fixed data into the list. + + double utch=0.0; + int nAz,nEl,nDmiles,nDkm,nHotAz,nHotABetter; + QString my_Grid = m_config.my_grid(); + if (my_Grid.length() < 5) my_Grid = m_config.my_grid().left(4)+"mm"; + QString de_Grid= deGrid.left(4)+"mm"; + azdist_(const_cast <char *> (my_Grid.toLatin1().constData()), + const_cast <char *> (de_Grid.toLatin1().constData()),&utch, + &nAz,&nEl,&nDmiles,&nDkm,&nHotAz,&nHotABetter,(FCL)6,(FCL)6); + int points=nDkm/500; + if(nDkm > 500*points) points += 1; + points += 1; + ac.grid4=deGrid; + ac.bands="......."; + ac.az=nAz; + ac.points=points; + m_activeCall[deCall]=ac; + } + } + + m_points=-1; + if(m_activeCall.contains(deCall)) { + +// Don't display stations we already worked on this band. + QString band=m_config.bands()->find(m_freqNominal); + if(band=="160m" and m_activeCall[deCall].bands.indexOf("a")>=0) {m_recentCall.remove(deCall); return;} + if(band=="80m" and m_activeCall[deCall].bands.indexOf("b")>=0) {m_recentCall.remove(deCall); return;} + if(band=="40m" and m_activeCall[deCall].bands.indexOf("c")>=0) {m_recentCall.remove(deCall); return;} + if(band=="20m" and m_activeCall[deCall].bands.indexOf("d")>=0) {m_recentCall.remove(deCall); return;} + if(band=="15m" and m_activeCall[deCall].bands.indexOf("e")>=0) {m_recentCall.remove(deCall); return;} + if(band=="10m" and m_activeCall[deCall].bands.indexOf("f")>=0) {m_recentCall.remove(deCall); return;} + if(band=="6m" and m_activeCall[deCall].bands.indexOf("g")>=0) {m_recentCall.remove(deCall); return;} + + // Update the variable data for this deCall + rc.dialFreq=m_freqNominal; + rc.audioFreq=dt.frequencyOffset(); + rc.snr=dt.snr(); + m_latestDecodeTime=dt.timeInSeconds(); + rc.txEven = (m_latestDecodeTime % int(2*m_TRperiod)) > 0; + rc.ready2call=false; + bool bCQ=dt.messageWords()[0].left(3)=="CQ "; + if(bCQ or deGrid=="RR73" or deGrid=="73") rc.ready2call=true; + rc.decodeTime=m_latestDecodeTime; + m_recentCall[deCall]=rc; + m_points=m_activeCall.value(deCall).points; + } + updateRate(); +} + +void MainWindow::ARRL_Digi_Display() +{ + if(m_mode=="Q65") { + m_fetched=0; + readWidebandDecodes(); + return; + } + if (m_mode == "Fox Mode") { // ARRL_Digi_Display can be shown for other modes + if (m_ActiveStationsWidget != NULL) { + m_ActiveStationsWidget->setClickOK(true); + } + return; + } + QMutableMapIterator<QString,RecentCall> icall(m_recentCall); + QString deCall,deGrid; + int age=0; + int i=0; + int maxAge=m_ActiveStationsWidget->maxAge(); + int points=0; + int maxPoints=0; + int indx[1000]; + float pts[1000]; + QStringList list; + + while (icall.hasNext()) { + icall.next(); + deCall=icall.key(); + age=int((m_latestDecodeTime - icall.value().decodeTime)/m_TRperiod + 0.5); + if(age<0) age=age + int(86400/m_TRperiod); + int itx=1; + if(icall.value().txEven) itx=0; + int snr=icall.value().snr; + int freq=icall.value().audioFreq; + if(age>maxAge) { + icall.remove(); + } else { + bool bReady=false; + if(age==0 and m_recentCall.value(deCall).ready2call) bReady=true; + + QString bands=m_activeCall[deCall].bands; + bool bWorkedOnBand=false; + if(m_currentBand=="160m" and bands.mid(0,1)!=".") bWorkedOnBand=true; + if(m_currentBand=="80m" and bands.mid(1,1)!=".") bWorkedOnBand=true; + if(m_currentBand=="40m" and bands.mid(2,1)!=".") bWorkedOnBand=true; + if(m_currentBand=="20m" and bands.mid(3,1)!=".") bWorkedOnBand=true; + if(m_currentBand=="15m" and bands.mid(4,1)!=".") bWorkedOnBand=true; + if(m_currentBand=="10m" and bands.mid(5,1)!=".") bWorkedOnBand=true; + if(m_currentBand=="6m" and bands.mid(6,1)!=".") bWorkedOnBand=true; + + if((bReady or !m_ActiveStationsWidget->readyOnly()) and !bWorkedOnBand) { + i++; + int az=m_activeCall[deCall].az; + deGrid=m_activeCall[deCall].grid4; + points=m_activeCall[deCall].points; + if(points>maxPoints) maxPoints=points; + float x=float(age)/(maxAge+1); + if(x>1.0) x=0; + pts[i-1]=points - x; + QString t1; + if(!bReady) t1 = t1.asprintf(" %3d %+2.2d %4d %1d %2d %4d",az,snr,freq,itx,age,points); + if(bReady) t1 = t1.asprintf(" %3d %+2.2d %4d %1d %2d*%4d",az,snr,freq,itx,age,points); +// t1 = (deCall + " ").left(6) + " " + m_activeCall[deCall].grid4 + t1 + " " + bands; + t1 = (deCall + " ").left(6) + " " + m_activeCall[deCall].grid4 + t1; + list.append(t1); + } + } + } + if(i==0) return; + int jz=i; + m_ActiveStationsWidget->setClickOK(false); + int maxRecent=qMin(i,m_ActiveStationsWidget->maxRecent()); + indexx_(pts,&jz,indx); + QString t; + i=0; + for(int j=jz-1; j>=0; j--) { + int k=indx[j]-1; + m_ready2call[i]=list[k]; + i++; + QString t1=QString::number(i) + ". "; + if(i<10) t1=" " + t1; + t += (t1 + list[k] + "\n"); + if(i>=maxRecent) break; + } + bool is_fox_mode = (m_mode=="FT8" && m_specOp == SpecOp::FOX); + if(m_ActiveStationsWidget!=NULL && !is_fox_mode) m_ActiveStationsWidget->displayRecentStations(m_mode,t); + m_ActiveStationsWidget->setClickOK(true); +} + +void MainWindow::queueActiveWindowHound2(QString line) { + // Active Window shows what's going on outside of current F/H display rules (calling below 1000Hz e.g.) + // TODO should we allow calling a station that's calling another station, not us? + if (m_mode == "FT8" and m_specOp == SpecOp::FOX) { + // process the line to get the callsign + QStringList w = line.split(' ', SkipEmptyParts); + // make sure our call is the first in the list, or the station is CQing (not a directed CQ) + if ( (w.size() > 7) && + (w[5] == m_config.my_callsign() || w[5] == "<"+m_config.my_callsign()+">" || w[5]=="CQ") && + ( w[7].contains(grid_regexp) || w[7].contains(non_r_db_regexp) )){ + QString caller = w[6]; + QString grid = ""; + QString db = w[1]; + int db_i = w[1].toInt(); + db = (db_i >=0 ? "+":"") + QStringLiteral("%1").arg(db_i, (db_i >=0 ? 2:3), 10, QLatin1Char('0')); // +00, -01 etc. + // houndcall rpt grid + if (w[7].contains(grid_regexp)) grid = w[7]; + if (w[7].contains(non_r_db_regexp)) { + LOG_INFO(QString("ActiveStations Window click: %1 called with signal report %2").arg(caller).arg(w[7])); + } + if (caller.length() > 2) { + // make sure it's not already in the queue + for ( QString hs : m_houndQueue) { + if (hs.startsWith(caller)) { + //LOG_INFO(QString("ActiveStations Window click: %1 already in queue. Skipping").arg(hs)); + return; + } + } + // make sure caller is not in fox queue either + if(m_foxQSOinProgress.contains(caller)) { + //LOG_INFO(QString("ActiveStations Window click: %1 already in progress. Skipping").arg(caller)); + return; + } + + QString caller_rpt = (caller+" ").mid(0,12)+db; + if (m_houndQueue.count() < MAX_HOUNDS_IN_QUEUE) { + // add it to the queue + m_houndQueue.enqueue(caller_rpt + " " + grid); + refreshHoundQueueDisplay(); + // TODO: remove from active stations window too? + } + removeHoundFromCallingList(caller); + } + } else { + LOG_INFO(QString("ActiveStations Window click: skipping %1").arg(line)); + } + } +} + +void MainWindow::callSandP2(int n) +{ + m_specOp=m_config.special_op_id(); + bool bCtrl = (n<0); + n=qAbs(n)-1; + if(m_mode!="Q65" and m_ready2call[n]=="") return; + QStringList w=m_ready2call[n].split(' ', SkipEmptyParts); + if(m_mode=="Q65" and m_specOp==SpecOp::Q65_PILEUP and n < 40) { + // This code is for 6m EME DXpedition operator + w=m_callers[n].split(' ', SkipEmptyParts); + m_deCall=w[2]; + if(bCtrl) { + // Remove this call from q3list. + rm_q3list_(const_cast<char *> (m_deCall.toLatin1().constData()), m_deCall.size()); + refreshPileupList(); + return; + } + m_deGrid=w[3]; + m_bDoubleClicked=true; //### needed? + m_txFirst=true; + ui->dxCallEntry->setText(m_deCall); + ui->dxGridEntry->setText(m_deGrid); + ui->txFirstCheckBox->setChecked(m_txFirst); + genStdMsgs("-22"); + setTxMsg(3); + if (!ui->autoButton->isChecked()) ui->autoButton->click(); // Enable Tx + if(m_transmitting) m_restart=true; + return; + } + + if(m_mode=="Q65") { + if(!bCtrl) { //Do not reset m_freqNominal if CTRL was down + double kHz=w[1].toDouble(); + int nMHz=m_freqNominal/1000000; + m_freqNominal=(nMHz*1000 + kHz)* 1000; + } + m_deCall=w[4]; + m_deGrid=w[5]; + m_txFirst=(w[6]=="0"); +// ui->TxFreqSpinBox->setValue(1500); + } else { + m_deCall=w[0]; + m_deGrid=w[1]; + ui->RxFreqSpinBox->setValue(w[4].toInt()); + m_txFirst = (w[5]=="0"); + } + + if(w[3].left(2)=="30") { + ui->sbTR->setValue(30); + } else { + ui->sbTR->setValue(60); + } + if(w[3].right(1)=="A") ui->sbSubmode->setValue(0); + if(w[3].right(1)=="B") ui->sbSubmode->setValue(1); + if(w[3].right(1)=="C") ui->sbSubmode->setValue(2); + if(w[3].right(1)=="D") ui->sbSubmode->setValue(3); + if(w[3].right(1)=="E") ui->sbSubmode->setValue(4); + if(w[3].right(1)=="F") ui->sbSubmode->setValue(5); + + m_bDoubleClicked=true; //### needed? + ui->dxCallEntry->setText(m_deCall); + ui->dxGridEntry->setText(m_deGrid); + if(m_mode=="Q65") { + ui->rptSpinBox->setValue(w[2].toInt()); + genStdMsgs(w[2]); + } else { + genStdMsgs(w[3]); + } + setTxMsg(1); + ui->txFirstCheckBox->setChecked(m_txFirst); + static qint64 ms0=0; + qint64 ms=QDateTime::currentMSecsSinceEpoch(); + if(SpecOp::NONE==m_specOp) { + if(ui->autoButton->isChecked()) { + if((ms-ms0)>500) ui->autoButton->click(); // Disable Tx on single click + } else if((ms-ms0)<=500) { + ui->autoButton->click(); // Enable Tx again, on double click + } + if(m_mode=="Q65" && m_ActiveStationsWidget!=NULL) { + setRig (m_freqNominal); + setXIT (ui->TxFreqSpinBox->value ()); + } + } else { + if(ui->autoButton->isChecked()) { + if((ms-ms0)<=500) ui->autoButton->click(); // Disable Tx on double click + } else if((ms-ms0)>500) { + ui->autoButton->click(); // Enable Tx on single click + } + } + ms0=ms; + if(m_transmitting) m_restart=true; +} + +void MainWindow::activeWorked(QString call, QString band) +{ + QString bands=m_activeCall[call].bands; + QByteArray ba=bands.toLatin1(); + if(band=="160m") ba[0]='a'; + if(band=="80m") ba[1]='b'; + if(band=="40m") ba[2]='c'; + if(band=="20m") ba[3]='d'; + if(band=="15m") ba[4]='e'; + if(band=="10m") ba[5]='f'; + if(band=="6m") ba[6]='g'; + m_activeCall[call].bands=QString::fromLatin1(ba); +} + +void MainWindow::readFromStdout() //readFromStdout +{ + bool bDisplayPoints = false; + filtered = false; + ignored = false; + m_muted = false; + QString all_decodes; + if(m_ActiveStationsWidget!=NULL) { + bDisplayPoints=(m_mode=="FT4" or m_mode=="FT8") and + (m_specOp==SpecOp::ARRL_DIGI or m_ActiveStationsWidget->isVisible()); + } + while(proc_jt9.canReadLine()) { + auto line_read = proc_jt9.readLine (); + + QString the_line = QString(line_read); + if(ui->actionEnable_QSY_Popups->isChecked() || m_qsymonitorWidget) showQSYMessage(the_line); + + if (m_mode == "FT8" and m_specOp == SpecOp::FOX and m_ActiveStationsWidget != NULL) { // see if we should add this to ActiveStations window + if (!m_ActiveStationsWidget->wantedOnly() || + (the_line.contains(" " + m_config.my_callsign() + " ") || + the_line.contains(" <" + m_config.my_callsign() + "> "))) + all_decodes.append(line_read); + } + if (auto p = std::strpbrk (line_read.constData (), "\n\r")) { + // truncate before line ending chars + line_read = line_read.left (p - line_read.constData ()); + } + if(bDisplayPoints) line_read=line_read.replace("a7"," "); + bool haveFSpread {false}; + bool blockUDP {false}; // allow udp spotting (JTAlert) for all non-filtered messages + bool block_right_display {false}; + float fSpread {0.}; + if (m_mode.startsWith ("FST4")) + { + auto text = line_read.mid (64, 6).trimmed (); + if (text.size ()) + { + fSpread = text.toFloat (&haveFSpread); + line_read = line_read.left (64); + } + auto const& cs = m_config.my_callsign ().toLocal8Bit (); + if ("FST4W" == m_mode && ui->cbNoOwnCall->isChecked () + && (line_read.contains (" " + cs + " ") + || line_read.contains ("<" + cs + ">"))) { + continue; + } + } + + QString message0 {QString::fromUtf8(line_read.constData())}; + DecodedText decodedtext0 {QString::fromUtf8(line_read.constData())}; + DecodedText decodedtext {QString::fromUtf8(line_read.constData()).remove("TU; ")}; + + // Don't allow a7 decodes during the first period and for non-contest messages when in any contest mode + if ((!((no_a7_decodes && line_read.contains("a7") && !m_diskData) or (line_read.contains("a7") && SpecOp::NONE!=m_specOp + && !m_diskData && !(line_read.contains(" R ") or line_read.contains("RR73") or line_read.contains("CQ "))))) + + // Filtering out some false decodes, and don't write all.txt for such + // FDR step 1 + and (!((SpecOp::NONE==m_specOp or (m_multithreadFT8 && m_ft8DecoderStart<2)) && + ((m_mode=="FT8" && ((m_multithreadFT8 && m_ft8DecoderStart<2) or m_freqNominal>45000000) && earlyDecodes.contains(line_read.mid(23,19))) // MTD or a7/a8 dupes + or ((SpecOp::NONE==m_specOp && decodedtext.snr() < -12) && (message0.contains("> <") // two hashes + || message0.contains(QRegularExpression {"(\\w+)/P (\\w+)/P "}) // two /P calls + || message0.contains(QRegularExpression {"(\\w+)/R (\\w+)/R "}) // two /R calls + || (message0.contains("/R ") && message0.contains("?")) // insecure /R decodes + || (message0.contains(";") && message0.contains(" R "))))))) // invalid combination + // FDR step 2 + and (!(SpecOp::NONE==m_specOp && ui->actionReduce_false_decodes->isChecked() && m_mode=="FT8" && + ((((message0.contains("/P ") && message0.contains(" R ")) // /P and R + || (message0.contains(";") && message0.contains("/R ")) // ; and /R + || (message0.contains(";") && message0.contains("/P ")) // ; and /P + || (message0.contains("<...>") && message0.contains(" R ")) // hash and R + || (message0.contains("<...>") && message0.contains("/P ")) // hash and /P + || (message0.contains("<...>") && message0.contains(";")) // hash and ; + || message0.contains(QRegularExpression {"\\w\\w\\w\\w\\w\\w\\w\\w"}) // likely invalid callsigns + || message0.contains(QRegularExpression {"\\d\\d\\d \\d\\d\\d"}) // contest messages + || message0.contains("3.") || message0.contains("2.")) // -1.9 < dt < 1.9 + && (decodedtext.snr() < -15)) // for such SNRmin = -15 + or ((message0.contains("/R ") or message0.contains(" R ")) && decodedtext.snr() < -18) // for /R or contest calls SNRmin = -18 + or (((message0.contains("<...>") || message0.contains(";") // unresolved hash and F/H messages + || message0.contains("? a") // ap decodes of low confidence + || message0.contains("/R ") || message0.contains(" R ") // rover and contest callsigns + || decodedtext.snr() < -20) // SNR < -20 + && (message0.contains("3.") || message0.contains("2."))))))) // for such -1.9 < dt < 1.9 + ) + { + if (m_mode!="FT8" and m_mode!="FT4" and !m_mode.startsWith ("FST4") and m_mode!="Q65") { + //Pad 22-char msg to at least 37 chars + line_read = line_read.left(44) + " " + line_read.mid(44); + } + bool bAvgMsg=false; + int navg=0; + + if(line_read.indexOf("<DecodeFinished>") >= 0) { + m_bDecoded = line_read.mid(20).trimmed().toInt() > 0; + int n=line_read.trimmed().size(); + int n2=line_read.trimmed().mid(n-7).toInt(); + int n0=n2/1000; + int n1=n2%1000; + if(m_mode=="Q65") { + ndecodes_label.setText(QString {"%1 %2"}.arg (n0).arg (n1)); + } else { + if(m_nDecodes==0 && !(m_multithreadFT8 && m_diskData)) ndecodes_label.setText("0"); + } + decodeDone (); + return; + } else { + m_nDecodes+=1; + if(m_mode!="Q65") ndecodes_label.setText(QString::number(m_nDecodes)); + if(m_mode=="JT4" or m_mode=="JT65" or m_mode=="Q65") { + //### Do something about Q65 here ? ### + int nf=line_read.indexOf("f"); + if(nf>0) { + navg=line_read.mid(nf+1,1).toInt(); + if(line_read.indexOf("f*")>0) navg=10; + } + int nd=-1; + if(nf<0) nd=line_read.indexOf("d"); + if(nd>0) { + navg=line_read.mid(nd+2,1).toInt(); + if(line_read.mid(nd+2,1)=="*") navg=10; + } + int na=-1; + if(nf<0 and nd<0) na=line_read.indexOf("a"); + if(na>0) { + navg=line_read.mid(na+2,1).toInt(); + if(line_read.mid(na+2,1)=="*") navg=10; + } + int nq=-1; + if(nf<0 and nd<0 and na<0) nq=line_read.indexOf("q"); + if(nq>0) { + navg=line_read.mid(nq+2,1).toInt(); + if(line_read.mid(nq+2,1)=="*") navg=10; + } + if(navg>=2) bAvgMsg=true; + } + write_all("Rx", line_read.trimmed()); + } // Filtering out some false decodes, and don't write all.txt for such + + if ("FST4W" == m_mode) + { + uploadWSPRSpots (true, line_read); + } + + // Check validity of callsigns if "Reduce false decodes" is checked // EXPERIMENTAL FOR NOW + if (m_mode=="FT8" && !m_multithreadFT8 && ui->actionReduce_false_decodes->isChecked() && decodedtext.snr() < -20) { + bool notInALLCALL7 = false; + QString deCall; + QString deGrid; + decodedtext.deCallAndGrid(/*out*/deCall,deGrid); + QStringList word; + word=decodedtext.string().mid(24).replace("<","").replace(">","").replace("/P","").replace("/R","").replace("/QRP","").replace("/5W","").split(" ",SkipEmptyParts); + + // check file ALLCALL7.TXT + if (deCall!="TNX" && deCall!="73" && deCall!="GL" && deCall!="HNY" && deCall!="TU" && !deCall.left(4).contains("/") + && !decodedtext.string().contains("<...>") && !ALLCALL7.contains(deCall)) { + notInALLCALL7 = true; +// ui->decodedTextBrowser->insertText("deCall not in ALLCALL7.TXT"); + } + if (!ALLCALL7.contains(word[0]) && !(decodedtext.string().contains(" CQ ") or decodedtext.string().contains("TNX") + or decodedtext.string().contains("...") or decodedtext.string().contains("HNY") or decodedtext.string().contains("QSY") + or decodedtext.string().contains("73 ") or decodedtext.string().contains("GL ") or decodedtext.string().contains("PSE") + or decodedtext.string().contains("/") or decodedtext.string().contains("<...>"))) { + notInALLCALL7 = true; +// ui->decodedTextBrowser->insertText("word0 not in ALLCALL7.TXT"); + } + + // check syntax of the two callsigns before we hide such messages + if (notInALLCALL7) { + deCall=deCall.replace("<","").replace(">","").replace("/P","").replace("/R","").replace("/QRP","").replace("/5W",""); + if (deCall!="TNX" && deCall!="73" && deCall!="GL" && deCall!="HNY" && + !(deCall.left(3).contains(QRegularExpression {"\\w\\d\\w"}) or + deCall.left(3).contains(QRegularExpression {"\\d\\w\\d"}) or + deCall.left(3).contains(QRegularExpression {"\\w\\w\\d"}) or + deCall.left(4).contains("/") or decodedtext.string().contains("<...>"))) { +// ui->decodedTextBrowser->insertText("deCall has false syntax"); + filtered = true; + } + if (word[0]!="CQ" && word[0]!="TNX" && word[0]!="73 " && word[0]!="HNY" && word[0]!="QSY" && word[0]!="PSE" && + !(word[0].left(3).contains(QRegularExpression {"\\w\\d\\w"}) or + word[0].left(3).contains(QRegularExpression {"\\d\\w\\d"}) or + word[0].left(3).contains(QRegularExpression {"\\w\\w\\d"}) or + decodedtext.string().contains("/")or decodedtext.string().contains("<...>"))) { +// ui->decodedTextBrowser->insertText("word0 has false syntax"); + filtered = true; + } + } + notInALLCALL7 = false; + } + + if(m_mode=="FT8" and SpecOp::FOX == m_specOp and + (decodedtext.string().contains("R+") or decodedtext.string().contains("R-"))) { + auto for_us = decodedtext.string().contains(" " + m_config.my_callsign() + " ") or + decodedtext.string().contains(" "+m_baseCall) or + decodedtext.string().contains(m_baseCall+" ") or + decodedtext.string().contains(" <" + m_config.my_callsign() + "> "); + if(decodedtext.string().contains(" DE ")) for_us=true; //Hound with compound callsign + if(for_us) { + QString houndCall,houndGrid; + decodedtext.deCallAndGrid(/*out*/houndCall,houndGrid); + foxRxSequencer(decodedtext.string(),houndCall,houndGrid); + } + } + +//Left (Band activity) window + if(!bAvgMsg) { + if(m_mode=="FT8" and SpecOp::FOX == m_specOp) { + if(!m_bDisplayedOnce) { + // This hack sets the font. Surely there's a better way! + DecodedText dt{"."}; + ui->decodedTextBrowser->displayDecodedText (dt, m_config.my_callsign (), m_mode, m_config.DXCC (), + m_logBook, m_currentBand, m_config.ppfx ()); + m_bDisplayedOnce=true; + } + } else { + +#ifdef FOX_OTP + // remove verifications that are done + QMutableListIterator < FoxVerifier * > it(m_verifications); + while (it.hasNext()) { + if (it.next()->finished()) { + it.remove(); + } + } +#endif + DecodedText decodedtext1=decodedtext0; + if ((m_mode=="FT4" or m_mode=="FT8") and bDisplayPoints and decodedtext1.isStandardMessage()) { + ARRL_Digi_Update(decodedtext1); + } + +#ifdef FOX_OTP + if (SpecOp::HOUND == m_specOp) + { + // Payload formats (from column 24 onward): + // Standard: CALL.OTP e.g. "K8R.920749" + // SuperFox: $VERIFY$ CALL OTP e.g. "$VERIFY$ VP2X/K1JT 920749" + // Callsigns may include '/' and decoder output may contain variable spacing. + static const QRegularExpression stdPayloadRe{ + QStringLiteral("^([A-Z0-9]{2,6})\\.([0-9]{6})$")}; + static const QRegularExpression verifyPayloadRe{ + QStringLiteral("^\\$VERIFY\\$\\s+([A-Z0-9/]{2,13})\\s+([0-9]{6})$")}; + + QString const payload = decodedtext0.mid(24, -1).trimmed(); + QString callsign, otp; + unsigned int hz = 0; + + QRegularExpressionMatch payloadMatch = stdPayloadRe.match(payload); + if (payloadMatch.hasMatch()) { + callsign = payloadMatch.captured(1); + otp = payloadMatch.captured(2); + hz = static_cast<unsigned int>(decodedtext0.frequencyOffset()); + } else if (m_config.superFox() && + (payloadMatch = verifyPayloadRe.match(payload)).hasMatch()) { + callsign = payloadMatch.captured(1); + otp = payloadMatch.captured(2); + hz = 750; + } + + if (!callsign.isEmpty()) { + if (!m_config.ShowOTP() || otp == QLatin1String("000000")) + filtered = true; + + QDateTime verifyDateTime; + if (m_diskData) { + verifyDateTime = m_UTCdiskDateTime; + } else { + verifyDateTime = QDateTime(QDateTime::currentDateTimeUtc().date(), + QTime::fromString(decodedtext0.left(6), "hhmmss")); + } + if (otp != QLatin1String("000000")) { + FoxVerifier *fv = new FoxVerifier(MainWindow::userAgent(), + &m_network_manager, + m_config.OTPUrl(), + callsign, + verifyDateTime, + otp, + hz); + connect(fv, &FoxVerifier::verifyComplete, this, &MainWindow::handleVerifyMsg); + m_verifications << fv; + } + } + } +#endif + + QString text = decodedtext.string().replace("<","").replace(">",""); // for Wait & Reply/Call and filtering + + // FT4 NS (NCCC Sprints): Log QSO after receiving "mycall hiscall R hisgrid" + if (m_mode=="FT4" && SpecOp::NA_VHF==m_specOp && m_config.NCCC_Sprint() && m_hisCall!="" && m_hisGrid!="" && + text.contains(" " + m_config.my_callsign() + " " + m_hisCall + " R " + m_hisGrid.left(4))) { + if (m_config.prompt_to_log() || m_config.autoLog()) logQSOTimer.start(0); + QTimer::singleShot (500, [=] { + on_stopTxButton_clicked(); + }); + } + + // Stop Wait & Call timeout when in QSO with this station + if (ui->DX_Call_Button->isChecked() && m_hisCall!="" && text.contains(" " + m_config.my_callsign() + " " + m_hisCall)) { + stopWCTimer.stop(); // stop any Wait & Call timeout + if (ui->DX_Call_Button->isChecked()) ui->DX_Call_Button->click (); // disable Wait & Call + no_wait_and_call = false; // reset Wait & Call + } + + // Wait & Reply + FT4 NS (NCCC Sprints) reply to incoming RR73 messages + if ((m_mode=="FT8" or m_mode=="FT4" or m_mode=="Q65" or m_mode=="FST4" or m_mode=="JT65" or m_mode=="JT9" or m_mode=="JT4") && m_hisCall!="" + && text.contains(" " + m_config.my_callsign() + " " + m_hisCall) && ((!text.contains("73 ") + && m_config.Wait_features_enabled() && !ui->autoButton->isChecked()) + or (m_mode=="FT4" && SpecOp::NA_VHF==m_specOp && m_config.NCCC_Sprint()))) { + if (SpecOp::HOUND==m_specOp && (text.mid(4,2).contains("15") or text.mid(4,2).contains("45"))) return; // ignore stations calling in the wrong time slot + tx_watchdog (false); + m_bDoubleClicked = true; + processMessage(decodedtext0); + auto_tx_mode(true); + if (m_mode=="FT4" && SpecOp::NA_VHF==m_specOp && m_config.NCCC_Sprint()) { + if (!no_logging) logQSOTimer.start(0); // logging of stations not in contest mode + } else { + if (m_config.Wait_features_enabled()) stopWRTimer.start(int(8000.0*m_TRperiod)); // Wait & Reply Tx max 8*TRperiod + } + } + + // Wait & Call + if (wait_and_call && (m_mode=="FT8" or m_mode=="FT4" or m_mode=="Q65" or m_mode=="FST4" or m_mode=="JT65" or m_mode=="JT9" or m_mode=="JT4") && + m_specOp!=SpecOp::FOX && ui->cbAutoSeq->isChecked() && m_hisCall!="" && !no_wait_and_call && + (text.contains("CQ " + m_hisCall) or text.contains("CQ DX " + m_hisCall) or text.contains(m_hisCall + " RR73") + or text.contains(m_hisCall + " RRR") or text.contains(m_hisCall + " 73")) + && m_config.Wait_features_enabled()) { + if (!text.contains(" " + m_config.my_callsign() + " " + m_hisCall)) + block_right_display = true; // prevent display of first message twice + m_bDoubleClicked = true; + processMessage(decodedtext0); + auto_tx_mode(true); + no_wait_and_call = true; + stopWCTimer.start(int(6200.0*m_TRperiod)); // Wait & Call Tx max 8*TRperiod + } + + // Filtering + QString text2 = ""; + QStringList tw; + if (m_mode == "FT8" or m_mode == "FT4" or m_mode == "Q65" or m_mode == "FST4") { + tw=text.mid(24).split(" ",SkipEmptyParts); + } else { + tw=text.mid(22).split(" ",SkipEmptyParts); + } + if (m_config.filters_for_word2()) { + if (tw.size () < 2) { + text2 = "___"; // prevent segfault errors with free text messages + } else if (tw[1].length() == 2 && tw[1].contains(QRegularExpression{"\\w\\w"})) { // directional calls + if (tw.size () > 2) { + text2 = tw[2]; // for directional calls analyze word 3 for filtering + } else { + text2 = "___"; // prevent segfault errors with free text messages + } + } else { + if (text.contains(";")) { + text2 = tw[3]; // analyze word 4 for filtering of combined messages + } else { + text2 = tw[1]; // otherwise analyze word 2 for filtering + } + } + if (!(SpecOp::NONE==m_specOp && m_config.AlwaysPass () // Always pass messages with keywords from Always Pass list + && ( + (text2.startsWith(m_config.Pass1()) && (m_config.Pass1()!="")) + || (text2.startsWith(m_config.Pass2()) && (m_config.Pass2()!="")) + || (text2.startsWith(m_config.Pass3()) && (m_config.Pass3()!="")) + || (text2.startsWith(m_config.Pass4()) && (m_config.Pass4()!="")) + || (text2.startsWith(m_config.Pass5()) && (m_config.Pass5()!="")) + || (text2.startsWith(m_config.Pass6()) && (m_config.Pass6()!="")) + || (text2.startsWith(m_config.Pass7()) && (m_config.Pass7()!="")) + || (text2.startsWith(m_config.Pass8()) && (m_config.Pass8()!="")) + || (text2.startsWith(m_config.Pass9()) && (m_config.Pass9()!="")) + || (text2.startsWith(m_config.Pass10()) && (m_config.Pass10()!="")) + || (text2.startsWith(m_config.Pass11()) && (m_config.Pass11()!="")) + || (text2.startsWith(m_config.Pass12()) && (m_config.Pass12()!="")) + ))) { + + // Filtering out messages with keywords from Blacklist + if ((SpecOp::NONE==m_specOp or SpecOp::HOUND==m_specOp) && m_config.Blacklisted () + && ( + (text2.startsWith(m_config.Blacklist1()) && (m_config.Blacklist1()!="")) + || (text2.startsWith(m_config.Blacklist2()) && (m_config.Blacklist2()!="")) + || (text2.startsWith(m_config.Blacklist3()) && (m_config.Blacklist3()!="")) + || (text2.startsWith(m_config.Blacklist4()) && (m_config.Blacklist4()!="")) + || (text2.startsWith(m_config.Blacklist5()) && (m_config.Blacklist5()!="")) + || (text2.startsWith(m_config.Blacklist6()) && (m_config.Blacklist6()!="")) + || (text2.startsWith(m_config.Blacklist7()) && (m_config.Blacklist7()!="")) + || (text2.startsWith(m_config.Blacklist8()) && (m_config.Blacklist8()!="")) + || (text2.startsWith(m_config.Blacklist9()) && (m_config.Blacklist9()!="")) + || (text2.startsWith(m_config.Blacklist10()) && (m_config.Blacklist10()!="")) + || (text2.startsWith(m_config.Blacklist11()) && (m_config.Blacklist11()!="")) + || (text2.startsWith(m_config.Blacklist12()) && (m_config.Blacklist12()!="")) + )) { + if (!ui->cbBypass->isChecked()) filtered = true; + if (!(m_config.filters_for_Wait_and_Pounce_only() or ui->cbBypass->isChecked())) return; + // reset dB score when filtered + if (pounce && (ui->respondComboBox->currentText()=="CQ: Max Dist" + or ui->respondComboBox->currentText()=="CQ: Max dB" + or ui->respondComboBox->currentText()=="CQ: Min dB")) { + Dpoints=0; + maxDPoints=0; + dBpoints=-28; + dBpoints2=99; + maxdBPoints=-28; + mindBPoints=99; + } + + // Filtering out everything but messages with keywords from Whitelist + } else if ((SpecOp::NONE==m_specOp or SpecOp::HOUND==m_specOp) && m_config.Whitelisted () + && !(text2.startsWith(m_config.Whitelist1()) && (m_config.Whitelist1()!="")) + && !(text2.startsWith(m_config.Whitelist2()) && (m_config.Whitelist2()!="")) + && !(text2.startsWith(m_config.Whitelist3()) && (m_config.Whitelist3()!="")) + && !(text2.startsWith(m_config.Whitelist4()) && (m_config.Whitelist4()!="")) + && !(text2.startsWith(m_config.Whitelist5()) && (m_config.Whitelist5()!="")) + && !(text2.startsWith(m_config.Whitelist6()) && (m_config.Whitelist6()!="")) + && !(text2.startsWith(m_config.Whitelist7()) && (m_config.Whitelist7()!="")) + && !(text2.startsWith(m_config.Whitelist8()) && (m_config.Whitelist8()!="")) + && !(text2.startsWith(m_config.Whitelist9()) && (m_config.Whitelist9()!="")) + && !(text2.startsWith(m_config.Whitelist10()) && (m_config.Whitelist10()!="")) + && !(text2.startsWith(m_config.Whitelist11()) && (m_config.Whitelist11()!="")) + && !(text2.startsWith(m_config.Whitelist12()) && (m_config.Whitelist12()!="")) + ) { + if (!ui->cbBypass->isChecked()) filtered = true; + if (!(m_config.filters_for_Wait_and_Pounce_only() or ui->cbBypass->isChecked())) return; + // reset dB score when filtered + if (pounce && (ui->respondComboBox->currentText()=="CQ: Max Dist" + or ui->respondComboBox->currentText()=="CQ: Max dB" + or ui->respondComboBox->currentText()=="CQ: Min dB")) { + Dpoints=0; + maxDPoints=0; + dBpoints=-28; + dBpoints2=99; + maxdBPoints=-28; + mindBPoints=99; + } + } + + // search logbook for filtering + if (ui->actionHideTerritory1->isChecked() or ui->actionHideTerritory2->isChecked() or + ui->actionHideTerritory3->isChecked() or ui->actionHideTerritory4->isChecked() or + ui->actionHideB4->isChecked() or ui->actionHideEU->isChecked() or ui->actionHideAS->isChecked() or + ui->actionHideNA->isChecked() or ui->actionHideSA->isChecked() or ui->actionHideAF->isChecked() or + ui->actionHideOC->isChecked() or ui->actionHideAN->isChecked()) { + QString deCall; + QString deGrid; + decodedtext.deCallAndGrid(/*out*/deCall,deGrid); + // search for country names + if (ui->actionHideTerritory1->isChecked() or ui->actionHideTerritory2->isChecked() or + ui->actionHideTerritory3->isChecked() or ui->actionHideTerritory4->isChecked()) { + auto const& looked_up = m_logBook.countries ()->lookup (deCall); + auto countryName = looked_up.entity_name; + // do some obvious abbreviations + countryName.replace ("Islands", "Is."); + countryName.replace ("Island", "Is."); + countryName.replace ("North ", "N. "); + countryName.replace ("Northern ", "N. "); + countryName.replace ("South ", "S. "); + countryName.replace ("East ", "E. "); + countryName.replace ("Eastern ", "E. "); + countryName.replace ("West ", "W. "); + countryName.replace ("Western ", "W. "); + countryName.replace ("Central ", "C. "); + countryName.replace (" and ", " & "); + countryName.replace ("Republic", "Rep."); + countryName.replace ("United States of America", "U.S.A."); + countryName.replace ("United States", "U.S.A."); + countryName.replace ("Fed. Rep. of ", ""); + countryName.replace ("French ", "Fr."); + countryName.replace ("Asiatic", "AS"); + countryName.replace ("European", "EU"); + countryName.replace ("African", "AF"); + if (ui->actionHideTerritory1->isChecked() && countryName.contains(m_config.Territory1()) + && (m_config.Territory1()!="") && !ui->cbBypass->isChecked()) filtered = true; + if (ui->actionHideTerritory2->isChecked() && countryName.contains(m_config.Territory2()) + && (m_config.Territory2()!="") && !ui->cbBypass->isChecked()) filtered = true; + if (ui->actionHideTerritory3->isChecked() && countryName.contains(m_config.Territory3()) + && (m_config.Territory3()!="") && !ui->cbBypass->isChecked()) filtered = true; + if (ui->actionHideTerritory4->isChecked() && countryName.contains(m_config.Territory4()) + && (m_config.Territory4()!="") && !ui->cbBypass->isChecked()) filtered = true; + } + // search for callsigns worked B4 on band + if (ui->actionHideB4->isChecked()) { + bool callB4onBand; + bool countryB4onBand; + bool gridB4onBand; + bool continentB4onBand; + bool CQZoneB4onBand; + bool ITUZoneB4onBand; + auto const& looked_up = m_logBook.countries ()->lookup (deCall); + m_logBook.match (deCall, m_mode, deGrid, looked_up, callB4onBand, countryB4onBand, gridB4onBand, + continentB4onBand, CQZoneB4onBand, ITUZoneB4onBand, m_currentBand); + if (callB4onBand && ui->actionHideB4->isChecked() && !ui->cbBypass->isChecked()) filtered = true; + } + // search for continents + if (ui->actionHideEU->isChecked() or ui->actionHideAS->isChecked() or ui->actionHideNA->isChecked() + or ui->actionHideSA->isChecked() or ui->actionHideAF->isChecked() or ui->actionHideOC->isChecked() + or ui->actionHideAN->isChecked()) { + auto const& looked_up = m_logBook.countries ()->lookup (deCall); + QString continent = AD1CCty::continent (looked_up.continent); + if (ui->actionHideEU->isChecked() && continent == "EU" && !ui->cbBypass->isChecked()) filtered = true; + if (ui->actionHideAS->isChecked() && continent == "AS" && !ui->cbBypass->isChecked()) filtered = true; + if (ui->actionHideNA->isChecked() && continent == "NA" && !ui->cbBypass->isChecked()) filtered = true; + if (ui->actionHideSA->isChecked() && continent == "SA" && !ui->cbBypass->isChecked()) filtered = true; + if (ui->actionHideAF->isChecked() && continent == "AF" && !ui->cbBypass->isChecked()) filtered = true; + if (ui->actionHideOC->isChecked() && continent == "OC" && !ui->cbBypass->isChecked()) filtered = true; + if (ui->actionHideAN->isChecked() && continent == "AN" && !ui->cbBypass->isChecked()) filtered = true; + } + } + } + } else { + if (!(SpecOp::NONE==m_specOp && m_config.AlwaysPass () // Always pass messages with keywords from Always Pass list + && ( + (text.contains(m_config.Pass1()) && (m_config.Pass1()!="")) + || (text.contains(m_config.Pass2()) && (m_config.Pass2()!="")) + || (text.contains(m_config.Pass3()) && (m_config.Pass3()!="")) + || (text.contains(m_config.Pass4()) && (m_config.Pass4()!="")) + || (text.contains(m_config.Pass5()) && (m_config.Pass5()!="")) + || (text.contains(m_config.Pass6()) && (m_config.Pass6()!="")) + || (text.contains(m_config.Pass7()) && (m_config.Pass7()!="")) + || (text.contains(m_config.Pass8()) && (m_config.Pass8()!="")) + || (text.contains(m_config.Pass9()) && (m_config.Pass9()!="")) + || (text.contains(m_config.Pass10()) && (m_config.Pass10()!="")) + || (text.contains(m_config.Pass11()) && (m_config.Pass11()!="")) + || (text.contains(m_config.Pass12()) && (m_config.Pass12()!="")) + ))) { + + // Filtering out messages with keywords from Blacklist + if ((SpecOp::NONE==m_specOp or SpecOp::HOUND==m_specOp) && m_config.Blacklisted () + && ( + (text.contains(m_config.Blacklist1()) && (m_config.Blacklist1()!="")) + || (text.contains(m_config.Blacklist2()) && (m_config.Blacklist2()!="")) + || (text.contains(m_config.Blacklist3()) && (m_config.Blacklist3()!="")) + || (text.contains(m_config.Blacklist4()) && (m_config.Blacklist4()!="")) + || (text.contains(m_config.Blacklist5()) && (m_config.Blacklist5()!="")) + || (text.contains(m_config.Blacklist6()) && (m_config.Blacklist6()!="")) + || (text.contains(m_config.Blacklist7()) && (m_config.Blacklist7()!="")) + || (text.contains(m_config.Blacklist8()) && (m_config.Blacklist8()!="")) + || (text.contains(m_config.Blacklist9()) && (m_config.Blacklist9()!="")) + || (text.contains(m_config.Blacklist10()) && (m_config.Blacklist10()!="")) + || (text.contains(m_config.Blacklist11()) && (m_config.Blacklist11()!="")) + || (text.contains(m_config.Blacklist12()) && (m_config.Blacklist12()!="")) + )) { + if (!ui->cbBypass->isChecked()) filtered = true; + if (!(m_config.filters_for_Wait_and_Pounce_only() or ui->cbBypass->isChecked())) return; + // reset dB score when filtered + if (pounce && (ui->respondComboBox->currentText()=="CQ: Max Dist" + or ui->respondComboBox->currentText()=="CQ: Max dB" + or ui->respondComboBox->currentText()=="CQ: Min dB")) { + Dpoints=0; + maxDPoints=0; + dBpoints=-28; + dBpoints2=99; + maxdBPoints=-28; + mindBPoints=99; + } + + // Filtering out everything but messages with keywords from Whitelist + } else if ((SpecOp::NONE==m_specOp or SpecOp::HOUND==m_specOp) && m_config.Whitelisted () + && !(text.contains(m_config.Whitelist1()) && (m_config.Whitelist1()!="")) + && !(text.contains(m_config.Whitelist2()) && (m_config.Whitelist2()!="")) + && !(text.contains(m_config.Whitelist3()) && (m_config.Whitelist3()!="")) + && !(text.contains(m_config.Whitelist4()) && (m_config.Whitelist4()!="")) + && !(text.contains(m_config.Whitelist5()) && (m_config.Whitelist5()!="")) + && !(text.contains(m_config.Whitelist6()) && (m_config.Whitelist6()!="")) + && !(text.contains(m_config.Whitelist7()) && (m_config.Whitelist7()!="")) + && !(text.contains(m_config.Whitelist8()) && (m_config.Whitelist8()!="")) + && !(text.contains(m_config.Whitelist9()) && (m_config.Whitelist9()!="")) + && !(text.contains(m_config.Whitelist10()) && (m_config.Whitelist10()!="")) + && !(text.contains(m_config.Whitelist11()) && (m_config.Whitelist11()!="")) + && !(text.contains(m_config.Whitelist12()) && (m_config.Whitelist12()!="")) + ) { + if (!ui->cbBypass->isChecked()) filtered = true; + if (!(m_config.filters_for_Wait_and_Pounce_only() or ui->cbBypass->isChecked())) return; + // reset dB score when filtered + if (pounce && (ui->respondComboBox->currentText()=="CQ: Max Dist" + or ui->respondComboBox->currentText()=="CQ: Max dB" + or ui->respondComboBox->currentText()=="CQ: Min dB")) { + Dpoints=0; + maxDPoints=0; + dBpoints=-28; + dBpoints2=99; + maxdBPoints=-28; + mindBPoints=99; + } + } + + // search logbook for filtering + if (ui->actionHideTerritory1->isChecked() or ui->actionHideTerritory2->isChecked() or + ui->actionHideTerritory3->isChecked() or ui->actionHideTerritory4->isChecked() or + ui->actionHideB4->isChecked() or ui->actionHideEU->isChecked() or ui->actionHideAS->isChecked() or + ui->actionHideNA->isChecked() or ui->actionHideSA->isChecked() or ui->actionHideAF->isChecked() or + ui->actionHideOC->isChecked() or ui->actionHideAN->isChecked()) { + QString deCall; + QString deGrid; + decodedtext.deCallAndGrid(/*out*/deCall,deGrid); + // search for country names + if (ui->actionHideTerritory1->isChecked() or ui->actionHideTerritory2->isChecked() or + ui->actionHideTerritory3->isChecked() or ui->actionHideTerritory4->isChecked()) { + auto const& looked_up = m_logBook.countries ()->lookup (deCall); + auto countryName = looked_up.entity_name; + // do some obvious abbreviations + countryName.replace ("Islands", "Is."); + countryName.replace ("Island", "Is."); + countryName.replace ("North ", "N. "); + countryName.replace ("Northern ", "N. "); + countryName.replace ("South ", "S. "); + countryName.replace ("East ", "E. "); + countryName.replace ("Eastern ", "E. "); + countryName.replace ("West ", "W. "); + countryName.replace ("Western ", "W. "); + countryName.replace ("Central ", "C. "); + countryName.replace (" and ", " & "); + countryName.replace ("Republic", "Rep."); + countryName.replace ("United States of America", "U.S.A."); + countryName.replace ("United States", "U.S.A."); + countryName.replace ("Fed. Rep. of ", ""); + countryName.replace ("French ", "Fr."); + countryName.replace ("Asiatic", "AS"); + countryName.replace ("European", "EU"); + countryName.replace ("African", "AF"); + if (ui->actionHideTerritory1->isChecked() && countryName.contains(m_config.Territory1()) + && (m_config.Territory1()!="") && !ui->cbBypass->isChecked()) filtered = true; + if (ui->actionHideTerritory2->isChecked() && countryName.contains(m_config.Territory2()) + && (m_config.Territory2()!="") && !ui->cbBypass->isChecked()) filtered = true; + if (ui->actionHideTerritory3->isChecked() && countryName.contains(m_config.Territory3()) + && (m_config.Territory3()!="") && !ui->cbBypass->isChecked()) filtered = true; + if (ui->actionHideTerritory4->isChecked() && countryName.contains(m_config.Territory4()) + && (m_config.Territory4()!="") && !ui->cbBypass->isChecked()) filtered = true; + } + // search for callsigns worked B4 on band + if (ui->actionHideB4->isChecked()) { + bool callB4onBand; + bool countryB4onBand; + bool gridB4onBand; + bool continentB4onBand; + bool CQZoneB4onBand; + bool ITUZoneB4onBand; + auto const& looked_up = m_logBook.countries ()->lookup (deCall); + m_logBook.match (deCall, m_mode, deGrid, looked_up, callB4onBand, countryB4onBand, gridB4onBand, + continentB4onBand, CQZoneB4onBand, ITUZoneB4onBand, m_currentBand); + if (callB4onBand && ui->actionHideB4->isChecked() && !ui->cbBypass->isChecked()) filtered = true; + } + // search for continents + if (ui->actionHideEU->isChecked() or ui->actionHideAS->isChecked() or ui->actionHideNA->isChecked() + or ui->actionHideSA->isChecked() or ui->actionHideAF->isChecked() or ui->actionHideOC->isChecked() + or ui->actionHideAN->isChecked()) { + auto const& looked_up = m_logBook.countries ()->lookup (deCall); + QString continent = AD1CCty::continent (looked_up.continent); + if (ui->actionHideEU->isChecked() && continent == "EU" && !ui->cbBypass->isChecked()) filtered = true; + if (ui->actionHideAS->isChecked() && continent == "AS" && !ui->cbBypass->isChecked()) filtered = true; + if (ui->actionHideNA->isChecked() && continent == "NA" && !ui->cbBypass->isChecked()) filtered = true; + if (ui->actionHideSA->isChecked() && continent == "SA" && !ui->cbBypass->isChecked()) filtered = true; + if (ui->actionHideAF->isChecked() && continent == "AF" && !ui->cbBypass->isChecked()) filtered = true; + if (ui->actionHideOC->isChecked() && continent == "OC" && !ui->cbBypass->isChecked()) filtered = true; + if (ui->actionHideAN->isChecked() && continent == "AN" && !ui->cbBypass->isChecked()) filtered = true; + } + } + } + } + + // mute audible alerts when callsign is on the Ignored List + if (m_config.alert_Enabled() && !ui->cbBypass->isChecked()) { + QString deCall; + QString deGrid; + decodedtext.deCallAndGrid(deCall,deGrid); + if (deCall!="" && ignoreList.contains(deCall + ",")) m_muted = true; + } + + // hide or ignore callsigns + if (ui->actionHideIgnored->isChecked() or ui->actionHideToday->isChecked() or ui->actionIgnoreIgnored->isChecked() or ui->actionIgnoreToday->isChecked()) { + QString today = QDateTime::currentDateTimeUtc().toString ("yyyy-MM-dd"); + QString yesterday = QDateTime::currentDateTimeUtc().addDays(-1).toString ("yyyy-MM-dd"); + QString deCall; + QString deGrid; + decodedtext.deCallAndGrid(/*out*/deCall,deGrid); + if (ui->actionHideIgnored->isChecked() && !ui->cbBypass->isChecked() && ignoreList.contains(deCall + ",")) filtered = true; + if (ui->actionHideToday->isChecked() && !ui->cbBypass->isChecked() && ( + txLog.contains(QRegularExpression{today + ",[0-9][0-9]:[0-9][0-9]:[0-9][0-9]," + (deCall + ",")}) + or (m_config.twoDays() && txLog.contains(QRegularExpression{yesterday + ",[0-9][0-9]:[0-9][0-9]:[0-9][0-9]," + (deCall + ",")})))) { + filtered = true; + } + if (ui->actionIgnoreIgnored->isChecked() && ignoreList.contains(deCall + ",")) { + ignored = true; + m_muted = true; + } + if (ui->actionIgnoreToday->isChecked() && (txLog.contains(QRegularExpression{today + ",[0-9][0-9]:[0-9][0-9]:[0-9][0-9]," + (deCall + ",")}) + or (m_config.twoDays() && txLog.contains(QRegularExpression{yesterday + ",[0-9][0-9]:[0-9][0-9]:[0-9][0-9]," + (deCall + ",")})))) { + ignored = true; + m_muted = true; + } + } + if (ui->actionIgnoreB4->isChecked() && (pounce or m_auto)) { + QString deCall; + QString deGrid; + decodedtext.deCallAndGrid(/*out*/deCall,deGrid); + bool callB4onBand; + bool countryB4onBand; + bool gridB4onBand; + bool continentB4onBand; + bool CQZoneB4onBand; + bool ITUZoneB4onBand; + auto const& looked_up = m_logBook.countries ()->lookup (deCall); + m_logBook.match (deCall, m_mode, deGrid, looked_up, callB4onBand, countryB4onBand, gridB4onBand, + continentB4onBand, CQZoneB4onBand, ITUZoneB4onBand, m_currentBand); + if (callB4onBand && ui->actionIgnoreB4->isChecked() && !ui->cbBypass->isChecked()) { + ignored = true; + m_muted = true; + } + } + + // insert blank line, but only if not filtered and no decodes + int ntime=6; + if (m_TRperiod>=60) ntime=4; + if ((m_config.insert_blank () or m_config.alert_Enabled()) && (line_read.left(ntime) != m_tBlankLine) && message0.left(4).contains(QRegularExpression {"\\d\\d\\d\\d"}) && !m_diskData) { + ui->decodedTextBrowser->new_period (); + if (m_specOp == SpecOp::FOX and m_ActiveStationsWidget != NULL && m_config.insert_blank ()) { // clear the ActiveStations window + m_ActiveStationsWidget->clearStations(); + m_ActiveStationsWidget->displayRecentStations("Fox Mode", ""); + } + if (SpecOp::FOX != m_specOp && (!filtered or m_config.filters_for_Wait_and_Pounce_only()) && m_config.insert_blank ()) { + QString band; + if(((QDateTime::currentMSecsSinceEpoch() / 1000 - m_secBandChanged) > 4*int(m_TRperiod)/4) or m_displayBand) { + band = ' ' + m_config.bands ()->find (m_freqNominal); + } + if (m_config.insert_blank ()) { + if (ui->actionUse_Dark_Style->isChecked()) { + if (m_config.detailed_blank()) { + if (m_config.DXCC()) { + ui->decodedTextBrowser->insertText(("------ " + m_dateTimeSeqStart.toString("yyyy-MM-dd - hh:mm:ss' UTC - '") + m_currentBandPeriod + " - " + m_mode + " ------"), "#a2a2a2", "#000000"); + } else { + ui->decodedTextBrowser->insertText(("------ " + m_dateTimeSeqStart.toString("yyyy-MM-dd - hh:mm:ss' UTC - '") + m_currentBandPeriod + " - " + m_mode), "#a2a2a2", "#000000"); + } + } else { + ui->decodedTextBrowser->insertText(band.rightJustified(40, '-'), "#a2a2a2", "#000000"); + } + } else { + if (m_config.detailed_blank()) { + if (m_config.DXCC()) { + ui->decodedTextBrowser->insertLineSpacer ("------ " + m_dateTimeSeqStart.toString("yyyy-MM-dd - hh:mm:ss' UTC - '") + m_currentBandPeriod + " - " + m_mode + " ------"); + } else { + ui->decodedTextBrowser->insertLineSpacer ("------ " + m_dateTimeSeqStart.toString("yyyy-MM-dd - hh:mm:ss' UTC - '") + m_currentBandPeriod + " - " + m_mode); + } + } else { + ui->decodedTextBrowser->insertLineSpacer (band.rightJustified (40, '-')); + } + } + } + m_tBlankLine = line_read.left(ntime); + } + } + + // SuperHound label + if (ui->labDXped->text().contains("Hound") && decodedtext0.mid(3,18).contains(" verified")) { + verified = true; + write_all("Vf",decodedtext0.string()); + ui->labDXped->setStyleSheet("QLabel {background-color: #00ff00; color: black;}"); + } else { +#ifndef FOX_OTP + if (m_specOp==SpecOp::HOUND && m_config.superFox() && (decodedtext0.mid(4,2).contains("00") or decodedtext0.mid(4,2).contains("30"))) verified = false; +#endif + } + if ((!verified && ui->labDXped->isVisible()) or !ui->labDXped->text().contains("Hound")) + ui->labDXped->setStyleSheet("QLabel {background-color: red; color: white;}"); + + // show distance and bearing + if (!filtered or m_config.filters_for_Wait_and_Pounce_only()) { // show decodes if not filtered + QString distance; + QString deCall; + QString deGrid; + decodedtext.deCallAndGrid(deCall,deGrid); + if ((m_config.showDistance() || m_config.showAzimuth()) && deGrid.contains(grid_regexp)) { + double utch=0.0; + int nAz,nEl,nDmiles,nDkm,nHotAz,nHotABetter; + QString my_Grid = m_config.my_grid(); + if (my_Grid.length() < 5) my_Grid = m_config.my_grid().left(4)+"mm"; + QString de_Grid= deGrid.left(4)+"mm"; + azdist_(const_cast <char *> (my_Grid.toLatin1().constData()), + const_cast <char *> (de_Grid.toLatin1().constData()),&utch, + &nAz,&nEl,&nDmiles,&nDkm,&nHotAz,&nHotABetter,(FCL)6,(FCL)6); + if (m_config.showDistance()) { + int nd=nDkm; + if(m_config.miles()) nd=nDmiles; + distance = QString::number(nd); + if(m_config.miles()) distance += " mi"; + if(!m_config.miles()) distance += " km"; + } + if (m_config.showAzimuth()) { + if (distance.length()) distance += " / "; + distance += QString::number(nAz) + "°"; + } + } + + // display country names for JT65 and JT9 like for FT8 + if ((m_mode == "JT65" or m_mode == "JT9" or m_mode == "JT4") && m_config.DXCC()) { + DecodedText decodedtextJT {((QString::fromUtf8(line_read.left(44).constData())) + (QString::fromUtf8(line_read.mid(62, 2).constData())))}; + ui->decodedTextBrowser->displayDecodedText (decodedtextJT, m_config.my_callsign (), m_mode, m_config.DXCC (), + m_logBook, m_currentBandPeriod, m_config.ppfx (), + ui->cbCQonly->isVisible() && ui->cbCQonly->isChecked(), + haveFSpread, fSpread, bDisplayPoints, m_points, distance, m_muted); + } else { + if (ui->actionHide_AP_info->isVisible() && ui->actionHide_AP_info->isChecked()) { + // Hide FT8 AP information + DecodedText decodedtext2 {(QString::fromUtf8(line_read.replace("a1","").replace("a2","").replace("a3","").replace("a4","") + .replace("a5","").replace("a6","").replace("a7","").replace("a8","").replace("a9","").replace("?","")))}; + ui->decodedTextBrowser->displayDecodedText (decodedtext2, m_config.my_callsign (), m_mode, m_config.DXCC (), + m_logBook, m_currentBandPeriod, m_config.ppfx (), + ui->cbCQonly->isVisible() && ui->cbCQonly->isChecked(), + haveFSpread, fSpread, bDisplayPoints, m_points, distance, m_muted); + } else { + ui->decodedTextBrowser->displayDecodedText (decodedtext1, m_config.my_callsign (), m_mode, m_config.DXCC (), + m_logBook, m_currentBandPeriod, m_config.ppfx (), + ui->cbCQonly->isVisible() && ui->cbCQonly->isChecked(), + haveFSpread, fSpread, bDisplayPoints, m_points, distance, m_muted); + } + } + if(m_position != 0) ui->decodedTextBrowser->horizontalScrollBar()->setValue(m_position); + } + if (m_mode=="FT8" && ((m_multithreadFT8 && m_ft8DecoderStart<2) or m_freqNominal>45000000)) earlyDecodes.append(line_read); //ft8md + + // highlight callsigns worked B4 on band or worked today + if(ui->actionHighlightB4->isChecked() or ui->actionHighlightToday->isChecked() or ui->actionHighlightIgnored->isChecked() + or ui->actionHighlightTerritory1->isChecked() or ui->actionHighlightTerritory2->isChecked() + or ui->actionHighlightTerritory3->isChecked() or ui->actionHighlightTerritory4->isChecked()) { + QString today = QDateTime::currentDateTimeUtc().toString ("yyyy-MM-dd"); + QString yesterday = QDateTime::currentDateTimeUtc().addDays(-1).toString ("yyyy-MM-dd"); + QString deCall; + QString deGrid; + decodedtext.deCallAndGrid(/*out*/deCall,deGrid); + bool callB4onBand; + bool countryB4onBand; + bool gridB4onBand; + bool continentB4onBand; + bool CQZoneB4onBand; + bool ITUZoneB4onBand; + if (ui->actionHighlightB4->isChecked()) { + auto const& looked_up = m_logBook.countries ()->lookup (deCall); + m_logBook.match (deCall, m_mode, deGrid, looked_up, callB4onBand, countryB4onBand, gridB4onBand, + continentB4onBand, CQZoneB4onBand, ITUZoneB4onBand, m_currentBand); + if (callB4onBand) ui->decodedTextBrowser->highlight_callsign(deCall, QColor(195,195,195), QColor(0,0,0), true); + } + if (ui->actionHighlightToday->isChecked() && ( + txLog.contains(QRegularExpression{today + ",[0-9][0-9]:[0-9][0-9]:[0-9][0-9]," + (deCall + ",")}) + or (m_config.twoDays() && txLog.contains(QRegularExpression{yesterday + ",[0-9][0-9]:[0-9][0-9]:[0-9][0-9]," + (deCall + ",")})))) { + ui->decodedTextBrowser->highlight_callsign(deCall, QColor(100,100,100), QColor(255,255,0), true); + } + if (ui->actionHighlightIgnored->isChecked() && ignoreList.contains(deCall + ",")) { + ui->decodedTextBrowser->highlight_callsign(deCall, QColor(85,0,0), QColor(255,255,0), true); + } + // search for country names + if (ui->actionHighlightTerritory1->isChecked() or ui->actionHighlightTerritory2->isChecked() or + ui->actionHighlightTerritory3->isChecked() or ui->actionHighlightTerritory4->isChecked()) { + auto const& looked_up = m_logBook.countries ()->lookup (deCall); + auto countryName = looked_up.entity_name; + // do some obvious abbreviations + countryName.replace ("Islands", "Is."); + countryName.replace ("Island", "Is."); + countryName.replace ("North ", "N. "); + countryName.replace ("Northern ", "N. "); + countryName.replace ("South ", "S. "); + countryName.replace ("East ", "E. "); + countryName.replace ("Eastern ", "E. "); + countryName.replace ("West ", "W. "); + countryName.replace ("Western ", "W. "); + countryName.replace ("Central ", "C. "); + countryName.replace (" and ", " & "); + countryName.replace ("Republic", "Rep."); + countryName.replace ("United States of America", "U.S.A."); + countryName.replace ("United States", "U.S.A."); + countryName.replace ("Fed. Rep. of ", ""); + countryName.replace ("French ", "Fr."); + countryName.replace ("Asiatic", "AS"); + countryName.replace ("European", "EU"); + countryName.replace ("African", "AF"); + if (ui->actionHighlightTerritory1->isChecked() && countryName.contains(m_config.Territory1()) + && (m_config.Territory1()!="") && !ui->cbBypass->isChecked()) ui->decodedTextBrowser->highlight_callsign(deCall, QColor(115,43,245), QColor(255,255,255), true); + if (ui->actionHighlightTerritory2->isChecked() && countryName.contains(m_config.Territory2()) + && (m_config.Territory2()!="") && !ui->cbBypass->isChecked()) ui->decodedTextBrowser->highlight_callsign(deCall, QColor(115,43,245), QColor(255,255,255), true); + if (ui->actionHighlightTerritory3->isChecked() && countryName.contains(m_config.Territory3()) + && (m_config.Territory3()!="") && !ui->cbBypass->isChecked()) ui->decodedTextBrowser->highlight_callsign(deCall, QColor(115,43,245), QColor(255,255,255), true); + if (ui->actionHighlightTerritory4->isChecked() && countryName.contains(m_config.Territory4()) + && (m_config.Territory4()!="") && !ui->cbBypass->isChecked()) ui->decodedTextBrowser->highlight_callsign(deCall, QColor(115,43,245), QColor(255,255,255), true); + } + } + + if((m_mode=="FT4" or m_mode=="FT8") and bDisplayPoints and decodedtext1.isStandardMessage()) { + QString deCall,deGrid; + decodedtext.deCallAndGrid(/*out*/deCall,deGrid); + bool bWorkedOnBand=(ui->decodedTextBrowser->CQPriority()!="New Call on Band") and ui->decodedTextBrowser->CQPriority()!=""; + if(bWorkedOnBand) activeWorked(deCall,m_currentBand); + } + + // CQ: First + if(((pounce && text.contains(" CQ ") && m_config.Wait_features_enabled()) + or (m_auto && m_bCallingCQ && text.contains(" " + m_config.my_callsign() + " "))) && !ignored + && !filtered && !selected && ui->respondComboBox->isVisible() && ui->respondComboBox->currentText()=="CQ: First" + && (!(ui->actionFull_Duplex_Mode->isChecked() && m_txing))) { + m_bDoubleClicked=true; + selected = true; + auto_tx_mode(true); + processMessage(decodedtext0); + auto now = QDateTime::currentDateTimeUtc(); + m_dateTimeQSOOn = now.addSecs (-(m_ntx - 1) * int(m_TRperiod) - int(fmod(double(now.time().second()),m_TRperiod))); + QTimer::singleShot (6000, [=] {selected = false;}); + if (pounce) stopWCTimer.start(int(6200.0*m_TRperiod)); // Tx max 6*TRperiod + } + + // CQ: Max Dist + if((pounce or m_auto) && ui->respondComboBox->isVisible() && ui->respondComboBox->currentText()=="CQ: Max Dist" + && (!(ui->actionFull_Duplex_Mode->isChecked() && m_txing))) { + QString deCall; + QString deGrid; + decodedtext.deCallAndGrid(/*out*/deCall,deGrid); + if (!filtered && !ignored && (deGrid.contains(grid_regexp) or m_bCallingCQ) && ( + (pounce && text.contains(" CQ ") && !txLog.contains(deCall) && m_config.Wait_features_enabled()) or + (m_bCallingCQ && text.contains(" " + m_config.my_callsign() + " ") && !text.contains("73 ")) + )) { + double utch=0.0; + int nAz,nEl,nDmiles,nDkm,nHotAz,nHotABetter; + azdist_(const_cast <char *> ((m_config.my_grid () + " ").left (6).toLatin1().constData()), + const_cast <char *> ((deGrid + " ").left (6).toLatin1().constData()),&utch, + &nAz,&nEl,&nDmiles,&nDkm,&nHotAz,&nHotABetter,6,6); + Dpoints=nDkm; + if (!deGrid.contains(grid_regexp)) Dpoints=1; + if(Dpoints>maxDPoints) { + maxDPoints=Dpoints; + m_deCall=deCall; + m_bDoubleClicked=true; + if ((pounce && text.contains(" CQ ") && m_config.Wait_features_enabled()) or m_auto) { + auto_tx_mode(true); + processMessage(decodedtext0); + if (pounce) stopWCTimer.start(int(6200.0*m_TRperiod)); // Tx max 6*TRperiod + } + ui->dxCallEntry->setText(deCall); + genStdMsgs(QString::number(decodedtext.snr())); + ui->RxFreqSpinBox->setValue(decodedtext.frequencyOffset()); + setTxMsg(m_ntx); + m_currentMessageType=m_ntx; + auto now = QDateTime::currentDateTimeUtc(); + m_dateTimeQSOOn = now.addSecs (-(m_ntx - 1) * int(m_TRperiod) - int(fmod(double(now.time().second()),m_TRperiod))); + } + } + } + + // CQ: Max dB + if((pounce or m_auto) && ui->respondComboBox->isVisible() && ui->respondComboBox->currentText()=="CQ: Max dB" + && (!(ui->actionFull_Duplex_Mode->isChecked() && m_txing))) { + QString deCall; + QString deGrid; + decodedtext.deCallAndGrid(/*out*/deCall,deGrid); + if (!filtered && !ignored && ( + (pounce && text.contains(" CQ ") && !txLog.contains(deCall) && m_config.Wait_features_enabled()) or + (m_bCallingCQ && text.contains(" " + m_config.my_callsign() + " ") && !text.contains("73 ")) + )) { + dBpoints=decodedtext.string().mid(7,3).toInt(); + if(dBpoints>maxdBPoints) { + maxdBPoints=dBpoints; + m_deCall=deCall; + m_bDoubleClicked=true; + if ((pounce && text.contains(" CQ ") && m_config.Wait_features_enabled()) or m_auto) { + auto_tx_mode(true); + processMessage(decodedtext0); + if (pounce) stopWCTimer.start(int(6200.0*m_TRperiod)); // Tx max 6*TRperiod + } + ui->dxCallEntry->setText(deCall); + genStdMsgs(QString::number(decodedtext.snr())); + ui->RxFreqSpinBox->setValue(decodedtext.frequencyOffset()); + setTxMsg(m_ntx); + m_currentMessageType=m_ntx; + auto now = QDateTime::currentDateTimeUtc(); + m_dateTimeQSOOn = now.addSecs (-(m_ntx - 1) * int(m_TRperiod) - int(fmod(double(now.time().second()),m_TRperiod))); + QTimer::singleShot (6000, [=] {selected = false;}); + } + } + } + + // CQ: Min dB + if((pounce or m_auto) && ui->respondComboBox->isVisible() && ui->respondComboBox->currentText()=="CQ: Min dB" + && (!(ui->actionFull_Duplex_Mode->isChecked() && m_txing))) { + QString deCall; + QString deGrid; + decodedtext.deCallAndGrid(/*out*/deCall,deGrid); + if (!filtered && !ignored && ( + (pounce && text.contains(" CQ ") && !txLog.contains(deCall) && m_config.Wait_features_enabled()) or + (m_bCallingCQ && text.contains(" " + m_config.my_callsign() + " ") && !text.contains("73 ")) + )) { + dBpoints2=decodedtext.string().mid(7,3).toInt(); + if(dBpoints2<mindBPoints) { + mindBPoints=dBpoints2; + m_deCall=deCall; + m_bDoubleClicked=true; + if ((pounce && text.contains(" CQ ") && m_config.Wait_features_enabled()) or m_auto) { + auto_tx_mode(true); + processMessage(decodedtext0); + if (pounce) stopWCTimer.start(int(6200.0*m_TRperiod)); // Tx max 6*TRperiod + } + ui->dxCallEntry->setText(deCall); + genStdMsgs(QString::number(decodedtext.snr())); + ui->RxFreqSpinBox->setValue(decodedtext.frequencyOffset()); + setTxMsg(m_ntx); + m_currentMessageType=m_ntx; + auto now = QDateTime::currentDateTimeUtc(); + m_dateTimeQSOOn = now.addSecs (-(m_ntx - 1) * int(m_TRperiod) - int(fmod(double(now.time().second()),m_TRperiod))); + QTimer::singleShot (6000, [=] {selected = false;}); + } + } + } + + // Ensure that Tx stops and QSO is logged when repeat_Tx is enabled and "73" is received + if(m_config.repeat_Tx() && m_mode=="Q65" && m_hisCall!="" && text.contains(m_baseCall) && text.contains(m_hisCall + " 73 ")) { + if((m_config.prompt_to_log() or m_config.autoLog()) && !m_tune && CALLING != m_QSOProgress) logQSOTimer.start(0); + cease_auto_Tx_after_QSO(); + } + + // highlight orange and blue callsigns + if (m_config.highlight_orange() or (m_config.highlight_blue()) or ui->actionHighlight_Whitelist_entries->isChecked()) { + QString deCall; + QString deGrid; + decodedtext.deCallAndGrid(/*out*/deCall,deGrid); + if (m_config.highlight_orange() && deCall.size()>2 && (m_config.highlight_orange_callsigns().contains(deCall + ",") + or m_config.highlight_orange_callsigns().contains(deCall.left(3) + ";") or m_config.highlight_orange_callsigns().contains(deCall.left(2) + ";"))) { + ui->decodedTextBrowser->highlight_callsign(deCall, QColor(225,75,0), QColor(255,255,255), true); + if (m_config.alert_Enabled() && m_config.alert_Wanted() && !m_muted) play_Wanted = true; + } + if (m_config.highlight_orange() && deGrid.size()>3 && m_config.highlight_orange_callsigns().contains(deGrid)) { + ui->decodedTextBrowser->highlight_callsign(deGrid, QColor(225,75,0), QColor(255,255,255), true); + if (m_config.alert_Enabled() && m_config.alert_Wanted() && !m_muted) play_Wanted = true; + } + if (m_config.highlight_blue() && deCall.size()>2 && (m_config.highlight_blue_callsigns().contains(deCall + ",") + or m_config.highlight_blue_callsigns().contains(deCall.left(3) + ";") or m_config.highlight_blue_callsigns().contains(deCall.left(2) + ";"))) { + ui->decodedTextBrowser->highlight_callsign(deCall, QColor(0,100,255), QColor(255,255,255), true); + if (m_config.alert_Enabled() && m_config.alert_Wanted() && !m_muted) play_Wanted = true; + } + if (m_config.highlight_blue() && deGrid.size()>3 && m_config.highlight_blue_callsigns().contains(deGrid)) { + ui->decodedTextBrowser->highlight_callsign(deGrid, QColor(0,100,255), QColor(255,255,255), true); + if (m_config.alert_Enabled() && m_config.alert_Wanted() && !m_muted) play_Wanted = true; + } + // highlight directional calls + if (tw.size () > 2) { + if (m_config.highlight_orange() && tw[0]=="CQ" && m_config.highlight_orange_callsigns().contains("," + tw[1] + ",")) { + ui->decodedTextBrowser->highlight_callsign(tw[1], QColor(225,75,0), QColor(255,255,255), true); + if (m_config.alert_Enabled() && m_config.alert_Wanted() && !m_muted && tw[1]!="") play_Wanted = true; + } + if (m_config.highlight_blue() && tw[0]=="CQ" && m_config.highlight_blue_callsigns().contains("," + tw[1] + ",")) { + ui->decodedTextBrowser->highlight_callsign(tw[1], QColor(0,100,255), QColor(255,255,255), true); + if (m_config.alert_Enabled() && m_config.alert_Wanted() && !m_muted && tw[1]!="") play_Wanted = true; + } + } + // highlight Whitelist entries + if (ui->actionHighlight_Whitelist_entries->isChecked() && deCall.size()>2 && + ((deCall.contains(m_config.Whitelist1()) && m_config.Whitelist1() != "") + or (deCall.contains(m_config.Whitelist2()) && m_config.Whitelist2() != "") + or (deCall.contains(m_config.Whitelist3()) && m_config.Whitelist3() != "") + or (deCall.contains(m_config.Whitelist4()) && m_config.Whitelist4() != "") + or (deCall.contains(m_config.Whitelist5()) && m_config.Whitelist5() != "") + or (deCall.contains(m_config.Whitelist6()) && m_config.Whitelist6() != "") + or (deCall.contains(m_config.Whitelist7()) && m_config.Whitelist7() != "") + or (deCall.contains(m_config.Whitelist8()) && m_config.Whitelist8() != "") + or (deCall.contains(m_config.Whitelist9()) && m_config.Whitelist9() != "") + or (deCall.contains(m_config.Whitelist10()) && m_config.Whitelist10() != "") + or (deCall.contains(m_config.Whitelist11()) && m_config.Whitelist11() != "") + or (deCall.contains(m_config.Whitelist12()) && m_config.Whitelist12() != ""))) { + ui->decodedTextBrowser->highlight_callsign(deCall, QColor(170,0,127), QColor(255,255,255), true); + if (m_config.alert_Enabled() && m_config.alert_Wanted() && !m_muted) play_Wanted = true; + } + } + + // Highlight DX Call/Grid + if (!pounce && (m_config.highlight_DXcall() or m_config.alert_Enabled()) && (m_hisCall != "") && + ((decodedtext.string().contains(QRegularExpression{"(\\w+) " + m_hisCall})) + || (decodedtext.string().contains(QRegularExpression{"(\\w+) <" + m_hisCall + ">"})) + || (decodedtext.string().contains(QRegularExpression{"<(\\w+)> " + m_hisCall})) + || (decodedtext.string().contains(QRegularExpression{"<...> " + m_hisCall})))) { + if (m_config.alert_Enabled() && m_config.alert_DXcall() && !m_muted) play_DXcall = true; + if (m_config.highlight_DXcall()) { + // repeated highlighting to override JTAlert + ui->decodedTextBrowser->highlight_callsign(m_hisCall, QColor(255,0,0), QColor(255,255,255), true); + QTimer::singleShot (500, [=] {ui->decodedTextBrowser->highlight_callsign(m_hisCall, QColor(255,0,0), QColor(255,255,255), true);}); + QTimer::singleShot (1000, [=] {ui->decodedTextBrowser->highlight_callsign(m_hisCall, QColor(255,0,0), QColor(255,255,255), true);}); + QTimer::singleShot (2500, [=] {ui->decodedTextBrowser->highlight_callsign(m_hisCall, QColor(255,0,0), QColor(255,255,255), true);}); + } + } + if (!pounce && (m_config.highlight_DXgrid () or m_config.alert_Enabled()) && (m_hisGrid!="") && + (decodedtext.string().contains(m_hisGrid.left(4)))) { + if (m_config.highlight_DXgrid()) ui->decodedTextBrowser->highlight_callsign(m_hisGrid.left(4), QColor(0,0,200), QColor(255,255,255), true); + if (m_config.alert_Enabled() && m_config.alert_DXcall() && !m_muted) play_DXcall = true; + } + QTimer::singleShot (100, [=] { + if (m_config.alert_Enabled() && ((m_config.alert_DXcall() && play_DXcall && m_hisCall!="") or (m_config.alert_Wanted() && play_Wanted))) { +#ifdef WIN32 + QAudioOutput info(QAudioDeviceInfo::defaultOutputDevice()); + QString audioPath = QCoreApplication::applicationDirPath() + "/sounds" + m_config.voicesPath() + "/"; + QAudioFormat format; + format.setCodec("audio/pcm"); + format.setSampleRate (48000); + format.setChannelCount (1); + format.setSampleSize (16); + format.setSampleType(QAudioFormat::SignedInt); + QAudioOutput* audio; + audio = new QAudioOutput(format, this); + connect(audio, SIGNAL(stateChanged(QAudio::State)), this, SLOT(handleStateChanged(QAudio::State))); + QFile *effect1 = new QFile(this); + if (m_config.alert_DXcall() && play_DXcall) effect1->setFileName(QString("%1/%2").arg(audioPath, "DXcall.wav")); + else if (m_config.alert_Wanted() && play_Wanted) effect1->setFileName(QString("%1/%2").arg(audioPath, "Wanted.wav")); + effect1->open(QIODevice::ReadOnly); + audio->start(effect1); +#else + QString audioPath = QCoreApplication::applicationDirPath() + "/sounds" + m_config.voicesPath() + "/"; + if (m_config.alert_DXcall() && play_DXcall) QSound::play(audioPath + "DXcall.wav"); // for Linux and macOS + else if (m_config.alert_DXcall() && play_Wanted) QSound::play(audioPath + "Wanted.wav"); // for Linux and macOS +#endif + play_DXcall = false; + play_Wanted = false; + } + }); + + if (m_bBestSPArmed && m_mode=="FT4" && CALLING == m_QSOProgress && !ignored && !filtered) { + QString messagePriority=ui->decodedTextBrowser->CQPriority(); + if (messagePriority!="") { + if (messagePriority=="New Call on Band" + and m_BestCQpriority!="New Call on Band" + and m_BestCQpriority!="New Multiplier" + and (!(ui->actionFull_Duplex_Mode->isChecked() && m_txing))) { + m_BestCQpriority="New Call on Band"; + m_bDoubleClicked = true; + processMessage(decodedtext0); + } + if (messagePriority=="New DXCC" + and m_BestCQpriority!="New DXCC" + and m_BestCQpriority!="New Multiplier" + and (!(ui->actionFull_Duplex_Mode->isChecked() && m_txing))) { + m_BestCQpriority="New DXCC"; + m_bDoubleClicked = true; + processMessage(decodedtext0); + } + } + } + } + } + +//Right (Rx Frequency) window + bool bDisplayRight=bAvgMsg; + int audioFreq=decodedtext.frequencyOffset(); + if(m_mode=="FT8" or m_mode=="FT4" or m_mode=="FST4" or m_mode=="Q65") { + int ftol=10; + if(m_mode=="Q65") ftol=ui->sbFtol->value(); + auto const& parts = decodedtext.string().remove("<").remove(">") + .split (' ', SkipEmptyParts); + if (parts.size() > 6) { + auto for_us = parts[5].contains (m_baseCall) + || ("DE" == parts[5] && qAbs (ui->RxFreqSpinBox->value () - audioFreq) <= ftol); + if(m_baseCall == m_config.my_callsign()) { + if (m_baseCall != parts[5]) for_us=false; + } else { + if (m_config.my_callsign () != parts[5]) { +// Same base call as ours but different prefix or suffix. Rare but can happen with +// multi-station special events. + for_us = false; + } + } + + // Reply also to averaged messages that are only displayed in the right window + if(m_bCallingCQ && !m_bAutoReply && for_us && m_specOp!=SpecOp::FOX && m_specOp!=SpecOp::HOUND + && ui->actionInclude_averaging->isVisible() && ui->actionInclude_averaging->isChecked()) { + bool bProcessMsgNormally=ui->respondComboBox->currentText()!="CQ: None" or + (m_ActiveStationsWidget!=NULL and !m_ActiveStationsWidget->isVisible()); + if (decodedtext.messageWords().length() >= 3) { + QString t=decodedtext.messageWords()[2]; + if(t.contains("R+") or t.contains("R-") or t=="R" or t=="RRR" or t=="RR73") bProcessMsgNormally=true; + } else { + bProcessMsgNormally=true; + } + if(bProcessMsgNormally) { + m_bDoubleClicked=true; + m_bAutoReply = true; + processMessage (decodedtext); + } + } + + if(SpecOp::FOX==m_specOp and decodedtext.string().contains(" DE ")) for_us=true; //Hound with compound callsign + if(SpecOp::FOX==m_specOp and for_us and decodedtext.string().contains(QRegularExpression{" R\\W\\d"})) bDisplayRight=true; + if(SpecOp::FOX!=m_specOp and (for_us or (abs(audioFreq - m_wideGraph->rxFreq()) <= 10))) bDisplayRight=true; + if(SpecOp::HOUND==m_specOp and !for_us) bDisplayRight=false; + + // Give the Fox a warning when there is probably another Fox on the frequency + if(SpecOp::FOX==m_specOp and audioFreq<1000 and !for_us and decodedtext.string().contains(QRegularExpression{" R\\W\\d"})) { + if (first_Fox_alert) { + first_Fox_alert = false; + QTimer::singleShot (120000, [=] {first_Fox_alert = true;}); // Reset after 2 minutes + } else { + if (second_Fox_alert) { + second_Fox_alert = false; + QTimer::singleShot (300000, [=] {second_Fox_alert = true;}); // Reset after 5 minutes + } else { + if (!no_Fox_alert) { + MessageBox::warning_message (this, + "Looks like another fox is working on this frequency.\n\n" + "Stop transmitting, exit Fox mode for a few minutes,\n" + "and check the incoming FT8 messages."); + no_Fox_alert = true; + QTimer::singleShot (3600000, [=] { // No further Fox warnings for 60 minutes + no_Fox_alert = false; + first_Fox_alert = true; + second_Fox_alert = true; + }); + } + } + } + } + + } + } else { + if((abs(audioFreq - m_wideGraph->rxFreq()) <= 10) and + !m_config.enable_VHF_features()) bDisplayRight=true; + } + if(m_mode=="Q65" and !bAvgMsg and !decodedtext.string().contains(m_baseCall)) bDisplayRight=false; + if((m_mode=="JT4" or m_mode=="Q65" or m_mode=="JT65") and decodedtext.string().contains(m_baseCall) && ui->actionInclude_averaging->isVisible() && !ui->actionInclude_averaging->isChecked()) bDisplayRight=true; + if((m_mode=="FT8" or m_mode=="FT4") and SpecOp::FOX!=m_specOp && decodedtext0.string().replace("<","").replace(">","").contains(m_baseCall + " " + m_hisCall)) bDisplayRight=true; // really all messages for us + + // AutoSeq for JT65/JT4 short messages + if ((m_mode=="JT65" or m_mode=="JT4") && m_auto && m_config.enable_VHF_features() && ui->cbShMsgs->isChecked() && ui->cbAutoSeq->isChecked () && (abs(audioFreq - m_wideGraph->rxFreq()) <= 15)) { + if (decodedtext.string().contains(" " + m_config.my_callsign() + " ") && decodedtext.string().contains(" OOO")) { + setTxMsg(3); + } + if (decodedtext.string().contains(" RO")) { + setTxMsg(4); + } + if (decodedtext.string().contains(" RRR")) { + setTxMsg(5); + } + if (decodedtext.string().contains(" 73")) { + setTxMsg(5); + } + } + + if (bDisplayRight && !block_right_display) { + // This msg is within 10 hertz of our tuned frequency, or a JT4 or JT65 avg, or contains MyCall + + if(!pounce && (!m_bBestSPArmed or m_mode!="FT4")) { + // insert blank line when band was changed + if (m_config.insert_blank () && SpecOp::FOX!=m_specOp && m_band_changed && (m_currentBandPeriod == m_currentBand)) { + if (ui->actionUse_Dark_Style->isChecked()) { + ui->decodedTextBrowser2->insertText(("------------------- " + m_currentBandPeriod + " -----------------"), "#a2a2a2", "#000000"); + } else { + ui->decodedTextBrowser2->insertLineSpacer ("------------------- " + m_currentBandPeriod + " -----------------"); + } + m_band_changed = false; + } + if (m_config.alert_Enabled() && ui->actionInclude_averaging->isVisible() && ui->actionInclude_averaging->isChecked()) ui->decodedTextBrowser->new_period (); // ensure alerts are played + ui->decodedTextBrowser2->displayDecodedText (decodedtext0, m_config.my_callsign (), m_mode, m_config.DXCC (), + m_logBook, m_currentBand, m_config.ppfx (), false, false, 0.0, bDisplayPoints, m_points, "", m_muted); + } + m_QSOText = decodedtext.string ().trimmed (); + } + + if (!blockUDP) // block udp spotting for false decodes (JTAlert) + postDecode (true, decodedtext.string ()); + + if(m_mode=="FT8" and SpecOp::HOUND==m_specOp) { + if(decodedtext.string().contains(";")) { + QString text = decodedtext.string().remove("<").remove(">"); // needed for MSHV multistream messages + QStringList w=text.mid(24).split(" ",SkipEmptyParts); + QString foxCall=w.at(3); + if(w.at(0)==m_config.my_callsign() or w.at(0)==Radio::base_callsign(m_config.my_callsign())) { + //### Check for ui->dxCallEntry->text()==foxCall before logging! ### + ui->stopTxButton->click (); + logQSOTimer.start(0); + } + if((w.at(2)==m_config.my_callsign() or w.at(2)==Radio::base_callsign(m_config.my_callsign())) + and ui->tx3->text().length()>0) { + m_rptRcvd=w.at(4); + m_rptSent=decodedtext.string().mid(7,3); + m_nFoxFreq=decodedtext.string().mid(16,4).toInt(); + hound_reply (); + } + } else { + QString text = decodedtext.string().remove("<").remove(">"); // needed for MSHV multistream messages + QStringList w=text.mid(24).split(" ",SkipEmptyParts); + if(decodedtext.string().contains("/")) w.append(" +00"); //Add a dummy report + if(w.size()>=3) { + QString foxCall=w.at(1); + if((w.at(0)==m_config.my_callsign() or w.at(0)==Radio::base_callsign(m_config.my_callsign())) and + ui->tx3->text().length()>0) { + if(w.at(2)=="RR73") { + ui->stopTxButton->click (); + logQSOTimer.start(0); + } else { + if(w.at(1)==Radio::base_callsign(ui->dxCallEntry->text()) and + (w.at(2).mid(0,1)=="+" or w.at(2).mid(0,1)=="-")) { + m_rptRcvd=w.at(2); + m_rptSent=decodedtext.string().mid(7,3); + m_nFoxFreq=decodedtext.string().mid(16,4).toInt(); + hound_reply (); + } else { + if (SpecOp::HOUND==m_specOp && (text.mid(4,2).contains("15") or text.mid(4,2).contains("45"))) return; // ignore stations calling in the wrong time slot + if (text.contains(" " + m_config.my_callsign() + " " + m_hisCall) && !text.contains("73 ")) processMessage(decodedtext0); // needed for MSHV multistream messages + } + } + } + } + } + } + +//### I think this is where we are preventing Hounds from spotting Fox ### + if(m_mode!="FT8" or (SpecOp::HOUND != m_specOp) or (SpecOp::HOUND == m_specOp and m_config.superFox())) { + if(m_mode=="FT8" or m_mode=="FT4" or m_mode=="Q65" + or m_mode=="JT4" or m_mode=="JT65" or m_mode=="JT9" or m_mode=="FST4") { + auto_sequence (decodedtext, 25, 50); + } + +// find and extract any report for myCall, but save in m_rptRcvd only if it's from DXcall + QString rpt; + bool stdMsg = decodedtext.report(m_baseCall, + Radio::base_callsign(ui->dxCallEntry->text()), rpt); + QString deCall; + QString grid; + decodedtext.deCallAndGrid(/*out*/deCall,grid); + { + auto t = Radio::base_callsign (ui->dxCallEntry->text ()); + auto const& dx_call = decodedtext.call (); + if (rpt.size () // report in message + && (m_baseCall == Radio::base_callsign (dx_call) // for us + || "DE" == dx_call) // probably for us + && (t == deCall // DX station base call is QSO partner + || ui->dxCallEntry->text () == deCall // DX station full call is QSO partner + || !t.size ())) // not in QSO + { + m_rptRcvd = rpt; + } + } +// extract details and send to PSKreporter + int nsec=QDateTime::currentMSecsSinceEpoch()/1000-m_secBandChanged; + bool okToPost=(nsec > int(4*m_TRperiod)/5); + if(m_mode=="FST4W" and okToPost) { + line_read=line_read.left(22) + " CQ " + line_read.trimmed().mid(22); + auto p = line_read.lastIndexOf (' '); + DecodedText FST4W_post {QString::fromUtf8 (line_read.left (p).constData ())}; + pskPost(FST4W_post); + } else { + if (stdMsg && okToPost) pskPost(decodedtext); + } + if((m_mode=="JT4" or m_mode=="JT65" or m_mode=="Q65") and + m_msgAvgWidget!=NULL) { + if(m_msgAvgWidget->isVisible()) { + QFile f(m_config.temp_dir ().absoluteFilePath ("avemsg.txt")); + if(f.open(QIODevice::ReadOnly | QIODevice::Text)) { + QTextStream s(&f); + QString t=s.readAll(); + if (t != NULL) m_msgAvgWidget->displayAvg(t); + else qDebug() << "tmp==NULL at s.readAll"; + } + } + } + } + } + } + if (m_mode == "FT8" and m_specOp == SpecOp::FOX and m_ActiveStationsWidget != NULL) { + m_ActiveStationsWidget->addLine(all_decodes); + } +} + +// +// start_tolerance - only respond to "DE ..." and free text 73 +// messages within +/- this value +// +// stop_tolerance - kill Tx if running station is seen to reply to +// another caller and we are going to transmit within +// +/- this value of the reply to another caller +// +void MainWindow::auto_sequence (DecodedText const& message, unsigned start_tolerance, unsigned stop_tolerance) +{ + auto const& message_words = message.messageWords (); + auto is_73 = message_words.filter (QRegularExpression {"^(73|RR73)$"}).size(); + auto msg_no_hash = message.clean_string(); + msg_no_hash = msg_no_hash.mid(22).remove("<").remove(">"); + bool is_OK=false; + if(m_mode=="MSK144" && msg_no_hash.indexOf(ui->dxCallEntry->text()+" R ")>0) is_OK=true; + if (message_words.size () > 3 && (message.isStandardMessage() || (is_73 or is_OK))) { + auto df = message.frequencyOffset (); + auto within_tolerance = (qAbs (ui->RxFreqSpinBox->value () - df) <= int (start_tolerance) + || qAbs (ui->TxFreqSpinBox->value () - df) <= int (start_tolerance)); + bool acceptable_73 = is_73 + && m_QSOProgress >= ROGER_REPORT + && ((message.isStandardMessage () + && (message_words.contains (m_baseCall) + || message_words.contains (m_config.my_callsign ()) + || message_words.contains (ui->dxCallEntry->text ()) + || message_words.contains (Radio::base_callsign (ui->dxCallEntry->text ())) + || message_words.contains ("DE"))) + || (!message.isStandardMessage () && m_mode != "MSK144")); // free text 73/RR73 except for MSK + + auto const& w = msg_no_hash.split(" ",SkipEmptyParts); + QString w2; + int nrpt=0; + if (w.size () > 2) + { + w2=w.at(2); + if(w.size()>3) { + nrpt=w2.toInt(); + if(w2=="R") nrpt=w.at(3).toInt(); + } + } + bool bEU_VHF=(nrpt>=520001 and nrpt<=594000); + if(bEU_VHF and message.clean_string ().contains("<"+m_config.my_callsign() + "> ")) { + m_xRcvd=message.clean_string ().trimmed().right(13); + } + if (m_auto + && (m_QSOProgress==REPLYING or (!ui->tx1->isEnabled () and m_QSOProgress==REPORT)) + && SpecOp::HOUND != m_specOp && qAbs (ui->TxFreqSpinBox->value () - df) <= int (stop_tolerance) // + && message_words.at (2) != "DE" + && !message_words.at (2).contains (QRegularExpression {"(^(CQ|QRZ))|" + m_baseCall}) + && message_words.at (3).contains (Radio::base_callsign (ui->dxCallEntry->text ()))) { + // auto stop to avoid accidental QRM + ui->stopTxButton->click (); // halt any transmission + LOG_INFO("STOPPED!"); + } else if (m_auto // transmit allowed + && ui->cbAutoSeq->isVisible () && ui->cbAutoSeq->isEnabled () && ui->cbAutoSeq->isChecked () // auto-sequencing allowed + && ((!m_bCallingCQ // not calling CQ/QRZ + && !m_sentFirst73 // not finished QSO + && ((message_words.at (2).contains (m_baseCall) + // being called and not already in a QSO + && (message_words.at(3).contains(Radio::base_callsign(ui->dxCallEntry->text())) + or bEU_VHF)) + || message_words.at(1) == m_baseCall // <de-call> RR73; ... + // type 2 compound replies + || (within_tolerance && + (acceptable_73 || + ("DE" == message_words.at (2) && + w2.contains(Radio::base_callsign (m_hisCall))))))) + || (m_bCallingCQ && m_bAutoReply + // look for type 2 compound call replies on our Tx and Rx offsets + && ((within_tolerance && "DE" == message_words.at (2)) + || message_words.at (2).contains (m_baseCall))))) { + if(SpecOp::FOX != m_specOp) processMessage (message); + } + } +} + +void MainWindow::pskPost (DecodedText const& decodedtext) +{ + if (m_diskData || !m_config.spot_to_psk_reporter() || decodedtext.isLowConfidence () + || (decodedtext.string().contains(m_baseCall) && decodedtext.string().contains(m_config.my_grid().left(4)))) return; // prevent self-spotting when running multiple instances + int h=decodedtext.string().mid(0,2).toInt(); + int m=decodedtext.string().mid(2,2).toInt(); + int s=decodedtext.string().mid(4,2).toInt(); + int sTimeString = decodedtext.string().mid(0,6).toInt(); + QTime time2(h, m, s); + QDateTime qSpotTime; + if (sTimeString + m_TRperiod < 236000) { + qSpotTime = QDateTime(QDateTime::currentDateTimeUtc().date(), time2, Qt::UTC); + } + else { + qSpotTime = QDateTime((QDateTime::currentDateTimeUtc().addDays(-1)).date(), time2, Qt::UTC); + } + QString msgmode=m_mode; + QString deCall; + QString grid; + decodedtext.deCallAndGrid(/*out*/deCall,grid); + int audioFrequency = decodedtext.frequencyOffset(); + if(m_mode=="FT8" or m_mode=="MSK144" or m_mode=="FT4") { + audioFrequency=decodedtext.string().mid(16,4).toInt(); + } + int snr = decodedtext.snr(); + Frequency frequency = m_freqNominalPeriod + audioFrequency; // prevent spotting wrong band + if(grid.contains (grid_regexp) || decodedtext.string().contains(" CQ ")) { +// qDebug() << "To PSKreporter:" << deCall << grid << frequency << msgmode << snr; + if (!m_psk_Reporter.addRemoteStation (deCall, grid, frequency, msgmode, snr, qSpotTime)) + { + showStatusMessage (tr ("Spotting to PSK Reporter unavailable")); + } + } +} + +void MainWindow::killFile () +{ + if (m_fnameWE.size () && !(m_saveAll || (m_saveDecoded && m_bDecoded))) { + QFile f1 {m_fnameWE + ".wav"}; + if(f1.exists()) f1.remove(); + if(m_mode=="WSPR" or m_mode=="FST4W") { + QFile f2 {m_fnameWE + ".c2"}; + if(f2.exists()) f2.remove(); + } + } +} + +void MainWindow::on_EraseButton_clicked () +{ + qint64 ms=QDateTime::currentMSecsSinceEpoch(); + if (m_config.alternate_erase_button()) { + ui->decodedTextBrowser->erase (); + if((ms-m_msErase)<500) { + ui->decodedTextBrowser2->erase (); + } + } else { + ui->decodedTextBrowser2->erase (); + if(m_mode=="WSPR" or m_mode=="Echo" or m_mode=="FST4W") { + ui->decodedTextBrowser->erase (); + } else { + if((ms-m_msErase)<500) { + ui->decodedTextBrowser->erase (); + } + } + } + m_msErase=ms; +} + +void MainWindow::band_activity_cleared () +{ + m_messageClient->decodes_cleared (); + QFile f(m_config.temp_dir ().absoluteFilePath ("decoded.txt")); + if(f.exists()) f.remove(); +} + +void MainWindow::rx_frequency_activity_cleared () +{ + m_QSOText.clear(); + set_dateTimeQSO(-1); // G4WJS: why do we do this? +} + +void MainWindow::decodeBusy(bool b) //decodeBusy() +{ + if (!b) { + m_optimizingProgress.reset (); + } + m_decoderBusy=b; + ui->DecodeButton->setEnabled(!b); + ui->actionOpen->setEnabled(!b); + ui->actionOpen_next_in_directory->setEnabled(!b); + ui->actionDecode_remaining_files_in_directory->setEnabled(!b); + + statusUpdate (); +} + +//------------------------------------------------------------- //guiUpdate() +void MainWindow::guiUpdate() +{ + static char message[38]; + static char msgsent[38]; + double txDuration; + + if(m_TRperiod==0) m_TRperiod=60.0; + txDuration=tx_duration(m_mode,m_TRperiod,m_nsps,m_bFast9); + if(m_mode=="FT8" and m_specOp==SpecOp::FOX and m_config.superFox()) txDuration=1.0+151*1024.0/12000.0; + // qDebug () << "DEBUG SF " << m_mode << m_TRperiod << m_nsps << (SpecOp::FOX==m_specOp) << m_config.superFox() << txDuration; + double tx1=0.0; + double tx2=txDuration; + if(m_mode=="FT8" or m_mode=="FT4") icw[0]=0; //No CW ID in FT4 or FT8 mode + if((icw[0]>0) and (!m_bFast9)) tx2 += icw[0]*2560.0/48000.0; //Full length including CW ID + if(tx2>m_TRperiod) tx2=m_TRperiod; + if(!m_txFirst and m_mode!="WSPR" and m_mode!="FST4W") { + tx1 += m_TRperiod; + tx2 += m_TRperiod; + } + + qint64 ms = QDateTime::currentMSecsSinceEpoch() % 86400000; + int nsec=ms/1000; + double tsec=0.001*ms; + double t2p=fmod(tsec,2*m_TRperiod); + m_s6=fmod(tsec,6.0); + int nseq = fmod(double(nsec),m_TRperiod); + m_tRemaining=m_TRperiod - fmod(tsec,m_TRperiod); + + if(m_mode=="Echo") { + tx1=0.0; + tx2=txDuration; + if(m_auto and m_s6>4.0) m_bEchoTxOK=true; + if(m_transmitting) m_bEchoTxed=true; + } + + if(m_mode=="WSPR" or m_mode=="FST4W") { + if(nseq==0 and m_ntr==0) { //Decide whether to Tx or Rx + m_tuneup=false; //This is not an ATU tuneup + bool btx = m_auto && m_WSPR_tx_next; // To Tx, we need m_auto and + // scheduled transmit + m_WSPR_tx_next = false; + if(btx) { + m_ntr=-1; //This says we will have transmitted + ui->pbTxNext->setChecked (false); + m_bTxTime=true; //Start a WSPR or FST4W Tx sequence + } else { + // This will be a WSPR or FST4W Rx sequence. + m_ntr=1; //This says we will have received + m_bTxTime=false; //Start a WSPR or FST4W Rx sequence + } + } + + } else { + // For all modes other than WSPR and FST4W + m_bTxTime = (t2p >= tx1) and (t2p < tx2); + if(m_mode=="Echo") { + m_bTxTime = (t2p >= tx1) and (t2p < (tx2+m_config.txDelay())) and m_bEchoTxOK; + } + if(m_mode=="FT8" and ui->tx5->currentText().contains("/B ")) { + //FT8 beacon transmission from Tx5 only at top of a UTC minute + double t4p=fmod(tsec,4*m_TRperiod); + if(t4p >= 30.0) m_bTxTime=false; + } + } + if(m_tune) m_bTxTime=true; //"Tune" takes precedence + + if(m_transmitting or m_auto or m_tune) { + m_dateTimeLastTX = QDateTime::currentDateTimeUtc (); + +// Check for "txboth" (FT4 testing purposes only) + QFile f(m_appDir + "/txboth"); + if(f.exists() and fmod(tsec,m_TRperiod) < (0.5 + 105.0*576.0/12000.0)) m_bTxTime=true; + +// Don't transmit another mode in the 30 m WSPR sub-band + Frequency onAirFreq = m_freqNominal + ui->TxFreqSpinBox->value(); + if ((onAirFreq > 10139900 and onAirFreq < 10140320) and m_mode!="WSPR" and m_mode!="FST4W") { + m_bTxTime=false; + if (m_auto) auto_tx_mode (false); + if(onAirFreq!=m_onAirFreq0) { + m_onAirFreq0=onAirFreq; + auto const& message = tr ("Please choose another Tx frequency." + " WSJT-X will not knowingly transmit another" + " mode in the WSPR sub-band on 30m."); + QTimer::singleShot (0, [=] { // don't block guiUpdate + MessageBox::warning_message (this, tr ("WSPR Guard Band"), message); + }); + } + } + + if(m_mode=="FT8" and SpecOp::FOX==m_specOp) { +// Don't allow Fox mode in any of the default FT8 sub-bands. + QVector<qint32> ft8Freq = {1840000,3573000,7074000,10136000,14074000,18100000,21074000,24915000,28074000,50313000,70154000}; + for(int i=0; i<ft8Freq.length()-1; i++) { + int kHzdiff=m_freqNominal - ft8Freq[i]; + if(qAbs(kHzdiff) < 3000 ) { + m_bTxTime=false; + if (m_auto) auto_tx_mode (false); + if (m_tune) stop_tuning(); + auto const& message = tr ("Please choose another dial frequency.\n" + "Must be 3Khz away from %1.\n" + "WSJT-X will not operate in Fox mode\n" + "overlapping the standard FT8 sub-bands.").arg(ft8Freq[i]); + QTimer::singleShot (0, [=] { // don't block guiUpdate + MessageBox::warning_message (this, tr ("Fox Mode warning"), message); + }); + break; + } + } +// Don't allow Fox mode on WSPR frequencies. + QVector<qint32> wsprFreq = {1836600,5364700,3568600,7038600,10138700,14095600,18104600,21094600,24924600,28124600}; + for(int i=0; i<wsprFreq.length()-1; i++) { + int kHzdiff=m_freqNominal - wsprFreq[i]; + if(kHzdiff > -3500 && kHzdiff < 300) { + m_bTxTime=false; + if (m_auto) auto_tx_mode (false); + if (m_tune) stop_tuning(); + auto const& message = tr ("Please choose another dial frequency.\n" + "WSJT-X will not operate in Fox mode\n" + "overlapping the WSPR sub-bands.").arg(ft8Freq[i]); + QTimer::singleShot (0, [=] { // don't block guiUpdate + MessageBox::warning_message (this, tr ("Fox Mode warning"), message); + }); + break; + } + } + } + + if (m_config.watchdog() && m_mode!="WSPR" && m_mode!="FST4W" + && m_idleMinutes >= m_config.watchdog ()) { + tx_watchdog (true); // disable transmit + } + + double fTR=float((ms%int(1000.0*m_TRperiod)))/int(1000.0*m_TRperiod); + + QString txMsg; + if(m_ntx == 1) txMsg=ui->tx1->text(); + if(m_ntx == 2) txMsg=ui->tx2->text(); + if(m_ntx == 3) txMsg=ui->tx3->text(); + if(m_ntx == 4) txMsg=ui->tx4->text(); + if(m_ntx == 5) txMsg=ui->tx5->currentText(); + if(m_ntx == 6) txMsg=ui->tx6->text(); + int msgLength=txMsg.trimmed().length(); + if(msgLength==0 and !m_tune) on_stopTxButton_clicked(); + + if(g_iptt==0 and ((m_bTxTime and (fTR < 0.75) and (msgLength>0)) or m_tune)) { + //### Allow late starts + icw[0]=m_ncw; + g_iptt = 1; + setRig (); + if(m_mode=="FT8") { + if (SpecOp::FOX == m_specOp) { + if(m_config.superFox()) { + ui->TxFreqSpinBox->setValue(750); //SuperFox transmits at 750 Hz + } else { + if (ui->TxFreqSpinBox->value() > 900) { + ui->TxFreqSpinBox->setValue(500); + } + } + } + else if (SpecOp::HOUND == m_specOp && !m_config.superFox()) { + if(m_auto && !m_tune) { + if (ui->TxFreqSpinBox->value() < 999 && m_ntx != 3) { + // Hound randomized range: 1000-3000 Hz +#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0) + ui->TxFreqSpinBox->setValue (QRandomGenerator::global ()->bounded (1000, 2999)); +#else + ui->TxFreqSpinBox->setValue ((qrand () % 2000) + 1000); +#endif + } + } + if (m_nSentFoxRrpt==2 and m_ntx==3) { + // move off the original Fox frequency on subsequent tries of Tx3 + int nfreq=m_nFoxFreq + 300; + if(m_nFoxFreq>600) nfreq=m_nFoxFreq - 300; //keep nfreq below 900 Hz + ui->TxFreqSpinBox->setValue(nfreq); + } + if (m_nSentFoxRrpt == 1) { + ++m_nSentFoxRrpt; + } + } + } + + +// If HoldTxFreq is not checked, randomize Fox's Tx Freq +// NB: Maybe this should be done no more than once every 5 minutes or so ? + if(m_mode=="FT8" and SpecOp::FOX==m_specOp and !ui->cbHoldTxFreq->isChecked() && !m_config.superFox()) { +#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0) + ui->TxFreqSpinBox->setValue (QRandomGenerator::global ()->bounded (300, 599)); +#else + ui->TxFreqSpinBox->setValue(300.0 + 300.0*double(qrand())/RAND_MAX); +#endif + } + + setXIT (ui->TxFreqSpinBox->value ()); + m_config.transceiver_ptt (true); //Assert the PTT + m_tx_when_ready = true; + } +// if(!m_bTxTime and !m_tune and m_mode!="FT4") m_btxok=false; //Time to stop transmitting + if(!m_bTxTime and !m_tune) m_btxok=false; //Time to stop transmitting + } + + if((m_mode=="WSPR" or m_mode=="FST4W") and + ((m_ntr==1 and m_rxDone) or (m_ntr==-1 and nseq>tx2))) { + if(m_monitoring) { + m_rxDone=false; + } + if(m_transmitting) { + WSPR_history(m_freqNominal,-1); + m_bTxTime=false; //Time to stop a WSPR or FST4W transmission + m_btxok=false; + } + else if (m_ntr != -1) { + WSPR_scheduling (); + m_ntr=0; //This WSPR or FST4W Rx sequence is complete + } + } + + + // Calculate Tx tones when needed + if((g_iptt==1 && m_iptt0==0) || m_restart) { +//---------------------------------------------------------------------- + QByteArray ba; + QByteArray ba0; + + if(m_mode=="WSPR") { + ba=WSPR_message().toLatin1(); + } else { + if(SpecOp::HOUND == m_specOp and m_ntx!=3) { //Hound transmits only Tx1 or Tx3 + m_ntx=1; + ui->txrb1->setChecked(true); + } + + if(m_mode=="FT4" and m_bBestSPArmed) { + m_BestCQpriority=""; + m_bBestSPArmed=false; + ui->pbBestSP->setStyleSheet (""); + } + + if(m_ntx == 1) ba=ui->tx1->text().toLocal8Bit(); + if(m_ntx == 2) ba=ui->tx2->text().toLocal8Bit(); + if(m_ntx == 3) ba=ui->tx3->text().toLocal8Bit(); + if(m_ntx == 4) ba=ui->tx4->text().toLocal8Bit(); + if(m_ntx == 5) ba=ui->tx5->currentText().toLocal8Bit(); + if(m_ntx == 6) ba=ui->tx6->text().toLocal8Bit(); + } + + ba2msg(ba,message); + int ichk=0; + if (m_lastMessageSent != m_currentMessage + || m_lastMessageType != m_currentMessageType) + { + m_lastMessageSent = m_currentMessage; + m_lastMessageType = m_currentMessageType; + } + m_currentMessageType = 0; + if(m_tune or m_mode=="Echo") { + itone[0]=0; + if(ui->rbEchoMessage->isChecked() or ui->rbEchoCW->isChecked()) { + QString echoMsg=(ui->leEchoMessage->text()+" ").left(6); + gen_echocall_(const_cast <char *> (echoMsg.toLatin1().constData()),const_cast<int *>(itone),(FCL)6); + } + } else { + if(m_QSOProgress==REPORT || m_QSOProgress==ROGER_REPORT) m_bSentReport=true; + if(m_bSentReport and (m_QSOProgress<REPORT or m_QSOProgress>ROGER_REPORT)) m_bSentReport=false; + if(m_mode=="JT4") gen4_(message, &ichk , msgsent, const_cast<int *> (itone), + &m_currentMessageType, (FCL)22, (FCL)22); + if(m_mode=="JT9") gen9_(message, &ichk, msgsent, const_cast<int *> (itone), + &m_currentMessageType, (FCL)22, (FCL)22); + if(m_mode=="JT65") gen65(message, &ichk, msgsent, const_cast<int *> (itone), + &m_currentMessageType); + if(m_mode=="WSPR") genwspr_(message, msgsent, const_cast<int *> (itone), + (FCL)22, (FCL)22); + if(m_mode=="MSK144" or m_mode=="FT8" or m_mode=="FT4" + or m_mode=="FST4" or m_mode=="FST4W" || "Q65" == m_mode) { + if(m_mode=="MSK144") { + genmsk_128_90_(message, &ichk, msgsent, const_cast<int *> (itone), + &m_currentMessageType, (FCL)37, (FCL)37); + if(m_restart) { + int nsym=144; + if(itone[40]==-40) nsym=40; + m_modulator->set_nsym(nsym); + } + } + + if(m_mode=="FT8") { + if(SpecOp::FOX==m_specOp and ui->tabWidget->currentIndex()==1) { + foxTxSequencer(); + } else { + int i3=0; + int n3=0; + char ft8msgbits[77]; + genft8_(message, &i3, &n3, msgsent, const_cast<char *> (ft8msgbits), + const_cast<int *> (itone), (FCL)37, (FCL)37); + int nsym=79; + int nsps=4*1920; + float fsample=48000.0; + float bt=2.0; + float f0=ui->TxFreqSpinBox->value() - m_XIT; + int icmplx=0; + int nwave=nsym*nsps; + gen_ft8wave_(const_cast<int *>(itone),&nsym,&nsps,&bt,&fsample,&f0,foxcom_.wave, + foxcom_.wave,&icmplx,&nwave); + if(SpecOp::FOX == m_specOp) { + //Fox must generate the full Tx waveform, not just an itone[] array. + QString fm = QString::fromStdString(message).trimmed(); + foxGenWaveform(0,fm); + foxcom_.nslots=1; + foxcom_.nfreq=ui->TxFreqSpinBox->value(); + if(m_config.split_mode()) foxcom_.nfreq = foxcom_.nfreq - m_XIT; //Fox Tx freq + QString foxCall=m_config.my_callsign() + " "; + ::memcpy(foxcom_.mycall, foxCall.toLatin1(), sizeof foxcom_.mycall); //Copy Fox callsign into foxcom_ + bool bSuperFox=m_config.superFox(); + auto fname {QDir::toNativeSeparators(m_config.writeable_data_dir().absoluteFilePath("sfox_1.dat")).toLocal8Bit()}; + foxcom_.bMoreCQs=ui->cbMoreCQs->isChecked(); + foxcom_.bSendMsg=ui->cbSendMsg->isChecked(); + memcpy(foxcom_.textMsg, m_freeTextMsg.leftJustified(26,' ').toLatin1(),26); + foxgen_(&bSuperFox, fname.constData(), (FCL)fname.size()); + if(bSuperFox) { + writeFoxTxMsgs(); + sfox_tx(); + } + } + } + } + if(m_mode=="FT4") { + int ichk=0; + char ft4msgbits[77]; + genft4_(message, &ichk, msgsent, const_cast<char *> (ft4msgbits), + const_cast<int *>(itone), (FCL)37, (FCL)37); + int nsym=103; + int nsps=4*576; + float fsample=48000.0; + float f0=ui->TxFreqSpinBox->value() - m_XIT; + int nwave=(nsym+2)*nsps; + int icmplx=0; + gen_ft4wave_(const_cast<int *>(itone),&nsym,&nsps,&fsample,&f0,foxcom_.wave, + foxcom_.wave,&icmplx,&nwave); + } + if(m_mode=="FST4" or m_mode=="FST4W") { + int ichk=0; + int iwspr=0; + char fst4msgbits[101]; + QString wmsg; + if(m_mode=="FST4W") { + iwspr = 1; + wmsg=WSPR_message(); + ba=wmsg.toLatin1(); + ba2msg(ba,message); + } + genfst4_(message,&ichk,msgsent,const_cast<char *> (fst4msgbits), + const_cast<int *>(itone), &iwspr, (FCL)37, (FCL)37); + int hmod=1; + if(m_config.x2ToneSpacing()) hmod=2; + if(m_config.x4ToneSpacing()) hmod=4; + int nsps=720; + if(m_TRperiod==30) nsps=1680; + if(m_TRperiod==60) nsps=3888; + if(m_TRperiod==120) nsps=8200; + if(m_TRperiod==300) nsps=21504; + if(m_TRperiod==900) nsps=66560; + if(m_TRperiod==1800) nsps=134400; + nsps=4*nsps; //48000 Hz sampling + int nsym=160; + float fsample=48000.0; + float dfreq=hmod*fsample/nsps; + float f0=ui->TxFreqSpinBox->value() - m_XIT + 1.5*dfreq; + if(m_mode=="FST4W") f0=ui->WSPRfreqSpinBox->value() - m_XIT + 1.5*dfreq; + int nwave=(nsym+2)*nsps; + int icmplx=0; + gen_fst4wave_(const_cast<int *>(itone),&nsym,&nsps,&nwave, + &fsample,&hmod,&f0,&icmplx,foxcom_.wave,foxcom_.wave); + + QString t = QString::fromStdString(message).trimmed(); + } + if(m_mode=="Q65") { + int i3=-1; + int n3=-1; + genq65_(message, &ichk,msgsent, const_cast<int *>(itone), &i3, &n3, (FCL)37, (FCL)37); + int nsps=1800; + if(m_TRperiod==30) nsps=3600; + if(m_TRperiod==60) nsps=7200; + if(m_TRperiod==120) nsps=16000; + if(m_TRperiod==300) nsps=41472; + int nsps4=4*nsps; //48000 Hz sampling + int nsym=85; + float fsample=48000.0; + int nwave=(nsym+2)*nsps4; + int icmplx=0; + float f0=ui->TxFreqSpinBox->value()-m_XIT; + double toneSpacing=fsample/nsps4; + genwave_(const_cast<int *>(itone),&nsym,&nsps4,&nwave, + &fsample,&toneSpacing,&f0,&icmplx,foxcom_.wave,foxcom_.wave); + } + + if(SpecOp::EU_VHF==m_specOp) { + if(m_ntx==2) m_xSent=ui->tx2->text().right(13); + if(m_ntx==3) m_xSent=ui->tx3->text().right(13); + } + + if(SpecOp::FIELD_DAY==m_specOp or SpecOp::RTTY==m_specOp) { + if(m_ntx==2 or m_ntx==3) { + QStringList t=ui->tx2->text().split(' ', SkipEmptyParts); + int n=t.size(); + if (n > 3) m_xSent=t.at(n-2) + " " + t.at(n-1); + } + } + } + msgsent[37]=0; + } + + { + auto temp = m_currentMessage; + m_currentMessage = QString::fromLatin1(msgsent); + if (m_currentMessage != temp) // check if tx message changed + { + statusUpdate (); + } + } + m_bCallingCQ = 6 == m_ntx + || m_currentMessage.contains (QRegularExpression {"^(CQ|QRZ) "}); + m_maxPoints=-1; + + if (m_tune) { + m_currentMessage = "TUNE"; + m_currentMessageType = -1; + } + if(m_restart) { + write_all("Tx",m_currentMessage); + if (m_config.TX_messages () and m_mode!="Echo") { + ui->decodedTextBrowser2->displayTransmittedText(m_currentMessage.trimmed(),m_mode, + ui->TxFreqSpinBox->value(),m_bFastMode,m_TRperiod,m_config.superFox()); + } + } + + auto t2 = QDateTime::currentDateTimeUtc ().toString ("hhmm"); + icw[0] = 0; + auto msg_parts = m_currentMessage.split (' ', SkipEmptyParts); + if (msg_parts.size () > 2) { + // clean up short code forms + msg_parts[0].remove (QChar {'<'}); + msg_parts[0].remove (QChar {'>'}); + msg_parts[1].remove (QChar {'<'}); + msg_parts[1].remove (QChar {'>'}); + } + auto is_73 = message_is_73 (m_currentMessageType, msg_parts); + m_sentFirst73 = is_73 + && !message_is_73 (m_lastMessageType, m_lastMessageSent.split (' ', SkipEmptyParts)); + if (m_sentFirst73 || (is_73 && CALLING == m_QSOProgress)) { + m_qsoStop=t2; + if(m_config.id_after_73 ()) { + icw[0] = m_ncw; + } + if((m_config.prompt_to_log() or m_config.autoLog()) && !m_tune && CALLING != m_QSOProgress) + { + // always stop Tx after sending 73 + if (m_config.repeat_Tx() && (m_mode=="MSK144" or m_mode=="Q65") && m_ntx != 4) cease_auto_Tx_after_QSO (); + if (!(m_mode=="FT4" && SpecOp::NA_VHF==m_specOp && m_config.NCCC_Sprint())) logQSOTimer.start(0); + } + else + { + cease_auto_Tx_after_QSO (); + } + } + + bool b=("FT8"==m_mode or "FT4"==m_mode or "Q65"==m_mode or "JT65"==m_mode or "JT9"==m_mode) and ui->cbAutoSeq->isVisible () + && ui->cbAutoSeq->isEnabled () && ui->cbAutoSeq->isChecked (); + if(is_73 and (m_config.disable_TX_on_73() or b)) { + m_nextCall=""; //### Temporary: disable use of "TU;" messages; + if(m_nextCall!="") { + useNextCall(); + } else { + if(m_config.repeat_Tx() && (m_mode=="MSK144" or m_mode=="Q65")) { + stopWRTimer.start(int(20000.0*m_TRperiod)); // send RR73 up to 10 times + } else { + auto_tx_mode (false); + if(b) { + m_ntx=6; + ui->txrb6->setChecked(true); + m_QSOProgress = CALLING; + } + } + } + } + + if(m_config.id_interval () >0) { + int nmin=(m_sec0-m_secID)/60; + if(m_sec0<m_secID) nmin=m_config.id_interval(); + if(nmin >= m_config.id_interval()) { + icw[0]=m_ncw; + m_secID=m_sec0; + } + } + + if ((m_currentMessageType < 6 || 7 == m_currentMessageType) + && msg_parts.length() >= 3 + && (msg_parts[1] == m_config.my_callsign () || + msg_parts[1] == m_baseCall)) + { + int i1; + bool ok; + i1 = msg_parts[2].toInt(&ok); + if(ok and i1>=-50 and i1<50) + { + m_rptSent = msg_parts[2]; + m_qsoStart = t2; + } else { + if (msg_parts[2].mid (0, 1) == "R") + { + i1 = msg_parts[2].mid (1).toInt (&ok); + if (ok and i1 >= -50 and i1 < 50) + { + m_rptSent = msg_parts[2].mid (1); + m_qsoStart = t2; + } + } + } + } + m_restart=false; +//---------------------------------------------------------------------- + } else { + if (!m_auto && m_sentFirst73) { + m_sentFirst73 = false; + } + } + + if (g_iptt == 1 && m_iptt0 == 0) { + auto const& current_message = QString::fromLatin1 (msgsent); + if(m_config.watchdog () && m_mode!="WSPR" && m_mode!="FST4W" + && current_message != m_msgSent0) { + tx_watchdog (false); // in case we are auto sequencing + m_msgSent0 = current_message; + } + + if (m_mode != "FST4W" && m_mode != "WSPR" && m_mode!="Echo") + { + if(!m_tune) write_all("Tx",m_currentMessage); + if (m_config.TX_messages () && !m_tune && SpecOp::FOX!=m_specOp) + { + ui->decodedTextBrowser2->displayTransmittedText(current_message.trimmed(), + m_mode,ui->TxFreqSpinBox->value(),m_bFastMode,m_TRperiod,m_config.superFox()); + } + } + + switch (m_ntx) + { + case 1: m_QSOProgress = REPLYING; break; + case 2: m_QSOProgress = REPORT; break; + case 3: m_QSOProgress = ROGER_REPORT; break; + case 4: m_QSOProgress = ROGERS; break; + case 5: m_QSOProgress = SIGNOFF; break; + case 6: m_QSOProgress = CALLING; break; + default: break; // determined elsewhere + } + m_transmitting = true; + transmitDisplay (true); + statusUpdate (); + } + + if(!m_btxok && m_btxok0 && g_iptt==1) { + stopTx(); + if ("1" == m_env.value ("WSJT_TX_BOTH", "0")) { + m_txFirst = !m_txFirst; + ui->txFirstCheckBox->setChecked (m_txFirst); + } + } + + if(m_startAnother) { + if(m_mode=="MSK144") { + m_wait++; + } + if(m_mode!="MSK144" or m_wait>=4) { + m_wait=0; + m_startAnother=false; + on_actionOpen_next_in_directory_triggered(); + } + } + + if(m_mode=="FT8" or m_mode=="MSK144" or m_mode=="FT4" or m_mode=="Q65") { + if(ui->txrb1->isEnabled() and + (SpecOp::NA_VHF==m_specOp or + SpecOp::FIELD_DAY==m_specOp or + SpecOp::RTTY==m_specOp or + SpecOp::WW_DIGI==m_specOp or + SpecOp::ARRL_DIGI==m_specOp or + SpecOp::Q65_PILEUP==m_specOp)) { + //We're in a contest-like mode other than EU_VHF: start QSO with Tx2. + ui->tx1->setEnabled(false); + ui->txb1->setEnabled(false); + } + if(!ui->tx1->isEnabled() and SpecOp::EU_VHF==m_specOp) { + //We're in EU_VHF mode: start QSO with Tx1. + ui->tx1->setEnabled(true); + ui->txb1->setEnabled(true); + } + } + if(m_mode=="Echo" and !m_monitoring and !m_auto and !m_diskData) m_echoRunning=false; + + if(m_mode=="Q65") { + mem_qmap.lock(); + int n=0; + if(m_decoderBusy) n=1; + ipc_qmap[3]=n; + n=0; + if(m_transmitting) n=m_TRperiod; + ipc_qmap[4]=n; + if(ipc_qmap[0] > 0) { //ndecodes + memcpy(&qmapcom, (char*)ipc_qmap, sizeof(qmapcom)); //Fetch the new decode(s) + readWidebandDecodes(); + } + if(ipc_qmap[5]>0) { + setRig((m_freqNominal/1000000)*1000000 + 1000*ipc_qmap[5]); + ipc_qmap[5]=0; + } + mem_qmap.unlock(); + } + +//Once per second (onesec) + if(nsec != m_sec0) { + + // reset earlyDecodes for 2-stage or 3-stage decoding, or if QRG > 45 MHz + if (m_mode=="FT8" && !m_diskData && ((m_multithreadFT8 && m_ft8DecoderStart<2) or m_freqNominal>45000000)) { + QDateTime now = QDateTime::currentDateTimeUtc(); + int s = now.time().toString("ss").toInt(); + if (m_ft8DecoderStart<2 or m_freqNominal>45000000) { + if ((s == 7 || s == 22 ||s == 37 || s == 52) && m_decoderBusy) { + to_jt9(m_ihsym,-1,-1); //Allow jt9 to bail out early, if necessary + decodeDone(); //We better clear a hung decoder status at this point + } + if (s == 10 || s == 25 ||s == 40 || s == 55) earlyDecodes = ""; + } + } + + // reset blank line for MSK144 + if (m_mode=="MSK144") { + QDateTime now = QDateTime::currentDateTimeUtc(); + int s = now.time().toString("ss").toInt(); + if ((m_TRperiod==5 && (s==0 || s==5 || s==10 || s==15 || s==20 || s==25 || s==30 || s==35 || s==40 || s==45 || s==50 || s==55)) + or (m_TRperiod==10 && (s==0 || s==10 || s==20 || s==30 || s==40 || s==50)) + or (m_TRperiod==15 && (s==0 || s==15 || s==30 || s==45)) + or (m_TRperiod==30 && (s==0 || s==30))) { + BlankLineInserted = false; + m_dateTimeSeqStart = qt_truncate_date_time_to (QDateTime::currentDateTimeUtc (), m_TRperiod * 1.e3); + } + } + + if (m_tune && m_config.tune_watchdog() && !(m_mode=="WSPR" || m_mode=="FST4W")) { + QString remtime; + remtime = QString::asprintf("%.0f s",tuneATU_Timer.remainingTime()/1000.0); + ui->tuneButton->setText(remtime); // display Tune watchdog countdog + } + + // prevent tuning on top of a SuperFox message + if (SpecOp::HOUND==m_specOp && m_config.superFox() && m_tune) { + QDateTime now = QDateTime::currentDateTimeUtc(); + int s = now.time().toString("ss").toInt(); + if ((s >= 0 && s < 15) || (s >= 30 && s < 45)) ui->tuneButton->click (); + } + + if(m_mode=="FST4") chk_FST4_freq_range(); + m_currentBand=m_config.bands()->find(m_freqNominal); + if( SpecOp::HOUND == m_specOp ) { + qint32 tHound=QDateTime::currentMSecsSinceEpoch()/1000 - m_tAutoOn; + //To keep calling Fox, Hound must reactivate Enable Tx at least once every 2 minutes + if(m_ntx==1 and m_auto) { + if(tHound >= 180 and tHound < 240 and watchdog_label.text() != " WD:1m ") { + watchdog_label.setText (" HWD:2m "); + } + if(tHound >= 240 and tHound < 300) { + watchdog_label.setStyleSheet ("QLabel{color: #000000; background-color: #ffff00}"); + watchdog_label.setText (" HWD:1m "); + } + if(tHound >= 300) { + auto_tx_mode(false); + statusUpdate (); + watchdog_label.setStyleSheet ("QLabel{color: #ffffff; background-color: #ff0000}"); + watchdog_label.setText (" HWD:0m "); + } + } + } + + progressBar.setVisible(true); + // turn the progressbar red during transmission + if(m_config.progressBar_red()) { + if(m_transmitting) { + if (m_useDarkStyle) { + progressBar.setStyleSheet(QString("QProgressBar {color: #ffffff; text-align: center;} QProgressBar::chunk {background-color: #ff0000;}")); + progressBar.setFormat ("%v/%m"); + } else { +#ifdef WIN32 + if(m_TRperiod > 99) { + progressBar.setStyleSheet(QString("QProgressBar {color: #000000; text-align: right; margin-right: 4em;} QProgressBar::chunk {background-color: #ff0000;}")); + progressBar.setFormat ("%v/%m "); + } else { + progressBar.setStyleSheet(QString("QProgressBar {color: #000000; text-align: right; margin-right: 3em;} QProgressBar::chunk {background-color: #ff0000;}")); + progressBar.setFormat ("%v/%m "); + } +#else + progressBar.setStyleSheet(QString("QProgressBar {color: #000000; text-align: center;} QProgressBar::chunk {background-color: #ff4141;}")); + progressBar.setFormat ("%v/%m"); +#endif + } + } else { +#ifdef __APPLE__ + if (m_useDarkStyle) { + progressBar.setStyleSheet(QString("QProgressBar {color: #ffffff; text-align: center;} QProgressBar::chunk {background-color: #1464A0;}")); // for macOS + } else { + progressBar.setStyleSheet(QString("QProgressBar {color: #000000; text-align: center;} QProgressBar::chunk {background-color: #96C9F6;}")); // for macOS + } +#else + progressBar.setStyleSheet(""); +#endif + progressBar.setFormat ("%v/%m"); + } + } else { +#ifdef __APPLE__ + if (m_useDarkStyle) { + progressBar.setStyleSheet(QString("QProgressBar {color: #ffffff; text-align: center;} QProgressBar::chunk {background-color: #1464A0;}")); // for macOS + } else { + progressBar.setStyleSheet(QString("QProgressBar {color: #000000; text-align: center;} QProgressBar::chunk {background-color: #96C9F6;}")); // for macOS + } +#else + progressBar.setStyleSheet(""); +#endif + progressBar.setFormat ("%v/%m"); + } + if(m_mode=="Echo") { + progressBar.setMaximum(3); + int n=0; + if(m_transmitting or m_monitoring) n=int(m_s6)%3; + progressBar.setValue(n); + } + if(m_mode!="Echo") { + if(m_monitoring or m_transmitting) { + progressBar.setMaximum(m_TRperiod); + int isec=int(fmod(tsec,m_TRperiod)); + if(m_TRperiod-int(m_TRperiod)>0.0) { + QString progBarLabel; + progBarLabel = progBarLabel.asprintf("%d/%3.1f",isec,m_TRperiod); + progressBar.setFormat (progBarLabel); + } + progressBar.setValue(isec); + } else { + progressBar.setValue(0); + } + } + + astroUpdate (); + + if(m_transmitting) { + char s[42]; + if(SpecOp::FOX==m_specOp and ui->tabWidget->currentIndex()==1) { + snprintf(s,sizeof(s),"Tx: %d Slots",foxcom_.nslots); + } else { + snprintf(s,sizeof(s),"Tx: %s",msgsent); + } + m_nsendingsh=0; + if(s[4]==64) m_nsendingsh=1; + if(m_nsendingsh==1 or m_currentMessageType==7) { + tx_status_label.setStyleSheet("QLabel{color: #000000; background-color: #66ffff}"); + } else if(m_nsendingsh==-1 or m_currentMessageType==6) { + tx_status_label.setStyleSheet("QLabel{color: #000000; background-color: #ffccff}"); + } else { + tx_status_label.setStyleSheet("QLabel{color: #000000; background-color: #ffff33}"); + } + if(m_tune) { + tx_status_label.setText("Tx: TUNE"); + } else { + if(m_mode=="Echo") { + tx_status_label.setText("Tx: ECHO"); + } else { + s[40]=0; + QString t{QString::fromLatin1(s)}; + if(SpecOp::FOX==m_specOp and ui->tabWidget->currentIndex()==1 and foxcom_.nslots==1) { + t=m_fm1.trimmed(); + } + if(m_mode=="FT4") t="Tx: "+ m_currentMessage; + tx_status_label.setText(t.trimmed()); + } + } + } else if(m_monitoring) { + if (!m_tx_watchdog) { + tx_status_label.setStyleSheet("QLabel{color: #000000; background-color: #00ff00}"); + auto t = tr ("Receiving"); + // switching tx_status_label text and color when filters are enabled + if (((SpecOp::NONE==m_specOp or SpecOp::HOUND==m_specOp) && !m_config.filters_for_Wait_and_Pounce_only() && + (m_config.Blacklisted () or m_config.Whitelisted ())) or (ui->cbCQonly->isChecked() && ui->cbCQonly->isVisible()) + or ui->actionHideToday->isChecked() or ui->actionHideIgnored->isChecked() + or ui->actionHideTerritory1->isChecked() or ui->actionHideTerritory2->isChecked() + or ui->actionHideTerritory3->isChecked() or ui->actionHideTerritory4->isChecked() + or ui->actionHideB4->isChecked() or ui->actionHideEU->isChecked() or ui->actionHideAS->isChecked() + or ui->actionHideNA->isChecked() or ui->actionHideSA->isChecked() or ui->actionHideAF->isChecked() + or ui->actionHideOC->isChecked() or ui->actionHideAN->isChecked()) { + tx_status_label.setMinimumSize (QSize {120, 18}); + if (ui->cbBypass->isChecked()) { + if (ui->cbCQonly->isChecked()) { + tx_status_label.setStyleSheet ("QLabel{color: #000000; background-color: #00ffff}"); + t = " Receiving, Filters On "; + } else { + tx_status_label.setStyleSheet ("QLabel{color: #000000; background-color: #00ff00}"); + t = " Receiving, Filters bypassed "; + } + } else { + tx_status_label.setStyleSheet ("QLabel{color: #000000; background-color: #00ffff}"); + t = " Receiving, Filters On "; + } + } else { + tx_status_label.setMinimumSize (QSize {100, 18}); + tx_status_label.setStyleSheet ("QLabel{color: #000000; background-color: #00ff00}"); + } + if(m_mode=="MSK144") { + int npct=int(100.0*m_fCPUmskrtd/0.298667); + if(npct>90) tx_status_label.setStyleSheet("QLabel{color: #000000; background-color: #ff0000}"); + t += QString {" %1%"}.arg (npct, 2); + } + tx_status_label.setText (t); + } + transmitDisplay(false); + } else if (!m_diskData && !m_tx_watchdog) { + tx_status_label.setStyleSheet(""); + tx_status_label.setText(""); + } + + QDateTime t = QDateTime::currentDateTimeUtc(); + QString utc = t.date().toString("yyyy MMM dd") + "\n " + + t.time().toString() + " "; +// QString utc = t.time().toString(); // UR for AL version use this and disable the 2 lines above + ui->labUTC->setText(utc); + if(m_bBestSPArmed and (m_dateTimeBestSP.secsTo(t) >= 120)) on_pbBestSP_clicked(); //BestSP timeout + if(!m_monitoring and !m_diskData) ui->signal_meter_widget->setValue(0,0); + m_sec0=nsec; + displayDialFrequency (); + } + m_iptt0=g_iptt; + m_btxok0=m_btxok; + + if(m_tci_audio) { + Q_EMIT m_config.transceiver_volume(m_config.volume()); + } + + if (m_config.highlight_73()) { + ui->cbCQonly->setText("CQ/73"); + ui->cbCQonly->setToolTip("CQ or 73 messages only."); + } else { + ui->cbCQonly->setText("CQ only"); + ui->cbCQonly->setToolTip("CQ messages only."); + } + check_button_color(); + +} //End of guiUpdate + +void MainWindow::useNextCall() +{ + ui->dxCallEntry->setText(m_nextCall); + m_nextCall=""; + if(m_nextGrid.contains(grid_regexp)) { + ui->dxGridEntry->setText(m_nextGrid); + m_ntx=2; + ui->txrb2->setChecked(true); + } else { + m_ntx=3; + ui->txrb3->setChecked(true); + } + genStdMsgs(m_nextRpt); +} + +void MainWindow::startTx2() +{ + bool modulator_active; + bool tci_active = m_tci_audio; + if (tci_active) modulator_active=m_tci_mod_active; + else modulator_active=m_modulator->isActive (); + if (!modulator_active) { // TODO - not thread safe + double fSpread=0.0; + double snr=99.0; + QString t=ui->tx5->currentText(); + if(t.mid(0,1)=="#") fSpread=t.mid(1,5).toDouble(); + if (tci_active) Q_EMIT m_config.transceiver_spread(fSpread); + else m_modulator->setSpread(fSpread); // TODO - not thread safe + t=ui->tx6->text(); + if(t.mid(0,1)=="#") snr=t.mid(1,5).toDouble(); + if(snr>0.0 or snr < -50.0) snr=99.0; + if((m_ntx==6 or m_ntx==7) and m_config.force_call_1st() and + ui->respondComboBox->currentIndex()==0) { + ui->cbAutoSeq->setChecked(true); + ui->respondComboBox->setCurrentIndex(1); + } + transmit (snr); + ui->signal_meter_widget->setValue(0,0); + if(m_mode=="Echo" and !m_tune) m_bTransmittedEcho=true; + + if((m_mode=="WSPR" or m_mode=="FST4W") and !m_tune) { + if (m_config.TX_messages ()) { + t = " Transmitting " + m_mode + " ----------------------- " + + m_config.bands ()->find (m_freqNominal); + t=beacon_start_time (m_TRperiod / 2) + ' ' + t.rightJustified (66, '-'); + ui->decodedTextBrowser->insertText(t); + } + write_all("Tx",m_currentMessage); + if(m_position != 0) ui->decodedTextBrowser->horizontalScrollBar()->setValue(m_position); + } + } +} + +void MainWindow::stopTx() +{ + if (m_tci_audio) Q_EMIT m_config.transceiver_modulator_stop(); + else Q_EMIT endTransmitMessage (); + m_btxok = false; + m_transmitting = false; + g_iptt=0; + if (!m_tx_watchdog) { + tx_status_label.setStyleSheet(""); + tx_status_label.setText(""); + } + if (m_tci_audio) { + ptt0Timer.start(0); + } else { + ptt0Timer.start(200); //end-of-transmission sequencer delay + monitor (true); + statusUpdate (); + } +} + +void MainWindow::stopTx2() +{ + if (m_tci_audio) { + Q_EMIT m_config.transceiver_ptt (false); //Lower PTT + monitor (true); + statusUpdate (); + } else { + m_config.transceiver_ptt (false); //Lower PTT + } + if (m_mode == "JT9" && m_bFast9 + && ui->cbAutoSeq->isVisible () && ui->cbAutoSeq->isEnabled () && ui->cbAutoSeq->isChecked () + && m_ntx == 5 && m_nTx73 >= 5) { + on_stopTxButton_clicked (); + m_nTx73 = 0; + } + if(((m_mode=="WSPR" or m_mode=="FST4W") and m_ntr==-1) and !m_tuneup) { + m_wideGraph->setWSPRtransmitted(); + WSPR_scheduling (); + m_ntr=0; + } + keep_last_tx_label = true; + last_tx_label.setText(tr ("Last Tx: %1").arg (m_currentMessage.trimmed())); +} + +void MainWindow::ba2msg(QByteArray ba, char message[]) //ba2msg() +{ + int iz=ba.length(); + for(int i=0; i<37; i++) { + if(i<iz) { + if(int(ba[i])>=97 and int(ba[i])<=122) ba[i]=int(ba[i])-32; + message[i]=ba[i]; + } else { + message[i]=32; + } + } + message[37]=0; +} + +void MainWindow::on_txFirstCheckBox_stateChanged(int nstate) //TxFirst +{ + m_txFirst = (nstate==2); +} + +void MainWindow::set_dateTimeQSO(int m_ntx) +{ + // m_ntx = -1 resets to default time + // Our QSO start time can be fairly well determined from Tx 2 and Tx 3 -- the grid reports + // If we CQ'd and sending sigrpt then 2 minutes ago n=2 + // If we're on msg 3 then 3 minutes ago n=3 -- might have sat on msg1 for a while + // If we've already set our time on just return. + // This should mean that Tx2 or Tx3 has been repeated so don't update the start time + // We reset it in several places + if (m_ntx == -1) { // we use a default date to detect change + m_dateTimeQSOOn = QDateTime {}; + } + else if (m_dateTimeQSOOn.isValid ()) { + return; + } + else { // we also take of m_TRperiod/2 to allow for late clicks + auto now = QDateTime::currentDateTimeUtc(); + m_dateTimeQSOOn = now.addSecs (-(m_ntx - 2) * int(m_TRperiod) - + int(fmod(double(now.time().second()),m_TRperiod))); + } +} + +void MainWindow::set_ntx(int n) //set_ntx() +{ + m_ntx=n; +} + +void MainWindow::on_txrb1_toggled (bool status) +{ + if (status) { + if (ui->tx1->isEnabled ()) { + m_ntx = 1; + set_dateTimeQSO (-1); // we reset here as tx2/tx3 is used for start times + } + else { + QTimer::singleShot (0, ui->txrb2, SLOT (click ())); + } + } +} + +bool MainWindow::elide_tx1_not_allowed () const +{ + auto const& my_callsign = m_config.my_callsign (); + return + (m_mode=="FT8" && SpecOp::HOUND == m_specOp) + || ((m_mode.startsWith ("FT") || "MSK144" == m_mode || "Q65" == m_mode || "FST4" == m_mode) + && Radio::is_77bit_nonstandard_callsign (my_callsign)) + || (my_callsign != m_baseCall && !shortList (my_callsign)); +} + +void MainWindow::on_txrb1_doubleClicked () +{ + ui->tx1->setEnabled (elide_tx1_not_allowed () || !ui->tx1->isEnabled ()); + if (!ui->tx1->isEnabled ()) { + // leave time for clicks to complete before setting txrb2 + QTimer::singleShot (500, ui->txrb2, SLOT (click ())); + } +} + +void MainWindow::on_txrb2_toggled (bool status) +{ + // Tx 2 means we already have CQ'd so good reference + if (status) { + m_ntx=2; + set_dateTimeQSO (m_ntx); + } +} + +void MainWindow::on_txrb3_toggled(bool status) +{ + // Tx 3 means we should have already have done Tx 1 so good reference + if (status) { + m_ntx=3; + set_dateTimeQSO(m_ntx); + } +} + +void MainWindow::on_txrb4_toggled (bool status) +{ + if (status) { + m_ntx=4; + } +} + +void MainWindow::on_txrb4_doubleClicked () +{ + // RR73 only allowed if not a type 2 compound callsign + auto const& my_callsign = m_config.my_callsign (); + auto is_compound = my_callsign != m_baseCall; + m_send_RR73 = !((is_compound && !shortList (my_callsign)) || m_send_RR73); + if(m_mode=="FT4") m_send_RR73=true; + genStdMsgs (m_rpt); +} + +void MainWindow::on_txrb5_toggled (bool status) +{ + if (status) { + m_ntx = 5; + } +} + +void MainWindow::on_txrb5_doubleClicked () +{ + genStdMsgs (m_rpt, true); +} + +void MainWindow::on_txrb6_toggled(bool status) +{ + if (status) { + m_ntx=6; + if (ui->txrb6->text().contains (QRegularExpression {"^(CQ|QRZ) "})) set_dateTimeQSO(-1); + } + if(m_mode=="MSK144" && !keep_msk144_frequency && m_msk144basefreq > 0 && !programStart && !m_band_changed) { + setRig(m_msk144basefreq); // reset MSK144 QSY + msk144qsy = false; + } +} + +void MainWindow::on_txb1_clicked() +{ + if (ui->tx1->isEnabled ()) { + m_ntx=1; + m_QSOProgress = REPLYING; + ui->txrb1->setChecked(true); + if(m_transmitting) m_restart=true; + } + else { + on_txb2_clicked (); + } +} + +void MainWindow::on_txb1_doubleClicked() +{ + ui->tx1->setEnabled (elide_tx1_not_allowed () || !ui->tx1->isEnabled ()); +} + +void MainWindow::on_txb2_clicked() +{ + m_ntx=2; + m_QSOProgress = REPORT; + ui->txrb2->setChecked(true); + if(m_transmitting) m_restart=true; +} + +void MainWindow::on_txb3_clicked() +{ + m_ntx=3; + m_QSOProgress = ROGER_REPORT; + ui->txrb3->setChecked(true); + if(m_transmitting) m_restart=true; +} + +void MainWindow::on_txb4_clicked() +{ + m_ntx=4; + m_QSOProgress = ROGERS; + ui->txrb4->setChecked(true); + if(m_transmitting) m_restart=true; +} + +void MainWindow::on_txb4_doubleClicked() +{ + // RR73 only allowed if not a type 2 compound callsign + auto const& my_callsign = m_config.my_callsign (); + auto is_compound = my_callsign != m_baseCall; + m_send_RR73 = !((is_compound && !shortList (my_callsign)) || m_send_RR73); + if(m_mode=="FT4") m_send_RR73=true; + genStdMsgs (m_rpt); +} + +void MainWindow::on_txb5_clicked() +{ + m_ntx=5; + m_QSOProgress = SIGNOFF; + ui->txrb5->setChecked(true); + if(m_transmitting) m_restart=true; +} + +void MainWindow::on_txb5_doubleClicked() +{ + genStdMsgs (m_rpt, true); +} + +void MainWindow::on_txb6_clicked() +{ + m_ntx=6; + m_QSOProgress = CALLING; + set_dateTimeQSO(-1); + ui->txrb6->setChecked(true); + if(m_transmitting) m_restart=true; + if(m_mode=="MSK144" && !keep_msk144_frequency && m_msk144basefreq > 0 && !programStart && !m_band_changed) { + setRig(m_msk144basefreq); // reset MSK144 QSY + msk144qsy = false; + } +} + +void MainWindow::doubleClickOnCall2(Qt::KeyboardModifiers modifiers) +{ +//Confusing: come here after double-click on left text window, not right window. + m_decodedText2=true; + doubleClickOnCall(modifiers); + m_decodedText2=false; +} + +void MainWindow::doubleClickOnCall(Qt::KeyboardModifiers modifiers) +{ + m_bMyCallStd=stdCall(m_config.my_callsign()); //ft8md + m_bHisCallStd=stdCall(m_hisCall); //ft8md + set_dateTimeQSO(-1); // reset our QSO start time + QTextCursor cursor; + if(m_mode=="FST4W") { + MessageBox::information_message (this, + "Double-click not available for FST4W mode"); + return; + } + if(m_decodedText2) { + cursor=ui->decodedTextBrowser->textCursor(); + } else { + cursor=ui->decodedTextBrowser2->textCursor(); + } + DecodedText message {cursor.block().text().trimmed().left(61).remove("TU; ")}; + if(SpecOp::HOUND==m_specOp && (message.string().mid(4,2).contains("15") or message.string().mid(4,2).contains("45"))) return; // ignore stations calling in the wrong time slot +// if(message.string().contains(";") && message.string().contains("<")) { +// QVector<qint32> Freq = {1840000,3573000,7074000,10136000,14074000,18100000,21074000,24915000,28074000,50313000,70154000,3575000,7047500,10140000,14080000,18104000,21140000,24919000,28180000,50318000}; +// for(int i=0; i<Freq.length()-1; i++) { +// int kHzdiff=m_freqNominal - Freq[i]; +// if(qAbs(kHzdiff) < 3000 ) { +// m_bTxTime=false; +// if (m_auto) auto_tx_mode (false); +// if (m_tune) stop_tuning(); +// auto const& msg2 = tr("Double-clicking on combined messages\n" +// "not allowed on the standard sub-bands."); +// QTimer::singleShot (0, [=] { // don't block guiUpdate +// MessageBox::warning_message (this, tr ("Potential hash collision"), msg2); +// }); +// return; +// } +// } +// } + if(modifiers==(Qt::ShiftModifier + Qt::ControlModifier + Qt::AltModifier)) { + //### What was the purpose of this ??? ### + cursor.setPosition(0); + } else { + cursor.setPosition(cursor.selectionStart()); + } + if(SpecOp::FOX==m_specOp and m_decodedText2) { + if(m_houndQueue.count()<10 and m_nSortedHounds>0) { + QString t=cursor.block().text(); + selectHound(t, modifiers==(Qt::AltModifier)); // alt double-click gets put at top of queue + } + return; + } + int nmod = fmod(double(message.timeInSeconds()),2.0*m_TRperiod); + if(ui->txFirstCheckBox->isVisible() && !ui->txFirstCheckBox->isEnabled() && ( + (nmod!=0 && !ui->txFirstCheckBox->isChecked()) or + (nmod==0 && ui->txFirstCheckBox->isChecked()))) { + auto const& msg = tr("This station transmits in the same time slot as you do.\n\n" + "You must not start a QSO if both stations Tx even/1st\n" + "or Tx odd/2nd, while the Tx even/1st checkbox is disabled.\n\n" + "Click the MSK144 mode button to re-enable the Tx even/1st\n" + "checkbox, or choose another station."); + if(m_mode=="MSK144") MessageBox::warning_message (this, msg); + return; // don't allow a QSO when both stations Tx 1st or Tx 2nd, and the Tx 1st checkbox is frozen + } else { + m_muted = true; // Don't play alert sounds again + m_bDoubleClicked = true; + m_hisCall0 = m_hisCall; + processMessage (message, modifiers); + // pressing ALT while double-clicking on a call only adds the callsign to DX Call Box + if(SpecOp::FOX!=m_specOp && modifiers==Qt::AltModifier) { + m_bDoubleClicked = false; + if (m_auto) auto_tx_mode (false); + } + // MSK144 QSY: set RF freq so next received MSK144 signal is at 1500 Hz + if(m_mode=="MSK144" && message.frequencyOffset() > 0 && (modifiers==Qt::ControlModifier or modifiers==(Qt::ControlModifier+Qt::AltModifier))) { + Frequency dial_frequency = m_msk144basefreq + (message.frequencyOffset() - 1500); + keep_msk144_frequency = true; + monitor (true); + setRig(dial_frequency); + ui->labDialFreq->setText (Radio::pretty_frequency_MHz_string (dial_frequency)); + msk144qsy = true; + if(modifiers==Qt::AltModifier or modifiers==(Qt::ControlModifier+Qt::AltModifier)) { + m_bDoubleClicked = false; + if (m_auto) auto_tx_mode (false); + } + keep_msk144_frequency = false; + } + m_muted = false; + } +} + +void MainWindow::processMessage (DecodedText const& message, Qt::KeyboardModifiers modifiers) +{ + // decode keyboard modifiers we are interested in + auto shift = modifiers.testFlag (Qt::ShiftModifier); + auto ctrl = modifiers.testFlag (Qt::ControlModifier); + auto auto_seq = ui->cbAutoSeq->isVisible () && ui->cbAutoSeq->isEnabled () && ui->cbAutoSeq->isChecked (); + // basic mode sanity checks + auto const& parts = message.clean_string ().split (' ', SkipEmptyParts); + if (parts.size () < 5) return; + + auto const& mode = parts.at (4).left (1); + if (("JT65" == m_mode && mode != "#") + || ("JT9" == m_mode && mode != "@") + || ("MSK144" == m_mode && !("&" == mode || "^" == mode)) + || ("Q65" == m_mode && mode.left (1) != ":")) { + return; //Currently we do auto-sequencing only in FT4, FT8, MSK144, FST4, and Q65 + } + + //Skip the rest if no decoded text extracted + int frequency = message.frequencyOffset(); + if (message.isTX()) { + if (!m_config.enable_VHF_features()) { + if(!shift) ui->RxFreqSpinBox->setValue(frequency); //Set Rx freq + if((ctrl or shift) and !ui->cbHoldTxFreq->isChecked ()) { + ui->TxFreqSpinBox->setValue(frequency); //Set Tx freq + } + } + return; + } + + // check for CQ with listening frequency + if (parts.size () >= 7 + && m_bFastMode + && "CQ" == parts[5] + && m_config.is_transceiver_online ()) { + bool ok; + auto kHz = parts[6].toUInt (&ok); + if (ok && kHz >= 10 && 3 == parts[6].size ()) { + // QSY Freq for answering CQ nnn + setRig (m_freqNominal / 1000000 * 1000000 + 1000 * kHz); + ui->decodedTextBrowser2->displayQSY (QString {"QSY %1"}.arg (m_freqNominal / 1e6, 7, 'f', 3)); + if(m_mode=="MSK144") m_msk144basefreq = m_freqNominal / 1000000 * 1000000 + 1000 * kHz; // MSK144 QSY + } + } + + int nmod = fmod(double(message.timeInSeconds()),2.0*m_TRperiod); + m_txFirst=(nmod!=0); + if(SpecOp::HOUND == m_specOp) m_txFirst=false; //Hound must not transmit first + if(SpecOp::FOX == m_specOp) m_txFirst=true; //Fox must always transmit first + ui->txFirstCheckBox->setChecked(m_txFirst); + + auto const& message_words = message.messageWords (); + if (message_words.size () < 3) return; + + QString hiscall; + QString hisgrid; + message.deCallAndGrid(/*out*/hiscall,hisgrid); + + // prevent starting a QSO with yourself + if (m_bDoubleClicked && hiscall==m_baseCall) return; + + // don't call CQ when double-clicking on the final "73" message of your QSO + if (m_bDoubleClicked && message.clean_string().remove("<").remove(">").contains((" " + m_baseCall + " ")) + && message.clean_string().remove("<").remove(">").contains(" " + hiscall + " ") && message.clean_string().mid(22).contains(" 73")) return; + + if(message.clean_string ().contains(hiscall+"/R")) { + hiscall+="/R"; + ui->dxCallEntry->setText(hiscall); + } + if(message.clean_string ().contains(hiscall+"/P")) { + hiscall+="/P"; + ui->dxCallEntry->setText(hiscall); + } + + QStringList w=message.clean_string ().mid(22).remove("<").remove(">").split(" ",SkipEmptyParts); + int nw=w.size(); + if(nw>=4) { + if(message_words.size()<4) return; + int n=w.at(nw-2).toInt(); + if(n>=520001 and n<=592047) { + hiscall=w.at(1); + hisgrid=w.at(nw-1); + } + } + + bool is_73 = message_words.filter (QRegularExpression {"^(73|RR73)$"}).size (); + if (!is_73 and !message.isStandardMessage() and !message.clean_string ().contains("<")) { + qDebug () << "Not processing message - hiscall:" << hiscall << "hisgrid:" << hisgrid + << message.clean_string () << message.isStandardMessage(); + return; + } + + if ((message.isJT9 () and m_mode != "JT9" and m_mode != "JT4") or + (message.isJT65 () and m_mode != "JT65" and m_mode != "JT4")) { + // We are not allowing mode change, so don't process decode + return; + } + + // ignore calls by other hounds + if (SpecOp::HOUND == m_specOp + && message.messageWords ().indexOf (QRegularExpression {R"(R\+-[0-9]+)"}) >= 1) + { + return; + } + + QString firstcall = message.call(); + if(firstcall.length()>=4 and firstcall.mid(0,3)=="CQ ") firstcall="CQ"; + if(!m_bFastMode and (!m_config.enable_VHF_features() or m_mode=="FT8" or m_mode=="FT4" or m_mode=="FST4")) { + // Don't change Tx freq if in a fast mode, or VHF features enabled; also not if a + // station is calling me, unless CTRL or SHIFT is held down. + if ((Radio::is_callsign (firstcall) + && firstcall != m_config.my_callsign () && firstcall != m_baseCall + && firstcall != "DE") + || "CQ" == firstcall || "QRZ" == firstcall || ctrl || shift) { + if (((SpecOp::HOUND != m_specOp) || m_mode != "FT8") + && (!ui->cbHoldTxFreq->isChecked () || shift || ctrl)) { + ui->TxFreqSpinBox->setValue(frequency); + } + if(m_mode != "JT4" && m_mode != "JT65" && !m_mode.startsWith ("JT9") && + m_mode != "Q65" && m_mode!="FT8" && m_mode!="FT4" && m_mode!="FST4") { + return; + } + } + } + + // prior DX call (possible QSO partner) + auto qso_partner_base_call = Radio::base_callsign (ui->dxCallEntry->text ()); + auto base_call = Radio::base_callsign (hiscall); + +// Determine appropriate response to received message + auto dtext = " " + message.clean_string () + " "; + dtext=dtext.remove("<").remove(">"); + if(dtext.contains (" " + m_baseCall + " ") + || dtext.contains ("<" + m_baseCall + "> ") +//###??? || dtext.contains ("<" + m_baseCall + " " + hiscall + "> ") + || dtext.contains ("/" + m_baseCall + " ") + || dtext.contains (" " + m_baseCall + "/") + || (firstcall == "DE")) { + + QString w2; + int nw=w.size(); + if(nw>=3) w2=w.at(2); + int nrpt=w2.toInt(); + QString w34; + if(nw>=4) { +// w34=w.at(nw-2); + nrpt=w.at(nw-2).toInt(); + w34=w.at(nw-1); + } + bool bRTTY = (nrpt>=529 and nrpt<=599); + bool bEU_VHF_w2=(nrpt>=520001 and nrpt<=594000); + if(bEU_VHF_w2 and SpecOp::EU_VHF!=m_specOp) { + auto const& msg = tr("Should you switch to EU VHF Contest mode?\n\n" + "To do so, check 'Special operating activity' and\n" + "'EU VHF Contest' on the Settings | Advanced tab."); + MessageBox::information_message (this, msg); + } + + QStringList t=message.clean_string ().split(' ', SkipEmptyParts); + int n=t.size(); + QString t0=t.at(n-2); + QString t1=t0.right(1); + bool bFieldDay_msg = (t1>="A" and t1<="F" and t0.size()<=3 and n>=9); + int m=t0.remove(t1).toInt(); + if(m < 1) bFieldDay_msg=false; + if(bFieldDay_msg) { + m_xRcvd=t.at(n-2) + " " + t.at(n-1); + t0=t.at(n-3); + } + if(bFieldDay_msg and SpecOp::FIELD_DAY!=m_specOp) { + // ### Should be in ARRL Field Day mode ??? ### + MessageBox::information_message (this, tr ("Should you switch to ARRL Field Day mode?")); + } + + if(bRTTY and SpecOp::RTTY != m_specOp) { + // ### Should be in RTTY contest mode ??? ### + MessageBox::information_message (this, tr ("Should you switch to RTTY contest mode?")); + } + + // This is necessary to prevent crashes caused by double-clicking messages with <...> in certain QSO situations. + if((SpecOp::EU_VHF==m_specOp or SpecOp::RTTY==m_specOp or SpecOp::FIELD_DAY==m_specOp) + and message.string().contains("<...>")) return; + + if(SpecOp::EU_VHF==m_specOp and message_words.at(2).contains(m_baseCall) and + (!message_words.at(3).contains(qso_partner_base_call)) and (!m_bDoubleClicked)) { + return; + } + + bool bContestOK=(m_mode=="FT4" or m_mode=="FT8" or m_mode=="Q65" or m_mode=="MSK144"); + if(message_words.size () > 4 // enough fields for a normal message + && (message_words.at(2).contains(m_baseCall) || "DE" == message_words.at(2)) + && (message_words.at(3).contains(qso_partner_base_call) or m_bDoubleClicked + or bEU_VHF_w2 or (m_QSOProgress==CALLING))) { + if(message_words.at(4).contains(grid_regexp) and SpecOp::EU_VHF!=m_specOp) { + if((SpecOp::NA_VHF==m_specOp or SpecOp::WW_DIGI==m_specOp or + SpecOp::ARRL_DIGI==m_specOp or SpecOp::Q65_PILEUP==m_specOp) + and bContestOK) { + setTxMsg(3); + m_QSOProgress=ROGER_REPORT; + // FT4 NS (NCCC Sprints): Log QSO after sending "hiscall mycall R mygrid" + if (SpecOp::NA_VHF==m_specOp && m_mode=="FT4" && m_config.NCCC_Sprint()) { + if (m_auto && (m_config.prompt_to_log() || m_config.autoLog())) logQSOTimer.start(0); + QTimer::singleShot (int(850.0*m_TRperiod), [=] { + auto_tx_mode(false); + if (m_auto) ui->autoButton->click(); + }); + if (m_config.prompt_to_log() || m_config.autoLog()) { // prevent dupe logbook entries + no_logging = true; + QTimer::singleShot (20000, [=] {no_logging = false;}); + } + } + } else { + if(m_mode=="JT65" and message_words.size()>5 and message_words.at(5)=="OOO") { + setTxMsg(3); + m_QSOProgress=ROGER_REPORT; + } else { + setTxMsg(2); + m_QSOProgress=REPORT; + } + } + } else if(w34.contains(grid_regexp) and SpecOp::EU_VHF==m_specOp) { + + if(nrpt==0) { + setTxMsg(2); + m_QSOProgress=REPORT; + } else { + if(w2=="R") { + setTxMsg(4); + m_QSOProgress=ROGERS; + } else { + setTxMsg(3); + m_QSOProgress=ROGER_REPORT; + } + } + } else if(SpecOp::RTTY == m_specOp and bRTTY) { + if(w2=="R") { + setTxMsg(4); + m_QSOProgress=ROGERS; + } else { + setTxMsg(3); + m_QSOProgress=ROGER_REPORT; + } + m_xRcvd=t[n-2] + " " + t[n-1]; + } else if(SpecOp::FIELD_DAY==m_specOp and bFieldDay_msg) { + if(t0=="R") { + setTxMsg(4); + m_QSOProgress=ROGERS; + } else { + setTxMsg(3); + m_QSOProgress=ROGER_REPORT; + } + } else { // no grid on end of msg + auto const& word_3 = message_words.at (4); + auto word_3_as_number = word_3.toInt (); + if (("RRR" == word_3 + || (word_3_as_number == 73 && ROGERS == m_QSOProgress) + || "RR73" == word_3 + || ("R" == word_3 && m_QSOProgress != REPORT))) { + if(m_mode=="FT4" and "RR73" == word_3) m_dateTimeRcvdRR73=QDateTime::currentDateTimeUtc(); + m_bTUmsg=false; + m_nextCall=""; //### Temporary: disable use of "TU;" message + if(SpecOp::RTTY == m_specOp and m_nextCall!="") { + // We're in RTTY contest and have "nextCall" queued up: send a "TU; ..." message + if (m_config.prompt_to_log() || m_config.autoLog()) { + logQSOTimer.start(0); + } + else { + cease_auto_Tx_after_QSO (); + } + ui->tx3->setText(ui->tx3->text().remove("TU; ")); + useNextCall(); + QString t="TU; " + ui->tx3->text(); + ui->tx3->setText(t); + m_bTUmsg=true; + } else { + if (false) // Always Send 73 after receiving RRR or RR73, even in contest mode. + { + if (m_config.prompt_to_log() || m_config.autoLog()) { + if (!(m_mode=="FT4" && SpecOp::NA_VHF==m_specOp && m_config.NCCC_Sprint())) logQSOTimer.start(0); + } + else { + cease_auto_Tx_after_QSO (); + } + m_ntx=6; + ui->txrb6->setChecked(true); + } + else if (word_3.contains (QRegularExpression {"^R(?!R73|RR)"}) + && m_QSOProgress != ROGER_REPORT) + { + m_ntx=4; + ui->txrb4->setChecked(true); + } + else if ((m_QSOProgress > CALLING && m_QSOProgress < ROGERS) + || word_3.contains (QRegularExpression {"^RR(?:R|73)$"})) + { + m_ntx=5; + ui->txrb5->setChecked(true); + } + else if (ROGERS == m_QSOProgress) + { + if (m_config.prompt_to_log() || m_config.autoLog()) { + if (!(m_mode=="FT4" && SpecOp::NA_VHF==m_specOp && m_config.NCCC_Sprint())) logQSOTimer.start(0); + } + else { + cease_auto_Tx_after_QSO (); + } + if ((m_mode=="MSK144" or (m_mode=="Q65" && m_config.repeat_Tx())) && !m_send_RR73) { // ensure that 73 is sent when using RRR + ui->txrb5->click(); + QTimer::singleShot (int(1000*m_TRperiod), [=] {m_auto=false;}); + } else { + m_ntx=6; + ui->txrb6->setChecked(true); + } + } + else + { + // just work them (again) + if (ui->tx1->isEnabled ()) { + m_ntx = 1; + m_QSOProgress = REPLYING; + ui->txrb1->setChecked (true); + } else { + m_ntx=2; + m_QSOProgress = REPORT; + ui->txrb2->setChecked (true); + } + } + } + if (m_QSOProgress >= ROGER_REPORT) + { + m_QSOProgress = SIGNOFF; + } + } else if((m_QSOProgress >= REPORT + || (m_QSOProgress >= REPLYING && + (m_mode=="MSK144" or m_mode=="FT8" or m_mode=="FT4" || "Q65" == m_mode))) + && word_3.startsWith ('R')) { + m_ntx=4; + m_QSOProgress = ROGERS; + if(SpecOp::RTTY == m_specOp) { + int n=t.size(); + int nRpt=t[n-2].toInt(); + if(nRpt>=529 and nRpt<=599) m_xRcvd=t[n-2] + " " + t[n-1]; + } + ui->txrb4->setChecked(true); + } else if (m_QSOProgress >= CALLING) + { + if ((word_3_as_number >= -50 && word_3_as_number <= 49) + || (word_3_as_number >= 529 && word_3_as_number <= 599)) + { + if(SpecOp::EU_VHF==m_specOp or + SpecOp::FIELD_DAY==m_specOp or + SpecOp::RTTY==m_specOp) + { + setTxMsg(2); + m_QSOProgress=REPORT; + } + else + { + if (word_3.startsWith ("R-") || word_3.startsWith ("R+")) + { + setTxMsg(4); + m_QSOProgress=ROGERS; + } + else + { + setTxMsg (3); + m_QSOProgress = ROGER_REPORT; + } + } + } + } + else + { // nothing for us + return; + } + } + } + else if (5 == message_words.size () + && m_baseCall == message_words.at (1)) { + // dual Fox style message, possibly from MSHV + if (m_config.prompt_to_log() || m_config.autoLog()) { + logQSOTimer.start(0); + } + else { + cease_auto_Tx_after_QSO (); + } + m_ntx=6; + ui->txrb6->setChecked(true); + } + else if (m_QSOProgress >= ROGERS + && message_words.size () > 3 && message_words.at (2).contains (m_baseCall) + && message_words.at (3) == "73") { + // 73 back to compound call holder + m_ntx=5; + ui->txrb5->setChecked(true); + m_QSOProgress = SIGNOFF; + } + else if (!(m_bAutoReply && (m_QSOProgress > CALLING))) { + if ((message_words.size () > 5 && message_words.at (2).contains (m_baseCall) + && message_words.at (5) == "OOO")) { + // EME short code report or MSK144/FT8 contest mode reply, send back Tx3 + m_ntx=3; + m_QSOProgress = ROGER_REPORT; + ui->txrb3->setChecked (true); + } else if (!is_73) { // don't respond to sign off messages + m_ntx=2; + m_QSOProgress = REPORT; + ui->txrb2->setChecked(true); + if (m_bDoubleClickAfterCQnnn and m_transmitting) { + on_stopTxButton_clicked(); + TxAgainTimer.start(1500); + } + m_bDoubleClickAfterCQnnn=false; + } + else { + return; // nothing we need to respond to + } + } + else { // nothing for us + return; + } + } + else if (firstcall == "DE" && message_words.size () > 4 && message_words.at (4) == "73") { + if (m_QSOProgress >= ROGERS && base_call == qso_partner_base_call && m_currentMessageType) { + // 73 back to compound call holder + m_ntx=5; + ui->txrb5->setChecked(true); + m_QSOProgress = SIGNOFF; + } else { + // treat like a CQ/QRZ + if (ui->tx1->isEnabled ()) { + m_ntx = 1; + m_QSOProgress = REPLYING; + ui->txrb1->setChecked (true); + } else { + m_ntx=2; + m_QSOProgress = REPORT; + ui->txrb2->setChecked (true); + } + } + } + else if (is_73 && !message.isStandardMessage ()) { + m_ntx=5; + ui->txrb5->setChecked(true); + m_QSOProgress = SIGNOFF; + } else if (!(m_auto && m_ntx == 3 && message.string().contains("73 "))) { // don't interrupt Tx3 transmissions + // just work them + if (ui->tx1->isEnabled ()) { + m_ntx = 1; + m_QSOProgress = REPLYING; + ui->txrb1->setChecked (true); + } else { + m_ntx=2; + m_QSOProgress = REPORT; + ui->txrb2->setChecked (true); + } + } + // if we get here then we are reacting to the message + if (m_bAutoReply) m_bCallingCQ = CALLING == m_QSOProgress; + m_maxPoints=-1; + if (ui->RxFreqSpinBox->isEnabled () and m_mode != "MSK144" and !shift) { + ui->RxFreqSpinBox->setValue (frequency); //Set Rx freq + } + + QString s1 = m_QSOText.trimmed (); + QString s2 = message.clean_string ().trimmed(); + if (s1!=s2 and !message.isTX()) { + // insert blank line in decodedTextBrowser2 when band was changed for MSK144 + if (m_mode=="MSK144" && m_config.insert_blank () && m_band_changed && (m_currentBandPeriod == m_currentBand) && !BlankLineInserted) { + if (ui->actionUse_Dark_Style->isChecked()) { + ui->decodedTextBrowser2->insertText(("------------------- " + m_currentBandPeriod + " -----------------"), "#a2a2a2", "#000000"); + } else { + ui->decodedTextBrowser2->insertLineSpacer ("------------------- " + m_currentBandPeriod + " -----------------"); + } + BlankLineInserted = true; + m_band_changed = false; + } + if (!s2.contains(m_baseCall) or m_mode=="MSK144") { // Taken care of elsewhere if for_us and slow mode + ui->decodedTextBrowser2->displayDecodedText (message, m_config.my_callsign (), m_mode, m_config.DXCC (), + m_logBook, m_currentBand, m_config.ppfx (), false, false, 0.0, false, -99, "", m_muted); + } + m_QSOText = s2; + } + + if (Radio::is_callsign (hiscall) + && (base_call != qso_partner_base_call || base_call != hiscall)) { + if (qso_partner_base_call != base_call) { + // clear the DX grid if the base call of his call is different + // from the current DX call + ui->dxGridEntry->clear (); + } + // his base call different or his call more qualified + // i.e. compound version of same base call + if (!((s2.contains(" " + m_config.my_callsign() + " ") && s2.mid(22).contains(" 73")) && (ui->respondComboBox->currentText()=="CQ: Max dB" + or ui->respondComboBox->currentText()=="CQ: Max dB"))) ui->dxCallEntry->setText (hiscall); + } + if (hisgrid.contains (grid_regexp)) { + if(ui->dxGridEntry->text().mid(0,4) != hisgrid) ui->dxGridEntry->setText(hisgrid); + } + lookup(); + m_hisGrid = ui->dxGridEntry->text(); + + if (m_bDoubleClicked) + { + // extract our report if present + message.report (m_baseCall, Radio::base_callsign(ui->dxCallEntry->text()), m_rptRcvd); + } + + if (!m_bSentReport || base_call != qso_partner_base_call || m_mode == "FT8" || m_mode == "FT4" + || m_mode == "FST4") // Change report within a QSO + { + auto n = message.report ().toInt (); + if(m_mode=="MSK144" and m_bShMsgs) { + if(n<=-2) n=-3; + if(n>=-1 and n<=1) n=0; + if(n>=2 and n<=4) n=3; + if(n>=5 and n<=7) n=6; + if(n>=8 and n<=11) n=10; + if(n>=12 and n<=14) n=13; + if(n>=15) n=16; + } + ui->rptSpinBox->setValue (n); + } +// Don't genStdMsgs if we're already sending 73, or a "TU; " msg is queued. + m_bTUmsg=false; //### Temporary: disable use of "TU;" messages + if (!m_nTx73 and !m_bTUmsg) { + genStdMsgs (QString::number (ui->rptSpinBox->value ())); + } + if(m_transmitting) m_restart=true; + if (auto_seq && !m_bDoubleClicked && m_mode!="FT4") { + return; + } + if(m_config.quick_call() && m_bDoubleClicked) auto_tx_mode(true); + m_bDoubleClicked=false; + +} + +void MainWindow::setTxMsg(int n) +{ + m_ntx=n; + if(n==1) ui->txrb1->setChecked(true); + if(n==2) ui->txrb2->setChecked(true); + if(n==3) ui->txrb3->setChecked(true); + if(n==4) ui->txrb4->setChecked(true); + if(n==5) ui->txrb5->setChecked(true); + if(n==6) ui->txrb6->setChecked(true); +} + +void MainWindow::genCQMsg () +{ + auto const& my_callsign = m_config.my_callsign (); + auto is_compound = my_callsign != m_baseCall; + auto is_type_two = !is77BitMode () && is_compound && stdCall (m_baseCall) && !shortList (my_callsign); + if(my_callsign.size () && m_config.my_grid().size ()) { + auto const& grid = m_config.my_grid (); + if (ui->cbCQTx->isEnabled () && ui->cbCQTx->isVisible () && ui->cbCQTx->isChecked ()) { + if(stdCall (my_callsign) + || is_type_two) { + msgtype (QString {"CQ %1 %2 %3"} + .arg (m_freqNominal / 1000 - m_freqNominal / 1000000 * 1000, 3, 10, QChar {'0'}) + .arg (my_callsign) + .arg (grid.left (4)), + ui->tx6); + } else { + msgtype (QString {"CQ %1 %2"} + .arg (m_freqNominal / 1000 - m_freqNominal / 1000000 * 1000, 3, 10, QChar {'0'}) + .arg (my_callsign), + ui->tx6); + } + } else { + if (stdCall (my_callsign) + || is_type_two) { + msgtype (QString {"%1 %2 %3"}.arg(m_CQtype).arg(my_callsign) + .arg(grid.left(4)),ui->tx6); + } else { + msgtype (QString {"%1 %2"}.arg(m_CQtype).arg(my_callsign),ui->tx6); + } + } + if ((m_mode=="JT4" or m_mode=="Q65") and ui->cbShMsgs->isChecked()) { + if (ui->cbTx6->isChecked ()) { + msgtype ("@1250 (SEND MSGS)", ui->tx6); + } else { + msgtype ("@1000 (TUNE)", ui->tx6); + } + } + + QString t=ui->tx6->text(); + QStringList tlist=t.split(" "); + if((m_mode=="FT4" or m_mode=="FT8" or m_mode=="MSK144" || "Q65" == m_mode) and + SpecOp::NONE != m_specOp and SpecOp::HOUND != m_specOp and SpecOp::Q65_PILEUP != m_specOp and + ( tlist.at(1)==my_callsign or + tlist.at(2)==my_callsign ) and + stdCall(my_callsign)) { + if(m_config.Individual_Contest_Name() && SpecOp::FOX != m_specOp) { + m_cqStr = m_config.Contest_Name(); + } else { + if(SpecOp::NA_VHF == m_specOp) m_cqStr="TEST"; + if(SpecOp::EU_VHF == m_specOp) m_cqStr="TEST"; + if(SpecOp::FIELD_DAY == m_specOp) m_cqStr="FD"; + if(SpecOp::RTTY == m_specOp) m_cqStr="RU"; + if(SpecOp::WW_DIGI == m_specOp) m_cqStr="WW"; + if(SpecOp::ARRL_DIGI == m_specOp) m_cqStr="TEST"; + } + if( tlist.at(1)==my_callsign ) { + t="CQ " + m_cqStr + " " + tlist.at(1) + " " + tlist.at(2); + } else { + t="CQ " + m_cqStr + " " + tlist.at(2) + " " + tlist.at(3); + } + ui->tx6->setText(t); + } + } else { + ui->tx6->clear (); + } +} + +void MainWindow::abortQSO() +{ + bool b=m_auto; + clearDX(); + if(b) auto_tx_mode(false); + ui->txrb6->setChecked(true); +} + +bool MainWindow::stdCall(QString const& w) +{ + static QRegularExpression standard_call_re { + R"( + ^\s* # optional leading spaces + ( [A-Z]{0,2} | [A-Z][0-9] | [0-9][A-Z] ) # part 1 + ( [0-9][A-Z]{0,3} ) # part 2 + (/R | /P)? # optional suffix + \s*$ # optional trailing spaces + )", QRegularExpression::CaseInsensitiveOption | QRegularExpression::ExtendedPatternSyntaxOption}; + return standard_call_re.match (w).hasMatch (); +} + +bool MainWindow::is77BitMode () const +{ + return "FT8" == m_mode || "FT4" == m_mode || "MSK144" == m_mode + || "FST4" == m_mode || "Q65" == m_mode; +} + +void MainWindow::ScrollBarPosition(int n) { + m_position=n; +} + +void MainWindow::genStdMsgs(QString rpt, bool unconditional) +{ + genCQMsg (); + auto const& hisCall=ui->dxCallEntry->text(); + if(!hisCall.size ()) { + ui->labAz->clear (); + ui->tx1->clear (); + ui->tx2->clear (); + ui->tx3->clear (); + ui->tx4->clear (); + if(unconditional && !keepTx5) ui->tx5->lineEdit ()->clear (); //Test if it needs sending again + m_gen_message_is_cq = false; + return; + } + m_hisCall0 = hisCall; + auto const& my_callsign = m_config.my_callsign (); + auto is_compound = my_callsign != m_baseCall; + auto is_type_one = !is77BitMode () && is_compound && shortList (my_callsign); + auto const& my_grid = m_config.my_grid ().left (4); + auto const& hisBase = Radio::base_callsign (hisCall); + save_dxbase_(const_cast <char *> ((hisBase + " ").left(6).toLatin1().constData()), (FCL)6); + auto eme_short_codes = m_config.enable_VHF_features () && ui->cbShMsgs->isChecked () + && m_mode == "JT65"; + + bool bMyCall=stdCall(my_callsign); + bool bHisCall=stdCall(hisCall); + + QString t0=hisBase + " " + m_baseCall + " "; + QString t0s=hisCall + " " + my_callsign + " "; + QString t0a,t0b; + + if (is77BitMode () && bHisCall && bMyCall) t0=hisCall + " " + my_callsign + " "; + t0a="<"+hisCall + "> " + my_callsign + " "; + t0b=hisCall + " <" + my_callsign + "> "; + + QString t00=t0; + QString t {t0 + my_grid}; + if(!bMyCall) t=t0a; + msgtype(t, ui->tx1); + if (eme_short_codes) { + t=t+" OOO"; + if(!bHisCall) t=hisCall + " " + m_baseCall + " OOO"; + if(!bMyCall) t=hisBase + " " + my_callsign + " OOO"; + msgtype(t, ui->tx2); + msgtype("RO", ui->tx3); + msgtype("RRR", ui->tx4); + msgtype("73", ui->tx5->lineEdit()); + } else { + int n=rpt.toInt(); + rpt = rpt.asprintf("%+2.2d",n); + + if (is77BitMode ()) { + QString t2,t3; + QString sent=rpt; + QString rs,rst; + int nn=(n+36)/6; + if(nn<2) nn=2; + if(nn>9) nn=9; + rst = rst.asprintf("5%1d9 ",nn); + rs=rst.mid(0,2); + t=t0; + if(!bMyCall) { + t=t0b; + msgtype(t0a, ui->tx1); + } + if(!bHisCall) { + t=t0a; + msgtype(t0a + my_grid, ui->tx1); + } + if(SpecOp::NA_VHF==m_specOp) sent=my_grid; + if(SpecOp::WW_DIGI==m_specOp) sent=my_grid; + if(SpecOp::ARRL_DIGI==m_specOp) sent=my_grid; + if(SpecOp::Q65_PILEUP==m_specOp) sent=my_grid; + if(SpecOp::FIELD_DAY==m_specOp) sent=m_config.Field_Day_Exchange(); + if(SpecOp::RTTY==m_specOp) { + sent=rst + m_config.RTTY_Exchange(); + QString t1=m_config.RTTY_Exchange(); + if(t1=="DX" or t1=="#") { + t1 = t1.asprintf("%4.4d",ui->sbSerialNumber->value()); + sent=rst + t1; + } + if(t1.contains(QRegularExpression {"\\d\\d\\d\\d"})) { + t1 = m_config.RTTY_Exchange(); + } + } + if(SpecOp::EU_VHF==m_specOp) { + QString a; + t="<" + t0s.split(" ").at(0) + "> <" + t0s.split(" ").at(1) + "> "; + a = a.asprintf("%4.4d ",ui->sbSerialNumber->value()); + sent=rs + a + m_config.my_grid(); + } + msgtype(t + sent, ui->tx2); + if(sent==rpt) msgtype(t + "R" + sent, ui->tx3); + if(sent!=rpt) msgtype(t + "R " + sent, ui->tx3); + if(m_mode=="FT4" and SpecOp::RTTY==m_specOp) { + QDateTime now=QDateTime::currentDateTimeUtc(); + int sinceTx3 = m_dateTimeSentTx3.secsTo(now); + int sinceRR73 = m_dateTimeRcvdRR73.secsTo(now); + if(m_bDoubleClicked and (sinceTx3 < 15) and (sinceRR73 < 3)) { + t="TU; " + ui->tx3->text(); + ui->tx3->setText(t); + } + } + } + + if(m_mode=="MSK144" and m_bShMsgs) { + int i=t0s.length()-1; + t0="<" + t0s.mid(0,i) + "> "; + if(SpecOp::NA_VHF != m_specOp) { + if(n<=-2) n=-3; + if(n>=-1 and n<=1) n=0; + if(n>=2 and n<=4) n=3; + if(n>=5 and n<=7) n=6; + if(n>=8 and n<=11) n=10; + if(n>=12 and n<=14) n=13; + if(n>=15) n=16; + rpt = rpt.asprintf("%+2.2d",n); + } + } + + if (!is77BitMode ()) { + t=(is_type_one ? t0 : t00) + rpt; + msgtype(t, ui->tx2); + t=t0 + "R" + rpt; + msgtype(t, ui->tx3); + } + + if(m_mode=="MSK144" and m_bShMsgs) { + if(m_specOp==SpecOp::NONE) { + t=t0 + "R" + rpt; + msgtype(t, ui->tx3); + } + m_send_RR73=false; + } + + t=t0 + (m_send_RR73 ? "RR73" : "RRR"); + if((m_mode=="MSK144" and !m_bShMsgs) or m_mode=="FT8" or m_mode=="FT4" || m_mode == "FST4" || m_mode == "Q65") { + if(!bHisCall and bMyCall) t=hisCall + " <" + my_callsign + "> " + (m_send_RR73 ? "RR73" : "RRR"); + if(bHisCall and !bMyCall) t="<" + hisCall + "> " + my_callsign + " " + (m_send_RR73 ? "RR73" : "RRR"); + } + if ((m_mode=="JT4" || m_mode=="Q65") && m_bShMsgs) t="@1500 (RRR)"; + msgtype(t, ui->tx4); + + t=t0 + "73"; + if((m_mode=="MSK144" and !m_bShMsgs) or m_mode=="FT8" or m_mode=="FT4" || m_mode == "FST4" || m_mode == "Q65") { + if(!bHisCall and bMyCall) t=hisCall + " <" + my_callsign + "> 73"; + if(bHisCall and !bMyCall) t="<" + hisCall + "> " + my_callsign + " 73"; + } + if (m_mode=="JT4" || m_mode=="Q65") { + if (m_bShMsgs) t="@1750 (73)"; + if (!keepTx5) msgtype(t, ui->tx5->lineEdit()); + } else if ("MSK144" == m_mode && m_bShMsgs) { + if (!keepTx5) msgtype(t, ui->tx5->lineEdit()); + } else if(unconditional || hisBase != m_lastCallsign || !m_lastCallsign.size ()) { + // only update tx5 when forced or callsign changes + if (!keepTx5) msgtype(t, ui->tx5->lineEdit()); + m_lastCallsign = hisBase; + } + } + + if (is77BitMode ()) return; + + if (is_compound) { + if (is_type_one) { + t=hisBase + " " + my_callsign; + msgtype(t, ui->tx1); + } else { + t = "DE " + my_callsign + " "; + switch (m_config.type_2_msg_gen ()) + { + case Configuration::type_2_msg_1_full: + msgtype(t + my_grid, ui->tx1); + if (!eme_short_codes) { + if(is77BitMode () && SpecOp::NA_VHF == m_specOp) { + msgtype(t + "R " + my_grid, ui->tx3); // #### Unreachable code + } else { + msgtype(t + "R" + rpt, ui->tx3); + } + if ((m_mode != "JT4" && m_mode != "Q65") || !m_bShMsgs) { + if (!keepTx5) msgtype(t + "73", ui->tx5->lineEdit ()); + } + } + break; + + case Configuration::type_2_msg_3_full: + if (is77BitMode () && SpecOp::NA_VHF == m_specOp) { + msgtype(t + "R " + my_grid, ui->tx3); + msgtype(t + "RRR", ui->tx4); + } else { + msgtype(t00 + my_grid, ui->tx1); + msgtype(t + "R" + rpt, ui->tx3); + } + if (!eme_short_codes && ((m_mode != "JT4" && m_mode != "Q65") || !m_bShMsgs)) { + if (!keepTx5) msgtype(t + "73", ui->tx5->lineEdit ()); + } + break; + + case Configuration::type_2_msg_5_only: + msgtype(t00 + my_grid, ui->tx1); + if (!eme_short_codes) { + if (is77BitMode () && SpecOp::NA_VHF == m_specOp) { + msgtype(t + "R " + my_grid, ui->tx3); // #### Unreachable code + msgtype(t + "RRR", ui->tx4); + } else { + msgtype(t0 + "R" + rpt, ui->tx3); + } + } + // don't use short codes here as in a sked with a type 2 + // prefix we would never send out prefix/suffix + if (!keepTx5) msgtype(t + "73", ui->tx5->lineEdit ()); + break; + } + } + if (hisCall != hisBase + && m_config.type_2_msg_gen () != Configuration::type_2_msg_5_only + && !eme_short_codes) { + // cfm we have his full call copied as we could not do this earlier + t = hisCall + " 73"; + if (!keepTx5) msgtype(t, ui->tx5->lineEdit ()); + } + } else { + if (hisCall != hisBase and SpecOp::HOUND != m_specOp) { + if (shortList(hisCall)) { + // cfm we know his full call with a type 1 tx1 message + t = hisCall + " " + my_callsign; + msgtype(t, ui->tx1); + } + else if (!eme_short_codes + && ("MSK144" != m_mode || !m_bShMsgs)) { + t=hisCall + " 73"; + if (!keepTx5) msgtype(t, ui->tx5->lineEdit ()); + } + } + } + m_rpt=rpt; + if(SpecOp::HOUND == m_specOp and is_compound) ui->tx1->setText("DE " + my_callsign); +} + +void MainWindow::TxAgain() +{ + auto_tx_mode(true); +} + +void MainWindow::clearDX () +{ + set_dateTimeQSO (-1); + if (m_QSOProgress != CALLING) { + auto_tx_mode (false); + } + ui->dxCallEntry->clear (); + if (m_config.clear_DXgrid () or (SpecOp::HOUND == m_specOp && m_config.superFox())) ui->dxGridEntry->clear (); + if (!keepTx5) ui->tx5->setCurrentText(""); // clear tx5 + if (ui->respondComboBox->isVisible()) { + Dpoints=0; // reset points + maxDPoints=0; // reset points + dBpoints=-28; // reset points + dBpoints2=99; // reset points + maxdBPoints=-28; // reset points + mindBPoints=99; // reset points + } + m_lastCallsign.clear (); + m_rptSent.clear (); + m_rptRcvd.clear (); + m_qsoStart.clear (); + m_qsoStop.clear (); + m_inQSOwith.clear(); + genStdMsgs (QString {}); + if (m_mode=="FT8" and SpecOp::HOUND == m_specOp) { + m_ntx=1; + ui->txrb1->setChecked(true); + m_hisCall = ""; + m_hisCall0 = ""; + } else { + m_ntx=6; + ui->txrb6->setChecked(true); + } + m_QSOProgress = CALLING; +} + +void MainWindow::lookup() +{ + QString hisCall {ui->dxCallEntry->text()}; + QString hisgrid0 {ui->dxGridEntry->text()}; + if (!hisCall.size ()) return; + QFile f {m_config.writeable_data_dir ().absoluteFilePath ("CALL3.TXT")}; + if (f.open (QIODevice::ReadOnly | QIODevice::Text)) + { + char c[132]; + qint64 n=0; + for(int i=0; i<999999; i++) { + n=f.readLine(c,sizeof(c)); + if(n <= 0) { + if(!hisgrid0.contains(grid_regexp)) { + ui->dxGridEntry->clear(); + } + break; + } + QString t=QString(c); + int i1=t.indexOf(","); + if(t.left(i1)==hisCall) { + QString hisgrid=t.mid(i1+1,6); + i1=hisgrid.indexOf(","); + if(i1>0) { + hisgrid=hisgrid.mid(0,4); + } else { + hisgrid=hisgrid.mid(0,6).toUpper(); + } + if(hisgrid.left(4)==hisgrid0.left(4) or (hisgrid0.size()==0)) { + ui->dxGridEntry->setText(hisgrid); + } + break; + } + } + f.close(); + } +} + +void MainWindow::on_lookupButton_clicked() //Lookup button +{ + qint64 ms=QDateTime::currentMSecsSinceEpoch(); + lookup(); + if((ms-m_msErase)<500) { + QString hisCall=ui->dxCallEntry->text(); + if (hisCall !="") QDesktopServices::openUrl (QUrl {"https://www.qrz.com/db/" + hisCall}); + } + m_msErase=ms; +} + +void MainWindow::on_addButton_clicked() //Add button +{ + if(!ui->dxGridEntry->text ().size ()) { + MessageBox::warning_message (this, tr ("Add to CALL3.TXT") + , tr ("Please enter a valid grid locator")); + return; + } + m_call3Modified=false; + QString hisCall=ui->dxCallEntry->text(); + QString hisgrid=ui->dxGridEntry->text(); + QString newEntry=hisCall + "," + hisgrid; + + // int ret = MessageBox::query_message(this, tr ("Add to CALL3.TXT"), + // tr ("Is %1 known to be active on EME?").arg (newEntry)); + // if(ret==MessageBox::Yes) { + // newEntry += ",EME,,"; + // } else { + newEntry += ",,,"; + // } + + QFile f1 {m_config.writeable_data_dir ().absoluteFilePath ("CALL3.TXT")}; + if(!f1.open(QIODevice::ReadWrite | QIODevice::Text)) { + MessageBox::warning_message (this, tr ("Add to CALL3.TXT") + , tr ("Cannot open \"%1\" for read/write: %2") + .arg (f1.fileName ()).arg (f1.errorString ())); + return; + } + if(f1.size()==0) { + QTextStream out(&f1); + out << "ZZZZZZ" +#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0) + << Qt::endl +#else + << endl +#endif + ; + f1.seek (0); + } + QFile f2 {m_config.writeable_data_dir ().absoluteFilePath ("CALL3.TMP")}; + if(!f2.open(QIODevice::ReadWrite | QIODevice::Truncate | QIODevice::Text)) { + MessageBox::warning_message (this, tr ("Add to CALL3.TXT") + , tr ("Cannot open \"%1\" for writing: %2") + .arg (f2.fileName ()).arg (f2.errorString ())); + return; + } + { + QTextStream in(&f1); //Read from CALL3.TXT + QTextStream out(&f2); //Copy into CALL3.TMP + QString hc=hisCall; + QString hc1=""; + QString hc2="000000"; + QString s; + do { + s=in.readLine(); + hc1=hc2; + if(s.mid(0,2)=="//") { + out << s + QChar::LineFeed; //Copy all comment lines + } else { + int i1=s.indexOf(","); + hc2=s.mid(0,i1); + if(hc>hc1 && hc<hc2) { + out << newEntry + QChar::LineFeed; + out << s + QChar::LineFeed; + m_call3Modified=true; + } else if(hc==hc2) { + QString t {tr ("%1\nis already in CALL3.TXT" + ", do you wish to replace it?").arg (s)}; + int ret = MessageBox::query_message (this, tr ("Add to CALL3.TXT"), t); + if(ret==MessageBox::Yes) { + out << newEntry + QChar::LineFeed; + m_call3Modified=true; + } + } else { + if(s!="") out << s + QChar::LineFeed; + } + } + } while(!s.isNull()); + if(hc>hc1 && !m_call3Modified) out << newEntry + QChar::LineFeed; + } + + if(m_call3Modified) { + auto const& old_path = m_config.writeable_data_dir ().absoluteFilePath ("CALL3.OLD"); + QFile f0 {old_path}; + if (f0.exists ()) f0.remove (); + f1.copy (old_path); // copying as we want to + // preserve symlinks + f1.open (QFile::WriteOnly | QFile::Text); // truncates + f2.seek (0); + QByteArray tmp = f2.readAll(); + if (tmp != (const char*)NULL) f1.write (tmp); // copy contents + else qDebug() << "tmp==NULL at f1.write"; + f2.remove (); + } +} + +void MainWindow::on_ignoreButton_clicked() //Ignore button +{ + addCallsignToignoreList(); +} + +void MainWindow::msgtype(QString t, QLineEdit* tx) //msgtype() +{ +// Set background colors of the Tx message boxes, depending on message type + char message[38]; + char msgsent[38]; + QByteArray s=t.toUpper().toLocal8Bit(); + ba2msg(s,message); + int ichk=1,itype=0; + gen65(message, &ichk,msgsent, const_cast<int*>(itone0), &itype); + msgsent[22]=0; + bool text=false; + bool shortMsg=false; + if(itype==6) text=true; + +//### Check this stuff ### + if(itype==7 and m_config.enable_VHF_features() and m_mode=="JT65") shortMsg=true; + if(m_mode=="MSK144" and t.mid(0,1)=="<") text=false; + if((m_mode=="MSK144" or m_mode=="FT8" or m_mode=="FT4" || "Q65" == m_mode) and + SpecOp::NA_VHF==m_specOp) { + int i0=t.trimmed().length()-7; + if(t.mid(i0,3)==" R ") text=false; + } + text=false; +//### ... to here ... + + + QPalette p(tx->palette()); + if(text) { + p.setColor(QPalette::Base,"#ffccff"); //pink + } else { + if(shortMsg) { + p.setColor(QPalette::Base,"#66ffff"); //light blue + } else { + p.setColor(QPalette::Base,Qt::transparent); + if ("MSK144" == m_mode && t.count ('<') == 1) { + p.setColor(QPalette::Base,"#00ffff"); //another light blue + } + } + } + tx->setPalette(p); + + auto pos = tx->cursorPosition (); + tx->setText(t.toUpper()); + tx->setCursorPosition (pos); +} + +void MainWindow::on_tx1_editingFinished() //tx1 edited +{ + if (SpecOp::HOUND==m_specOp && m_config.superFox() && !m_bDoubleClicked) { + clearDX(); + return; + } + QString t=ui->tx1->text(); + msgtype(t, ui->tx1); +} + +void MainWindow::on_tx2_editingFinished() //tx2 edited +{ + QString t=ui->tx2->text(); + msgtype(t, ui->tx2); +} + +void MainWindow::on_tx3_editingFinished() //tx3 edited +{ + if (SpecOp::HOUND==m_specOp && m_config.superFox() && !m_bDoubleClicked) { + clearDX(); + return; + } + QString t=ui->tx3->text(); + msgtype(t, ui->tx3); +} + +void MainWindow::on_tx4_editingFinished() //tx4 edited +{ + QString t=ui->tx4->text(); + msgtype(t, ui->tx4); +} + +void MainWindow::on_tx5_currentTextChanged (QString const& text) //tx5 edited +{ + msgtype(text, ui->tx5->lineEdit ()); +} + +void MainWindow::on_tx6_editingFinished() //tx6 edited +{ + QString t=ui->tx6->text().toUpper(); + if(t.indexOf(" ")>0) { + QString t1=t.split(" ").at(1); + QRegExp AZ4("^[A-Z]{1,4}$"); + QRegExp NN3("^[0-9]{1,3}$"); + m_CQtype="CQ"; + if(t1.size()<=4 and t1.contains(AZ4)) m_CQtype="CQ " + t1; + if(t1.size()<=3 and t1.contains(NN3)) m_CQtype="CQ " + t1; + } + msgtype(t, ui->tx6); +} + +void MainWindow::on_RoundRobin_currentTextChanged(QString text) +{ + ui->sbTxPercent->setEnabled (text == tr ("Random")); +} + +void MainWindow::on_DX_Call_Button_clicked (bool checked) +{ + if((m_mode=="FT8" or m_mode=="FT4" or m_mode=="Q65" or m_mode=="FST4" or m_mode=="MSK144") && + (m_specOp==SpecOp::NONE or m_specOp==SpecOp::HOUND) && ui->cbAutoSeq->isChecked() && checked + && (m_hisCall!="" or (m_mode=="FT8" && m_specOp==SpecOp::HOUND))) { + wait_and_call = true; // toggle Wait & Call on when allowed + } else { + wait_and_call = false; // toggle Wait & Call off in any other case + ui->DX_Call_Button->setChecked (false); + if (m_specOp==SpecOp::HOUND && m_config.superFox() && !m_auto) clearDX(); + } + check_button_color(); +} + +void MainWindow::wheelEvent(QWheelEvent *event) // mouse wheel events +{ + if(ui->labDialFreq->hasFocus() && !m_transmitting) { // kHz + or - + Frequency dial_frequency {m_rigState.ptt () && m_rigState.split () ? + m_rigState.tx_frequency () : m_rigState.frequency ()}; + if (event->angleDelta().x() > 2 or event->angleDelta().y() > 2) { + dial_frequency = dial_frequency + 1000; + ui->labDialFreq->setText (Radio::pretty_frequency_MHz_string (dial_frequency)); + } else if (event->angleDelta().x() < -2 or event->angleDelta().y() < -2) { + dial_frequency = dial_frequency - 1000; + ui->labDialFreq->setText (Radio::pretty_frequency_MHz_string (dial_frequency)); + } + if (m_astroWidget && m_astroWidget->doppler_tracking() && m_astroWidget->DopplerMethod()!=0) { + setRig(dial_frequency - m_astroCorrection.rx); + } else { + setRig(dial_frequency); + } + setXIT (ui->TxFreqSpinBox->value ()); + ui->labDialFreq->clearFocus(); + } +} + +void MainWindow::mousePressEvent(QMouseEvent *event) // mouse press events +{ + if(ui->labDialFreq->hasFocus() && !m_transmitting) { // kHz + or - + if (event->button() & Qt::RightButton) { + m_bandEdited = true; + band_changed(m_freqNominal+1000); + } else if (event->button() & Qt::LeftButton) { + m_bandEdited = true; + band_changed(m_freqNominal-1000); + } + ui->labDialFreq->clearFocus(); + } + if(ui->tuneButton->hasFocus() && (event->button() & Qt::RightButton)) { // Tune button + m_config.transceiver_tune (false); // reset any prior rig tuning + blocked=true; + m_config.transceiver_tune (true); // toggle rig tuning + blocked=false; + if(ui->tuneButton->text()=="Tuning") { // reset Tune button by another right-click + ui->tuneButton->setChecked(false); + ui->tuneButton->setText("Tune"); + m_config.transceiver_tune (false); // reset rig tuning + } else { + ui->tuneButton->setChecked(true); + ui->tuneButton->setText("Tuning"); + QTimer::singleShot (6000, [=] { // reset Tune button after 6 seconds + ui->tuneButton->setChecked(false); + ui->tuneButton->setText("Tune"); + }); + } + ui->tuneButton->clearFocus(); + } + if(ui->DX_Call_Button->hasFocus() && (event->button() & Qt::RightButton)) { // DX_Call_Button + clearDX(); // clear dxCallEntry + ui->dxGridEntry->clear (); // clear dxGridEntry + if (!keepTx5) ui->tx5->setCurrentText(""); // clear tx5 + if (ui->respondComboBox->isVisible()) { + Dpoints=0; // reset points + maxDPoints=0; // reset points + dBpoints=-28; // reset points + dBpoints2=99; // reset points + maxdBPoints=-28; // reset points + mindBPoints=99; // reset points + } + ui->DX_Call_Button->clearFocus(); + } + if(m_config.alternate_erase_button() && ui->EraseButton->hasFocus() && (event->button() & Qt::RightButton)) { + ui->decodedTextBrowser2->erase (); + ui->EraseButton->clearFocus(); + } + if(ui->txFirstCheckBox->isVisible() && ui->txFirstCheckBox->hasFocus() && (event->button() & Qt::RightButton)) { + ui->txFirstCheckBox->setEnabled(false); // freeze txFirstCheckBox + ui->txFirstCheckBox->clearFocus(); + } + if(ui->msk144Button->hasFocus() && (event->button() & Qt::RightButton)) { + ui->txFirstCheckBox->setEnabled(true); // unfreeze txFirstCheckBox + ui->ft8Button->clearFocus(); + ui->msk144Button->clearFocus(); + } + if(ui->q65Button->hasFocus() && (event->button() & Qt::RightButton)) { // switch to Q65_Pileup mode + m_config.setSpecial_Q65_Pileup(); + m_specOp=m_config.special_op_id(); + on_actionQ65_triggered(); + ui->q65Button->clearFocus(); + } + if(ui->jt65Button->hasFocus() && (event->button() & Qt::RightButton)) { // switch to JT9 mode + on_actionJT9_triggered(); + ui->jt65Button->clearFocus(); + } + if(ui->houndButton->hasFocus() && (event->button() & Qt::RightButton)) { // toggle SuperFox mode + keep_frequency = true; + not_erase = true; // prevent erasing the decodedTextBrowser + m_config.toggle_SF(); + QTimer::singleShot (250, [=] { + keep_frequency = false; + not_erase = false; + }); + on_actionFT8_triggered(); + ui->houndButton->clearFocus(); + ui->labDXped->setStyleSheet("QLabel {background-color: red; color: white;}"); + QTimer::singleShot (250, [=] {keep_frequency = false;}); + } + // Search callsign on qrz.com, qrzcq.com or hamqth.com + if(ui->lookupButton->hasFocus() && (event->button() & Qt::RightButton)) { // search callsign on QRZ.com + QString hisCall=ui->dxCallEntry->text(); + if (hisCall !="") QDesktopServices::openUrl (QUrl {"https://www.qrz.com/db/" + hisCall}); + ui->lookupButton->clearFocus(); + } + if(ui->addButton->hasFocus() && (event->button() & Qt::RightButton)) { // search callsign on hamqth.com + QString hisCall=ui->dxCallEntry->text(); + if (hisCall !="") QDesktopServices::openUrl (QUrl {"https://www.hamqth.com/" + hisCall}); + ui->addButton->clearFocus(); + } + if(ui->ignoreButton->hasFocus() && (event->button() & Qt::RightButton)) { // search callsign on qrzcq.com + QString hisCall=ui->dxCallEntry->text(); + if (hisCall !="") QDesktopServices::openUrl (QUrl {"https://www.qrzcq.com/call/" + hisCall}); + ui->ignoreButton->clearFocus(); + } + // Wait & Pounce + if(ui->autoButton->hasFocus() && (event->button() & Qt::RightButton) && ui->respondComboBox->currentText()!="CQ: None") { + if (!pounce && !m_auto && m_config.Wait_features_enabled() && SpecOp::FOX!=m_specOp) { + pounce = true; + check_button_color(); + stopWRTimer.stop(); // Stop any Wait & Reply timeout + stopWCTimer.stop(); // Stop any Wait & Call timeout + } else { + pounce = false; + check_button_color(); + } + ui->autoButton->clearFocus(); + } + if(ui->DecodeButton->hasFocus() && (event->button() & Qt::RightButton)) { // Decode button + if(m_decoderBusy) { + to_jt9(m_ihsym,-1,-1); //Allow jt9 to bail out early, if necessary + decodeDone(); //Clear a hung decoder status + } + ui->DecodeButton->clearFocus(); + } + if(ui->ft8Button->hasFocus() && (event->button() & Qt::RightButton)) { // Switch contest mode on/off + keep_frequency = true; + not_erase = true; // prevent erasing the decodedTextBrowser + QTimer::singleShot (350, [=] {not_erase = false;}); + m_specOp=m_config.special_op_id(); + if (!m_config.bSpecialOp()) { + m_config.setSpecial_On(); + if (m_specOp==SpecOp::HOUND) { + ui->houndButton->click(); + } + } else { + m_config.setSpecial_None(); + if(ui->txrb1->isChecked()) on_txb2_clicked(); + ui->tx1->setEnabled(true); + ui->txb1->setEnabled(true); + if (m_specOp==SpecOp::HOUND) { + ui->houndButton->setChecked(false); + m_config.setSpecial_None(); + } + } + m_specOp=m_config.special_op_id(); + SpecOp nContest0=m_specOp; + if(m_specOp!=nContest0) { + ui->tx1->setEnabled(true); + ui->txb1->setEnabled(true); + set_mode(m_mode); + } + displayDialFrequency (); + update_watchdog_label (); + checkMSK144ContestType(); + chkFT4(); + if(SpecOp::EU_VHF==m_specOp and m_config.my_grid().size()<6) { + MessageBox::information_message (this, + "EU VHF Contest messages require a 6-character locator."); + } + if((m_specOp==SpecOp::FOX or m_specOp==SpecOp::HOUND) and + m_mode!="FT8") { + MessageBox::information_message (this, + "Fox-and-Hound operation is available only in FT8 mode.\nGo back and change your selection."); + } + ui->labDXped->setVisible(SpecOp::NONE != m_specOp); + if ((!verified && ui->labDXped->isVisible()) or ui->labDXped->text()!="Super Hound") + ui->labDXped->setStyleSheet("QLabel {background-color: red; color: white;}"); + set_mode(m_mode); + configActiveStations(); + check_button_color(); + ui->ft8Button->clearFocus(); + statusChanged(); + QTimer::singleShot (250, [=] {keep_frequency = false;}); + } + // freeze the Tx5 text + if(ui->txb5->hasFocus() && (event->button() & Qt::RightButton)) { + if (!keepTx5) { + keepTx5 = true; + ui->tx5->setStyleSheet("color: #000000; background-color: #ffff00"); + } else { + keepTx5 = false; + ui->tx5->setStyleSheet(""); + } + ui->txb5->clearFocus(); + } + // Toggle FT8 DXp frequencies + if(ui->pb80->hasFocus() && (event->button() & Qt::RightButton) && (m_mode=="FT8" || m_mode=="FT4")) { + keep_frequency = true; + setRig(3567000); + QTimer::singleShot (250, [=] {keep_frequency = false;}); + setXIT (ui->TxFreqSpinBox->value ()); + ui->pb80->clearFocus(); + } + if(ui->pb40->hasFocus() && (event->button() & Qt::RightButton) && (m_mode=="FT8" || m_mode=="FT4")) { + keep_frequency = true; + setRig(7056000); + QTimer::singleShot (250, [=] {keep_frequency = false;}); + setXIT (ui->TxFreqSpinBox->value ()); + ui->pb40->clearFocus(); + } + if(ui->pb30->hasFocus() && (event->button() & Qt::RightButton) && (m_mode=="FT8" || m_mode=="FT4")) { + keep_frequency = true; + setRig(10131000); + QTimer::singleShot (250, [=] {keep_frequency = false;}); + setXIT (ui->TxFreqSpinBox->value ()); + ui->pb30->clearFocus(); + } + if(ui->pb20->hasFocus() && (event->button() & Qt::RightButton) && (m_mode=="FT8" || m_mode=="FT4")) { + keep_frequency = true; + setRig(14090000); + QTimer::singleShot (250, [=] {keep_frequency = false;}); + setXIT (ui->TxFreqSpinBox->value ()); + ui->pb20->clearFocus(); + } + if(ui->pb17->hasFocus() && (event->button() & Qt::RightButton) && (m_mode=="FT8" || m_mode=="FT4")) { + keep_frequency = true; + setRig(18095000); + QTimer::singleShot (250, [=] {keep_frequency = false;}); + setXIT (ui->TxFreqSpinBox->value ()); + ui->pb17->clearFocus(); + } + if(ui->pb15->hasFocus() && (event->button() & Qt::RightButton) && (m_mode=="FT8" || m_mode=="FT4")) { + keep_frequency = true; + setRig(21091000); + QTimer::singleShot (250, [=] {keep_frequency = false;}); + setXIT (ui->TxFreqSpinBox->value ()); + ui->pb15->clearFocus(); + } + if(ui->pb12->hasFocus() && (event->button() & Qt::RightButton) && (m_mode=="FT8" || m_mode=="FT4")) { + keep_frequency = true; + setRig(24911000); + QTimer::singleShot (250, [=] {keep_frequency = false;}); + setXIT (ui->TxFreqSpinBox->value ()); + ui->pb12->clearFocus(); + } + if(ui->pb10->hasFocus() && (event->button() & Qt::RightButton) && (m_mode=="FT8" || m_mode=="FT4")) { + keep_frequency = true; + setRig(28091000); + QTimer::singleShot (250, [=] {keep_frequency = false;}); + setXIT (ui->TxFreqSpinBox->value ()); + ui->pb10->clearFocus(); + } + if(ui->pb6->hasFocus() && (event->button() & Qt::RightButton) && m_mode=="FT8") { + keep_frequency = true; + setRig(50323000); + QTimer::singleShot (250, [=] {keep_frequency = false;}); + setXIT (ui->TxFreqSpinBox->value ()); + ui->pb6->clearFocus(); + } + if(ui->pb2->hasFocus() && (event->button() & Qt::RightButton)) { + int f; + if (m_config.region()==2) { + f = 222174000; + } else { + f = 70154000; + if (m_mode=="MSK144") { + ui->sbTR->setValue (m_msk144_tr6); + programStart = true; + QTimer::singleShot (250, [=] {programStart = false;}); + } + } + auto const& row = m_config.frequencies ()->best_working_frequency (f); + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0) { + on_bandComboBox_activated (row); + } else { + keep_frequency = true; + setRig(f); + QTimer::singleShot (250, [=] {keep_frequency = false;}); + } + setXIT (ui->TxFreqSpinBox->value ()); + ui->pb2->clearFocus(); + } + if(ui->pb70->hasFocus() && (event->button() & Qt::RightButton)) { + auto const& row = m_config.frequencies ()->best_working_frequency (1296174000); + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0) { + on_bandComboBox_activated (row); + } else { + keep_frequency = true; + setRig(1296174000); + QTimer::singleShot (250, [=] {keep_frequency = false;}); + } + setXIT (ui->TxFreqSpinBox->value ()); + ui->pb70->clearFocus(); + } + if (ui->pbBandHopping->hasFocus() && event->button() & Qt::RightButton) { // Band Hopping button + if(ui->pbBandHopping->isChecked()) { + bandHopping(); // Force band hopping to switch to the next selected frequency + } else { + // Testing the default audio device +#ifdef WIN32 + QAudioOutput info(QAudioDeviceInfo::defaultOutputDevice()); + QString audioPath = QCoreApplication::applicationDirPath() + "/sounds" + m_config.voicesPath() + "/"; + QAudioFormat format; + format.setCodec("audio/pcm"); + format.setSampleRate (48000); + format.setChannelCount (1); + format.setSampleSize (16); + format.setSampleType(QAudioFormat::SignedInt); + QAudioOutput* audio; + audio = new QAudioOutput(format, this); + QFile *effect = new QFile(this); + effect->setFileName(QString("%1/%2").arg(audioPath, "Testing_long.wav")); + effect->open(QIODevice::ReadOnly); + audio->start(effect); +#else + QString audioPath = QCoreApplication::applicationDirPath() + "/sounds" + m_config.voicesPath() + "/"; + QSound::play(audioPath + "Testing_long.wav"); // for Linux and macOS +#endif + } + ui->pbBandHopping->clearFocus(); + } +} + +void MainWindow::on_dxCallEntry_textChanged (QString const& call) +{ + if (SpecOp::HOUND==m_specOp && m_config.superFox() && !(m_bDoubleClicked or (m_hisCall0 != "" + && (call.left(6).contains(m_hisCall0) or call.right(6).contains(m_hisCall0)))) + && !ui->DX_Call_Button->isChecked()) { // allow Wait & Call + clearDX(); + return; + } + set_dateTimeQSO (-1); // reset the QSO start time when DXCall changes + m_hisCall = call; + if(m_QSYMessageCreatorWidget) m_QSYMessageCreatorWidget->getDxBase(QString(Radio::base_callsign(call))); + if (!blocked) ui->dxGridEntry->clear(); // conditional because not always useful with highlightDXCall/DXGrid feature + if (ui->DX_Call_Button->isChecked() && !(m_mode=="FT8" && SpecOp::HOUND==m_specOp)) ui->DX_Call_Button->click (); + statusChanged(); + statusUpdate (); + check_button_color(); +} + +void MainWindow::on_dxCallEntry_editingFinished() +{ + auto const& dxBase = Radio::base_callsign (m_hisCall); + save_dxbase_(const_cast <char *> ((dxBase + " ").left (6).toLatin1().constData()), (FCL)6); + if(m_QSYMessageCreatorWidget) m_QSYMessageCreatorWidget->getDxBase(QString(dxBase)); +} + +void MainWindow::on_dxCallEntry_returnPressed () +{ + on_lookupButton_clicked(); +} + +void MainWindow::on_dxGridEntry_textChanged (QString const& grid) +{ + if (ui->dxGridEntry->hasAcceptableInput ()) { + if (grid != m_hisGrid) { + m_hisGrid = grid; + statusUpdate (); + } + qint64 nsec = (QDateTime::currentMSecsSinceEpoch()/1000) % 86400; + double utch=nsec/3600.0; + int nAz,nEl,nDmiles,nDkm,nHotAz,nHotABetter; + azdist_(const_cast <char *> ((m_config.my_grid () + " ").left (6).toLatin1().constData()), + const_cast <char *> ((m_hisGrid + " ").left (6).toLatin1().constData()),&utch, + &nAz,&nEl,&nDmiles,&nDkm,&nHotAz,&nHotABetter,(FCL)6,(FCL)6); + QString t; + int nd=nDkm; + if(m_config.miles()) nd=nDmiles; + if(m_mode=="MSK144") { + if(nHotABetter==0)t = t.asprintf("Az: %d B: %d El: %d %d",nAz,nHotAz,nEl,nd); + if(nHotABetter!=0)t = t.asprintf("Az: %d A: %d El: %d %d",nAz,nHotAz,nEl,nd); + } else { + t = t.asprintf("Az: %d %d",nAz,nd); + } + if(m_config.miles()) t += " mi"; + if(!m_config.miles()) t += " km"; + ui->labAz->setText (t); + } else { + if (m_hisGrid.size ()) { + m_hisGrid.clear (); + ui->labAz->clear (); + statusUpdate (); + } + } +} + +void MainWindow::on_genStdMsgsPushButton_clicked() //genStdMsgs button +{ + ui->pbBandHopping->setChecked(false); // disable band hopping + genStdMsgs(m_rpt); + if (!m_bDoubleClicked && m_hisCall!="") { + if (ui->tx1->isEnabled ()) { + QTimer::singleShot (0, ui->txrb1, SLOT (click ())); // Go to Tx1 + } else { + QTimer::singleShot (0, ui->txrb2, SLOT (click ())); // Go to Tx2 if Tx1 is disabled + } + m_bMyCallStd=stdCall(m_config.my_callsign()); //ft8md + m_bHisCallStd=stdCall(m_hisCall); //ft8md + + } +} + +void MainWindow::cease_auto_Tx_after_QSO () +{ + if (SpecOp::FOX != m_specOp + && ui->cbAutoSeq->isVisible () && ui->cbAutoSeq->isEnabled () && ui->cbAutoSeq->isChecked ()) + { + // ensure that auto Tx is disabled even if disable Tx + // on 73 is not checked, unless in Fox mode where it is allowed + // to be a robot. + auto_tx_mode (false); + } +} + +void MainWindow::on_logQSOButton_clicked() //Log QSO button +{ + if (!((m_config.repeat_Tx() or !m_send_RR73) && (m_mode=="MSK144" or m_mode=="Q65"))) { + if (SpecOp::NA_VHF==m_specOp && m_mode=="FT4" && m_config.NCCC_Sprint()) { + QTimer::singleShot (int(850.0*m_TRperiod), [=] {cease_auto_Tx_after_QSO ();}); + } else { + cease_auto_Tx_after_QSO (); + } + } + + if (!m_hisCall.size ()) { + MessageBox::warning_message (this, tr ("Warning: DX Call field is empty.")); + if ((SpecOp::NA_VHF == m_specOp or SpecOp::WW_DIGI == m_specOp) && m_config.autoLog()) return; // prevent program crash + } + // m_dateTimeQSOOn should really already be set but we'll ensure it gets set to something just in case + if (!m_dateTimeQSOOn.isValid ()) { + auto now = QDateTime::currentDateTimeUtc(); + m_dateTimeQSOOn = now.addSecs (-(m_ntx - 2) * int(m_TRperiod) - + int(fmod(double(now.time().second()),m_TRperiod))); + } + auto dateTimeQSOOff = QDateTime::currentDateTimeUtc(); + if (dateTimeQSOOff < m_dateTimeQSOOn) dateTimeQSOOff = m_dateTimeQSOOn; + QString grid=m_hisGrid; + if(grid=="....") grid=""; + + // Optionally replace empty grids by "ZZ00" + if(m_config.ZZ00() && m_hisGrid=="" && m_specOp!=SpecOp::NONE && m_specOp!=SpecOp::FOX && m_specOp!=SpecOp::HOUND) m_hisGrid = "ZZ00"; + + switch( m_specOp ) + { + case SpecOp::NA_VHF: + m_xSent=m_config.my_grid().left(4); + m_xRcvd=m_hisGrid.left(4); + break; + case SpecOp::EU_VHF: + m_rptSent=m_xSent.split(" ").at(0).left(2); + m_rptRcvd=m_xRcvd.split(" ").at(0).left(2); + if(m_xRcvd.split(" ").size()>=2) m_hisGrid=m_xRcvd.split(" ").at(1); + grid=m_hisGrid; + ui->dxGridEntry->setText(grid); + break; + case SpecOp::FIELD_DAY: + m_rptSent=m_xSent.split(" ").at(0); + m_rptRcvd=m_xRcvd.split(" ").at(0); + break; + case SpecOp::RTTY: + m_rptSent=m_xSent.split(" ").at(0); + m_rptRcvd=m_xRcvd.split(" ").at(0); + break; + case SpecOp::WW_DIGI: + m_xSent=m_config.my_grid().left(4); + m_xRcvd=m_hisGrid.left(4); + break; + case SpecOp::ARRL_DIGI: + m_xSent=m_config.my_grid().left(4); + m_xRcvd=m_hisGrid.left(4); + break; + case SpecOp::Q65_PILEUP: + m_xSent=m_config.my_grid().left(4); + m_xRcvd=m_hisGrid; + break; + default: break; + } + + m_logDlg->initLogQSO (m_hisCall, grid, m_mode, m_rptSent, m_rptRcvd, + m_dateTimeQSOOn, dateTimeQSOOff, m_freqNominal + + ui->TxFreqSpinBox->value(), m_noSuffix, m_xSent, m_xRcvd); + m_inQSOwith=""; + if (ui->respondComboBox->isVisible() && ui->respondComboBox->currentText() != "CQ: None") { + Dpoints=0; // reset points + maxDPoints=0; // reset points + dBpoints=-28; // reset points + dBpoints2=99; // reset points + maxdBPoints=-28; // reset points + mindBPoints=99; // reset points + } + QTimer::singleShot (2000, [=] { + pounce = false; + filtered = false; + read_txLog(); + check_button_color(); + }); + QTimer::singleShot (7000, [=] { + read_txLog(); + }); + stopWRTimer.stop(); // Stop any Wait & Reply timeout + stopWCTimer.stop(); // Stop any Wait & Call timeout +} + +void MainWindow::acceptQSO (QDateTime const& QSO_date_off, QString const& call, QString const& grid + , Frequency dial_freq, QString const& mode + , QString const& rpt_sent, QString const& rpt_received + , QString const& tx_power, QString const& comments + , QString const& name, QDateTime const& QSO_date_on, QString const& operator_call + , QString const& my_call, QString const& my_grid + , QString const& exchange_sent, QString const& exchange_rcvd + , QString const& propmode, QString const& satellite + , QString const& satmode + , QString const& freqRx, QByteArray const& ADIF) +{ + QString date = QSO_date_on.toString("yyyyMMdd"); + m_lastloggedcall=call; //ft8md + if (!m_logBook.add (call, grid, m_config.bands()->find(dial_freq), mode, ADIF)) + { + MessageBox::warning_message (this, tr ("Log file error"), + tr ("Cannot open \"%1\"").arg (m_logBook.path ())); + } + + m_messageClient->qso_logged (QSO_date_off, call, grid, dial_freq, mode, rpt_sent, rpt_received + , tx_power, comments, name, QSO_date_on, operator_call, my_call, my_grid + , exchange_sent, exchange_rcvd, propmode, satellite, satmode, freqRx); + m_messageClient->logged_ADIF (ADIF); + + // Log to N1MM Logger + if (m_config.broadcast_to_n1mm () && m_config.valid_n1mm_info ()) + { + QUdpSocket sock; + if (-1 == sock.writeDatagram (ADIF + " <eor>" + , QHostAddress {m_config.n1mm_server_name ()} + , m_config.n1mm_server_port ())) + { + MessageBox::warning_message (this, tr ("Error sending log to N1MM"), + tr ("Write returned \"%1\"").arg (sock.errorString ())); + } + } + + // Log to Cloudlog API if enabled + if (m_config.cloudlog_enabled()) + { + m_cloudlog.logQso(ADIF); + } + + // Log to eqsl.cc + if (m_config.send_to_eqsl()) Eqsl->upload(m_config.eqsl_username(),m_config.eqsl_passwd(),m_config.eqsl_nickname(),call,mode,QSO_date_on,rpt_sent,m_config.bands ()->find (dial_freq),comments); + + blocked=true; // needed to clear DXgrid only optionally + if (m_config.clear_DXcall ()) clearDX (); + if (m_config.clear_DXgrid ()) ui->dxGridEntry->clear (); + QTimer::singleShot (50, [=] {blocked = false;}); // needed to clear DXgrid only optionally + m_dateTimeQSOOn = QDateTime {}; + if(m_specOp!=SpecOp::NONE and m_specOp!=SpecOp::FOX and m_specOp!=SpecOp::HOUND) { + ui->sbSerialNumber->setValue(ui->sbSerialNumber->value() + 1); + } + + if(m_ActiveStationsWidget!=NULL) { + if(m_mode=="Q65") { + m_score++; + m_EMEworked[call]=true; + if(m_specOp==SpecOp::Q65_PILEUP) { + rm_q3list_(const_cast<char *> (m_deCall.toLatin1().constData()), m_deCall.size()); + refreshPileupList(); + } + m_ActiveStationsWidget->setRate(m_score); + } else if (m_specOp==SpecOp::ARRL_DIGI) { + QString band=m_config.bands()->find(dial_freq); + activeWorked(call,band); + int points=m_activeCall[call].points; + m_score += points; + ARRL_logged al; + al.time=QDateTime::currentDateTimeUtc(); + al.band=band; + al.points=points; + m_arrl_log.append(al); + updateRate(); + } + } + + m_xSent.clear (); + m_xRcvd.clear (); + if (m_config.set_RXtoTX ()) on_pbT2R_clicked(); // Mod for WD5DHK +} + +void MainWindow::updateRate() +{ + int iz=m_arrl_log.size(); + int rate=0; + int nbc=0; + double hrDiff; + + for(int i=iz-1; i>=0; i--) { + hrDiff = m_arrl_log[i].time.msecsTo(QDateTime::currentDateTimeUtc())/3600000.0; + if(hrDiff > 1.0) break; + rate += m_arrl_log[i].points; + if(i<iz-1 and m_arrl_log[i].band != m_arrl_log[i+1].band) nbc += 1; + } + m_ActiveStationsWidget->setRate(rate); + m_ActiveStationsWidget->setScore(m_score); + m_ActiveStationsWidget->setBandChanges(nbc); +} + +qint64 MainWindow::nWidgets(QString t) +{ + Q_ASSERT(t.length()==N_WIDGETS); + qint64 n=0; + for(int i=0; i<N_WIDGETS; i++) { + n=n + n + t.mid(i,1).toInt(); + } + return n; +} + +void MainWindow::displayWidgets(qint64 n) +{ + /* See text file "displayWidgets.txt" for widget numbers */ + qint64 j=qint64(1)<<(N_WIDGETS-1); + bool b; + for(int i=0; i<N_WIDGETS; i++) { + b=(n&j) != 0; + if(i==0) ui->txFirstCheckBox->setVisible(b); + if(i==1) ui->TxFreqSpinBox->setVisible(b); + if(i==2) ui->RxFreqSpinBox->setVisible(b); + if(i==3) ui->sbFtol->setVisible(b); + if(i==4) ui->rptSpinBox->setVisible(b); + if(i==5) ui->sbTR->setVisible(b); + if(i==6) { + ui->sbCQTxFreq->setVisible (b); + ui->cbCQTx->setVisible (b); + auto is_compound = m_config.my_callsign () != m_baseCall; + ui->cbCQTx->setEnabled (b && (!is_compound || shortList (m_config.my_callsign ()))); + } + if(i==7) ui->cbShMsgs->setVisible(b); + if(i==8) ui->cbFast9->setVisible(b); + if(i==9) ui->cbAutoSeq->setVisible(b); + if(i==10) ui->cbTx6->setVisible(b); + // if(i==11) ui->pbTxMode->setVisible(b); + if(i==12) ui->pbR2T->setVisible(b); + if(i==13) ui->pbT2R->setVisible(b); + if(i==14) ui->cbHoldTxFreq->setVisible(b); + if(i==15) ui->sbSubmode->setVisible(b); + if(i==16) ui->syncSpinBox->setVisible(b); + if(i==17) ui->WSPR_controls_widget->setVisible(b); + if(i==18) ui->ClrAvgButton->setVisible(b); + if(i==19) ui->actionQuickDecode->setEnabled(b); + if(i==19) ui->actionMediumDecode->setEnabled(b); + if(i==19) ui->actionDeepestDecode->setEnabled(b); + if(i==20) ui->actionInclude_averaging->setVisible (b); + if(i==21) ui->actionInclude_correlation->setVisible (b); + if(i==22) { + if(!b && m_echoGraph->isVisible()) m_echoGraph->hide(); + } + if(i==23) ui->cbSWL->setVisible(b); + if(i==24) ui->actionEnable_AP_FT8->setVisible (b); + if(i==24) ui->actionHide_AP_info->setVisible (b); + if(i==25) ui->actionEnable_AP_JT65->setVisible (b); + if(i==26) ui->actionEnable_AP_DXcall->setVisible (b); + if(i==27) ui->respondComboBox->setVisible(b); + if(i==29) ui->measure_check_box->setVisible(b); + if(i==30) ui->labDXped->setVisible(b); + if(i==31) ui->cbRxAll->setVisible(b); + if(i==32) ui->cbCQonly->setVisible(b); + if(i==33) ui->sbTR_FST4W->setVisible(b); + if (34 == i) // adjust the stacked widget + { + ui->opt_controls_stack->setCurrentIndex (b ? 1 : 0); + ui->sbF_Low->setVisible(b); + } + if(i==35) ui->sbF_High->setVisible(b); + if(i==36) ui->actionAuto_Clear_Avg->setVisible (b); + if(i==37) ui->sbMaxDrift->setVisible(b); + j=j>>1; + } + ui->pbBestSP->setVisible(m_mode=="FT4"); + b=false; + if(m_mode=="FT4" or m_mode=="FT8" || "Q65" == m_mode) { + b=SpecOp::EU_VHF==m_specOp or + ( SpecOp::RTTY==m_specOp and + (m_config.RTTY_Exchange()=="DX" or m_config.RTTY_Exchange()=="#") ); + } + if(m_mode=="MSK144") b=SpecOp::EU_VHF==m_specOp; + ui->sbEchoAvg->setVisible(m_mode=="Echo"); + ui->sbSerialNumber->setVisible(b); + m_lastCallsign.clear (); // ensures Tx5 is updated for new modes + b=m_mode.startsWith("FST4"); + ui->sbNB->setVisible(b); + genStdMsgs (m_rpt, true); + configActiveStations(); +} + +void MainWindow::on_actionFST4_triggered() +{ + QTimer::singleShot (50, [=] { + ui->TxFreqSpinBox->setValue(m_settings->value("TxFreq_old",1500).toInt()); + ui->RxFreqSpinBox->setValue(m_settings->value("RxFreq_old",1500).toInt()); + on_sbSubmode_valueChanged(ui->sbSubmode->value()); + ui->cbHoldTxFreq->setChecked (HoldTxFreqStatus); + }); + m_mode="FST4"; + if(m_specOp==SpecOp::HOUND) { + m_config.setSpecial_None(); + m_specOp=m_config.special_op_id(); + } + ui->actionFST4->setChecked(true); + m_bFast9=false; + m_bFastMode=false; + m_fastGraph->hide(); + m_wideGraph->show(); + if (m_tci_audio && ui->bandComboBox->currentText()!="OOB") + Q_EMIT m_config.transceiver_period(m_TRperiod); + m_nsps=6912; //For symspec only + m_FFTSize = m_nsps / 2; + if (m_tci_audio) Q_EMIT m_config.transceiver_blocksize (m_FFTSize); + else Q_EMIT FFTSize (m_FFTSize); + ui->lh_decodes_title_label->setText(tr ("Band Activity")); + ui->rh_decodes_title_label->setText(tr ("Rx Frequency")); + WSPR_config(false); + if(m_config.single_decode()) { +// 01234567890123456789012345678901234567 + displayWidgets(nWidgets("11111100010011100001000000010000000000")); + m_wideGraph->setSingleDecode(true); + } else { + displayWidgets(nWidgets("11101100010011100001000000010000001100")); + m_wideGraph->setSingleDecode(false); + ui->sbFtol->setValue(20); + } + setup_status_bar(false); + ui->cbAutoSeq->setChecked(true); + m_wideGraph->setMode(m_mode); + m_wideGraph->setPeriod(m_TRperiod,6912); + m_wideGraph->setRxFreq(ui->RxFreqSpinBox->value()); + m_wideGraph->setTol(ui->sbFtol->value()); + m_wideGraph->setTxFreq(ui->TxFreqSpinBox->value()); + m_wideGraph->setFST4_FreqRange(ui->sbF_Low->value(),ui->sbF_High->value()); + chk_FST4_freq_range(); + switch_mode (Modes::FST4); + m_wideGraph->setMode(m_mode); + ui->sbTR->values ({15, 30, 60, 120, 300, 900, 1800}); + ui->sbTR->setValue (m_settings->value ("TRPeriod_FST4", 60).toInt()); // remember sbTR settings by mode + QTimer::singleShot (50, [=] {on_sbTR_valueChanged (ui->sbTR->value());}); + ui->txFirstCheckBox->setEnabled(true); + statusChanged(); + m_bOK_to_chk=true; + chk_FST4_freq_range(); +} + +void MainWindow::on_actionFST4W_triggered() +{ + m_mode="FST4W"; + if(m_specOp==SpecOp::HOUND) { + m_config.setSpecial_None(); + m_specOp=m_config.special_op_id(); + } + ui->actionFST4W->setChecked(true); + m_bFast9=false; + m_bFastMode=false; + m_fastGraph->hide(); + m_wideGraph->show(); + if (m_tci_audio && ui->bandComboBox->currentText()!="OOB") + Q_EMIT m_config.transceiver_period(m_TRperiod); + m_nsps=6912; //For symspec only + m_FFTSize = m_nsps / 2; + if (m_tci_audio) Q_EMIT m_config.transceiver_blocksize (m_FFTSize); + else Q_EMIT FFTSize (m_FFTSize); + WSPR_config(true); +// 01234567890123456789012345678901234567 + displayWidgets(nWidgets("00000000000000000101000000000000010000")); + setup_status_bar(false); + ui->band_hopping_group_box->setChecked(false); + ui->band_hopping_group_box->setVisible(false); + on_sbTR_FST4W_valueChanged (ui->sbTR_FST4W->value ()); + ui->WSPRfreqSpinBox->setMinimum(100); + ui->WSPRfreqSpinBox->setMaximum(5000); + m_wideGraph->setMode(m_mode); + m_wideGraph->setPeriod(m_TRperiod,6912); + m_wideGraph->setTxFreq(ui->WSPRfreqSpinBox->value()); + m_wideGraph->setRxFreq(ui->sbFST4W_RxFreq->value()); + m_wideGraph->setTol(ui->sbFST4W_FTol->value()); + ui->sbFtol->setValue(100); + switch_mode (Modes::FST4W); + statusChanged(); +} + +void MainWindow::on_actionFT4_triggered() +{ + if (m_mode=="MSK144") QTimer::singleShot (75, [=] {on_actionFT4_triggered();}); + QTimer::singleShot (50, [=] { + ui->TxFreqSpinBox->setValue(m_settings->value("TxFreq_old",1500).toInt()); + ui->RxFreqSpinBox->setValue(m_settings->value("RxFreq_old",1500).toInt()); + on_sbSubmode_valueChanged(ui->sbSubmode->value()); + ui->cbHoldTxFreq->setChecked (HoldTxFreqStatus); + }); + m_mode="FT4"; + if(m_specOp==SpecOp::HOUND) { + m_config.setSpecial_None(); + m_specOp=m_config.special_op_id(); + } + m_TRperiod=7.5; + bool bVHF=m_config.enable_VHF_features(); + m_bFast9=false; + m_bFastMode=false; + WSPR_config(false); + switch_mode (Modes::FT4); + m_nsps=6912; + m_FFTSize = m_nsps/2; + if (m_tci_audio) Q_EMIT m_config.transceiver_blocksize (m_FFTSize); + else Q_EMIT FFTSize (m_FFTSize); + m_hsymStop=21; + setup_status_bar (bVHF); + m_toneSpacing=12000.0/576.0; + ui->actionFT4->setChecked(true); + m_wideGraph->setMode(m_mode); + m_send_RR73=true; + VHF_features_enabled(bVHF); + ui->cbAutoSeq->setChecked(true); + m_fastGraph->hide(); + m_wideGraph->show(); + ui->rh_decodes_headings_label->setText(" UTC dB DT Freq " + tr ("Message")); + m_wideGraph->setPeriod(m_TRperiod,m_nsps); + if (m_tci_audio && ui->bandComboBox->currentText()!="OOB") + Q_EMIT m_config.transceiver_period(m_TRperiod); + if (!m_tci_audio) { + m_modulator->setTRPeriod(m_TRperiod); // TODO - not thread safe + m_detector->setTRPeriod(m_TRperiod); // TODO - not thread safe + } + ui->rh_decodes_title_label->setText(tr ("Rx Frequency")); + ui->lh_decodes_title_label->setText(tr ("Band Activity")); + ui->lh_decodes_headings_label->setText( " UTC dB DT Freq " + tr ("Message")); +// 01234567890123456789012345678901234567 + displayWidgets(nWidgets("11101000010011100001000000011000100000")); + ui->txrb2->setEnabled(true); + ui->txrb4->setEnabled(true); + ui->txrb5->setEnabled(true); + ui->txrb6->setEnabled(true); + ui->txb2->setEnabled(true); + ui->txb4->setEnabled(true); + ui->txb5->setEnabled(true); + ui->txb6->setEnabled(true); + ui->txFirstCheckBox->setEnabled(true); + chkFT4(); + statusChanged(); +} + +void MainWindow::on_actionFT8_triggered() +{ + if (m_mode=="MSK144") QTimer::singleShot (75, [=] {on_actionFT8_triggered();}); + QTimer::singleShot (50, [=] { + if(m_specOp!=SpecOp::FOX) ui->TxFreqSpinBox->setValue(m_settings->value("TxFreq_old",1500).toInt()); + if(m_specOp==SpecOp::FOX && !m_config.superFox()) ui->TxFreqSpinBox->setValue(m_TxFreqFox); + if(SpecOp::HOUND == m_specOp && m_config.superFox()) clearDX(); + on_sbSubmode_valueChanged(ui->sbSubmode->value()); + ui->cbHoldTxFreq->setChecked (HoldTxFreqStatus); + }); + m_mode="FT8"; + bool bVHF=m_config.enable_VHF_features(); + m_bFast9=false; + m_bFastMode=false; + WSPR_config(false); + m_nsps=6912; + m_FFTSize = m_nsps / 2; + if (m_tci_audio) Q_EMIT m_config.transceiver_blocksize (m_FFTSize); + else Q_EMIT FFTSize (m_FFTSize); + if (m_multithreadFT8 && !(m_specOp==SpecOp::HOUND && m_config.superFox())) { + if (m_ft8DecoderStart==0) m_hsymStop=49; + else if (m_ft8DecoderStart==1) { + m_hsymStop=50; + m_earlyDecode2=46; + } + else if (m_ft8DecoderStart==2) m_hsymStop=48; + else if (m_ft8DecoderStart==3) m_hsymStop=49; + else if (m_ft8DecoderStart==4) m_hsymStop=50; + } else { + m_hsymStop=50; + m_earlyDecode2=47; + } + setup_status_bar (bVHF); + m_toneSpacing=0.0; //??? + ui->actionFT8->setChecked(true); //??? + m_wideGraph->setMode(m_mode); + VHF_features_enabled(bVHF); + ui->cbAutoSeq->setChecked(true); + m_TRperiod=15.0; + ui->sbFtol->setValue (m_settings->value ("Ftol_SF", 50).toInt()); // restore last used Ftol parameter + m_fastGraph->hide(); + m_wideGraph->show(); + ui->rh_decodes_headings_label->setText(" UTC dB DT Freq " + tr ("Message")); + m_wideGraph->setPeriod(m_TRperiod,m_nsps); + if (m_tci_audio && ui->bandComboBox->currentText()!="OOB") + Q_EMIT m_config.transceiver_period(m_TRperiod); + if (!m_tci_audio) { + m_modulator->setTRPeriod(m_TRperiod); // TODO - not thread safe + m_detector->setTRPeriod(m_TRperiod); // TODO - not thread safe + } + ui->rh_decodes_title_label->setText(tr ("Rx Frequency")); + if(SpecOp::FOX==m_specOp) { + ui->lh_decodes_title_label->setText(tr ("Stations calling DXpedition %1").arg (m_config.my_callsign())); + ui->lh_decodes_headings_label->setText( "Call Grid dB Freq Dist Age Cont Score"); + } else { + ui->lh_decodes_title_label->setText(tr ("Band Activity")); + ui->lh_decodes_headings_label->setText( " UTC dB DT Freq " + tr ("Message")); + } + +// 01234567890123456789012345678901234567 + displayWidgets(nWidgets("11101000010011100001000010011000100000")); + ui->txrb2->setEnabled(true); + ui->txrb4->setEnabled(true); + ui->txrb5->setEnabled(true); + ui->txrb6->setEnabled(true); + ui->txb2->setEnabled(true); + ui->txb4->setEnabled(true); + ui->txb5->setEnabled(true); + ui->txb6->setEnabled(true); + ui->txFirstCheckBox->setEnabled(true); + ui->cbAutoSeq->setEnabled(true); + if(SpecOp::FOX==m_specOp) { + ui->txFirstCheckBox->setChecked(true); + ui->txFirstCheckBox->setEnabled(false); + ui->cbHoldTxFreq->setChecked(true); + ui->cbAutoSeq->setEnabled(false); + ui->tabWidget->setCurrentIndex(1); + m_wideGraph->setSuperFox(false); + if(m_config.superFox()) { + ui->TxFreqSpinBox->setValue(750); //SuperFox transmits at 750 Hz + m_wideGraph->setSuperFox(true); + } else { + ui->TxFreqSpinBox->setValue(500); + } + // 01234567890123456789012345678901234567 + displayWidgets(nWidgets("11101000010011100001000000000011000000")); + ui->cbRxAll->setText(tr("Show Already Worked")); + if(m_config.superFox()) { + ui->labDXped->setText(tr ("Super Fox")); + } else { + ui->labDXped->setText(tr ("Fox")); + } + on_fox_log_action_triggered(); + if (m_ActiveStationsWidget) m_ActiveStationsWidget->setClickOK(true); // allow clicks + } + if(SpecOp::HOUND == m_specOp) { + ui->houndButton->setChecked(true); + ui->txFirstCheckBox->setChecked(false); + ui->txFirstCheckBox->setEnabled(false); + ui->cbAutoSeq->setEnabled(false); + ui->tabWidget->setCurrentIndex(0); + ui->cbHoldTxFreq->setChecked(true); + m_wideGraph->setSuperHound(false); + if(m_config.superFox()) { + // 01234567890123456789012345678901234567 + displayWidgets(nWidgets("11111000010011000001000000000011000000")); + ui->labDXped->setText(tr ("Super Hound")); + ui->cbRxAll->setEnabled(false); + m_wideGraph->setRxFreq(ui->RxFreqSpinBox->value()); + m_wideGraph->setTol(ui->sbFtol->value()); + m_wideGraph->setSuperHound(true); + clearDX(); + if(ui->RxFreqSpinBox->value() < 700 or ui->RxFreqSpinBox->value() > 800) + ui->RxFreqSpinBox->setValue(750); + } else { + // 01234567890123456789012345678901234567 + displayWidgets(nWidgets("11101000010011000001000000000011000000")); + ui->labDXped->setText(tr ("Hound")); + ui->cbRxAll->setEnabled(true); + m_wideGraph->setSuperHound(false); + ui->RxFreqSpinBox->setValue(m_settings->value("RxFreq_old",1500).toInt()); + } + ui->txrb1->setChecked(true); + ui->txrb2->setEnabled(false); + ui->txrb4->setEnabled(false); + ui->txrb5->setEnabled(false); + ui->txrb6->setEnabled(false); + ui->txb2->setEnabled(false); + ui->txb4->setEnabled(false); + ui->txb5->setEnabled(false); + ui->txb6->setEnabled(false); + if (m_ActiveStationsWidget) m_ActiveStationsWidget->setClickOK(false); + } else { + switch_mode (Modes::FT8); + } + if(m_specOp != SpecOp::HOUND) { + ui->houndButton->setChecked(false); + m_wideGraph->setSuperHound(false); + } + + m_specOp=m_config.special_op_id(); + if(m_specOp!=SpecOp::NONE and m_specOp!=SpecOp::FOX and m_specOp!=SpecOp::HOUND) { + QString t0=""; + if(SpecOp::NA_VHF==m_specOp) t0="NA VHF"; + if(SpecOp::EU_VHF==m_specOp) t0="EU VHF"; + if(SpecOp::FIELD_DAY==m_specOp) t0="Field Day"; + if(SpecOp::RTTY==m_specOp) t0="FT RU"; + if(SpecOp::WW_DIGI==m_specOp) t0="WW Digi"; + if(SpecOp::ARRL_DIGI==m_specOp) t0="ARRL Digi"; + if(SpecOp::Q65_PILEUP==m_specOp) t0="Q65 Pileup"; + if(t0=="") { + ui->labDXped->setVisible(false); + } else { + ui->labDXped->setVisible(true); + ui->labDXped->setText(t0); + } + if(m_specOp!=SpecOp::Q65_PILEUP) on_contest_log_action_triggered(); + } + + if((SpecOp::FOX==m_specOp or SpecOp::HOUND==m_specOp) and !m_config.superFox() and !m_config.split_mode() + and !m_bWarnedSplit and m_config.rig_name() != "None") { + QString errorMsg; + MessageBox::critical_message (this, + "Operation in FT8 DXpedition mode normally requires\n" + " *Split* rig control (either *Rig* or *Fake It* on\n" + "the *Settings | Radio* tab.)", errorMsg); + m_bWarnedSplit=true; + } + if (ui->labDXped->isVisible()) ui->labDXped->setStyleSheet("QLabel {background-color: red; color: white;}"); + statusChanged(); + configActiveStations(); +} + +void MainWindow::on_actionJT4_triggered() +{ + QTimer::singleShot (50, [=] { + ui->TxFreqSpinBox->setValue(m_settings->value("TxFreq_old",1500).toInt()); + ui->RxFreqSpinBox->setValue(m_settings->value("RxFreq_old",1500).toInt()); + }); + m_mode="JT4"; + if(m_specOp==SpecOp::HOUND) { + m_config.setSpecial_None(); + m_specOp=m_config.special_op_id(); + } + bool bVHF=m_config.enable_VHF_features(); + WSPR_config(false); + switch_mode (Modes::JT4); + m_TRperiod=60.0; + if (m_tci_audio && ui->bandComboBox->currentText()!="OOB") + Q_EMIT m_config.transceiver_period(m_TRperiod); + if (!m_tci_audio) { + m_modulator->setTRPeriod(m_TRperiod); // TODO - not thread safe + m_detector->setTRPeriod(m_TRperiod); // TODO - not thread safe + } + m_nsps=6912; //For symspec only + m_FFTSize = m_nsps / 2; + if (m_tci_audio) Q_EMIT m_config.transceiver_blocksize (m_FFTSize); + else Q_EMIT FFTSize (m_FFTSize); + m_hsymStop=176; + if(m_config.decode_at_52s()) m_hsymStop=184; + m_toneSpacing=0.0; + ui->actionJT4->setChecked(true); + VHF_features_enabled(true); + m_wideGraph->setPeriod(m_TRperiod,m_nsps); + m_wideGraph->setMode(m_mode); + m_bFastMode=false; + m_bFast9=false; + setup_status_bar (bVHF); + ui->sbSubmode->setMaximum(6); + ui->lh_decodes_headings_label->setText("UTC dB DT Freq " + tr ("Message")); + ui->rh_decodes_headings_label->setText("UTC dB DT Freq " + tr ("Message")); + if(bVHF) { + // restore last used parameters + ui->sbFtol->setValue (m_settings->value ("Ftol_JT4", 50).toInt()); + m_nSubMode=m_settings->value("SubMode_JT4",0).toInt(); + ui->sbSubmode->setValue(m_settings->value("SubMode_JT4",0).toInt()); + QTimer::singleShot (50, [=] {on_sbSubmode_valueChanged(ui->sbSubmode->value());}); + m_bShMsgs=m_settings->value("ShMsgs_JT4",false).toBool(); + ui->cbShMsgs->setChecked(m_bShMsgs); + } else { + ui->sbSubmode->setValue(0); + } + if(bVHF) { + // 01234567890123456789012345678901234567 + displayWidgets(nWidgets("11111001011011011011110000010000000000")); + } else { + displayWidgets(nWidgets("11101000010011000011000000010000000000")); + } + fast_config(false); + ui->txFirstCheckBox->setEnabled(true); + statusChanged(); +} + +void MainWindow::on_actionJT9_triggered() +{ + m_mode="JT9"; + if(m_specOp==SpecOp::HOUND) { + m_config.setSpecial_None(); + m_specOp=m_config.special_op_id(); + } + bool bVHF=m_config.enable_VHF_features(); + // restore last used parameters + if(bVHF && m_mode!="JT65" && !blocked) { + ui->sbSubmode->setMaximum(7); + m_bFast9=m_settings->value("JT9_Fast",false).toBool(); + ui->cbFast9->setChecked(m_bFast9 or m_bFastMode); + ui->sbFtol->setValue (m_settings->value ("Ftol_JT9", 50).toInt()); + m_nSubMode=m_settings->value("SubMode",0).toInt(); + ui->sbSubmode->setValue(m_nSubMode); + QTimer::singleShot (50, [=] { + on_sbTR_valueChanged (ui->sbTR->value()); + on_sbSubmode_valueChanged(ui->sbSubmode->value()); + }); + } +// m_bFast9=ui->cbFast9->isChecked(); + m_bFastMode=m_bFast9; + WSPR_config(false); + switch_mode (Modes::JT9); + m_nsps=6912; + m_FFTSize = m_nsps / 2; + if (m_tci_audio) Q_EMIT m_config.transceiver_blocksize (m_FFTSize); + else Q_EMIT FFTSize (m_FFTSize); + m_hsymStop=173; + if(m_config.decode_at_52s()) m_hsymStop=179; + setup_status_bar (bVHF); + m_toneSpacing=0.0; + ui->actionJT9->setChecked(true); + m_wideGraph->setMode(m_mode); + VHF_features_enabled(bVHF); + if(m_nSubMode>=4 and bVHF) { + ui->cbFast9->setEnabled(true); + } else { + ui->cbFast9->setEnabled(false); + ui->cbFast9->setChecked(false); + } + ui->sbSubmode->setMaximum(7); + if(m_bFast9) { + ui->sbTR->values ({5, 10, 15, 30}); + if(bVHF && m_mode!="JT65" && !blocked) ui->sbTR->setValue (m_settings->value ("TRPeriod", 15).toInt()); // restore last used TRperiod + on_sbTR_valueChanged (ui->sbTR->value()); + m_wideGraph->hide(); + m_fastGraph->showNormal(); + ui->TxFreqSpinBox->setValue(700); + ui->RxFreqSpinBox->setValue(700); + ui->lh_decodes_headings_label->setText(" UTC dB T Freq " + tr ("Message")); + ui->rh_decodes_headings_label->setText(" UTC dB T Freq " + tr ("Message")); + } else { +// ui->cbAutoSeq->setChecked(false); + if (m_mode != "FST4") + { + m_TRperiod=60.0; + ui->lh_decodes_headings_label->setText("UTC dB DT Freq " + tr ("Message")); + ui->rh_decodes_headings_label->setText("UTC dB DT Freq " + tr ("Message")); + } + } + m_wideGraph->setPeriod(m_TRperiod,m_nsps); + if (m_tci_audio && ui->bandComboBox->currentText()!="OOB") + Q_EMIT m_config.transceiver_period(m_TRperiod); + if (!m_tci_audio) { + m_modulator->setTRPeriod(m_TRperiod); // TODO - not thread safe + m_detector->setTRPeriod(m_TRperiod); // TODO - not thread safe + } + ui->lh_decodes_title_label->setText(tr ("Band Activity")); + ui->rh_decodes_title_label->setText(tr ("Rx Frequency")); + if(bVHF) { + // 01234567890123456789012345678901234567 + displayWidgets(nWidgets("11111010110011111001000000010000000000")); + } else { + displayWidgets(nWidgets("11101000010011100001000000010000100000")); + } + fast_config(m_bFastMode); +// ui->cbAutoSeq->setVisible(m_bFast9); + ui->txFirstCheckBox->setEnabled(true); + statusChanged(); +} + +void MainWindow::on_actionJT65_triggered() +{ + if (m_mode=="MSK144") QTimer::singleShot (75, [=] {on_actionJT65_triggered();}); + QTimer::singleShot (50, [=] { + ui->TxFreqSpinBox->setValue(m_settings->value("TxFreq_old",1500).toInt()); + ui->RxFreqSpinBox->setValue(m_settings->value("RxFreq_old",1500).toInt()); + }); + on_actionJT9_triggered(); + m_mode="JT65"; + if(m_specOp==SpecOp::HOUND) { + m_config.setSpecial_None(); + m_specOp=m_config.special_op_id(); + } + bool bVHF=m_config.enable_VHF_features(); + WSPR_config(false); + switch_mode (Modes::JT65); + m_TRperiod=60.0; + if (m_tci_audio && ui->bandComboBox->currentText()!="OOB") + Q_EMIT m_config.transceiver_period(m_TRperiod); + if (!m_tci_audio) { + m_modulator->setTRPeriod(m_TRperiod); // TODO - not thread safe + m_detector->setTRPeriod(m_TRperiod); // TODO - not thread safe + } + m_nsps=6912; //For symspec only + m_FFTSize = m_nsps / 2; + if (m_tci_audio) Q_EMIT m_config.transceiver_blocksize (m_FFTSize); + else Q_EMIT FFTSize (m_FFTSize); + m_hsymStop=174; + if(m_config.decode_at_52s()) m_hsymStop=183; + m_toneSpacing=0.0; + ui->actionJT65->setChecked(true); + VHF_features_enabled(bVHF); + m_wideGraph->setPeriod(m_TRperiod,m_nsps); + m_wideGraph->setMode(m_mode); + m_wideGraph->setRxFreq(ui->RxFreqSpinBox->value()); + m_wideGraph->setTol(ui->sbFtol->value()); + m_wideGraph->setTxFreq(ui->TxFreqSpinBox->value()); + setup_status_bar (bVHF); + m_bFastMode=false; + m_bFast9=false; + ui->sbSubmode->setMaximum(2); + if(bVHF) { + // restore last used parameters + ui->sbFtol->setValue (m_settings->value ("Ftol_JT65", 50).toInt()); + m_nSubMode=m_settings->value("SubMode_JT65",0).toInt(); + ui->sbSubmode->setValue(m_settings->value("SubMode_JT65",0).toInt()); + QTimer::singleShot (50, [=] {on_sbSubmode_valueChanged(ui->sbSubmode->value());}); + m_bShMsgs=m_settings->value("ShMsgs_JT65",false).toBool(); + ui->cbShMsgs->setChecked(m_bShMsgs); + } else { + ui->sbSubmode->setValue(0); + ui->lh_decodes_title_label->setText(tr ("Band Activity")); + ui->rh_decodes_title_label->setText(tr ("Rx Frequency")); + } + if(bVHF) { + // 01234567890123456789012345678901234567 + displayWidgets(nWidgets("11111001010011011010110001010000000000")); + } else { + displayWidgets(nWidgets("11101000010011100001000000010000100000")); + } + fast_config(false); +// if(ui->cbShMsgs->isChecked()) { +// ui->cbAutoSeq->setChecked(false); +// ui->cbAutoSeq->setVisible(false); +// } + if (m_config.decode_at_52s() && m_config.auto_astro() && !ui->actionAstronomical_data->isChecked()) + ui->actionAstronomical_data->setChecked (true); + ui->txFirstCheckBox->setEnabled(true); + statusChanged(); +} + +void MainWindow::on_actionQ65_triggered() +{ + if (m_mode=="MSK144") QTimer::singleShot (75, [=] {on_actionQ65_triggered();}); + QTimer::singleShot (50, [=] { + ui->TxFreqSpinBox->setValue(m_settings->value("TxFreq_old",1500).toInt()); + ui->RxFreqSpinBox->setValue(m_settings->value("RxFreq_old",1500).toInt()); + }); + m_mode="Q65"; + if(m_specOp==SpecOp::HOUND) { + m_config.setSpecial_None(); + m_specOp=m_config.special_op_id(); + } + ui->actionQ65->setChecked(true); + switch_mode(Modes::Q65); + ui->cbAutoSeq->setChecked(true); + fast_config(false); + WSPR_config(false); + setup_status_bar(true); + m_bFastMode=false; + m_bFast9=false; + m_nsps=6912; //For symspec only + m_FFTSize = m_nsps / 2; + if (m_tci_audio) Q_EMIT m_config.transceiver_blocksize (m_FFTSize); + else Q_EMIT FFTSize (m_FFTSize); + m_hsymStop=49; + ui->sbTR->values ({15, 30, 60, 120, 300}); + // restore last used parameters + ui->sbTR->setValue (m_settings->value ("TRPeriod_Q65", 30).toInt()); + ui->sbFtol->setValue (m_settings->value ("Ftol_Q65", 50).toInt()); + m_nSubMode=m_settings->value("SubMode_Q65",0).toInt(); + ui->sbSubmode->setValue(m_settings->value("SubMode_Q65",0).toInt()); + QTimer::singleShot (50, [=] { + on_sbTR_valueChanged (ui->sbTR->value()); + on_sbSubmode_valueChanged(ui->sbSubmode->value()); + }); + m_bShMsgs=m_settings->value("ShMsgs_Q65",false).toBool(); + ui->cbShMsgs->setChecked(m_bShMsgs); + QString fname {QDir::toNativeSeparators(m_config.temp_dir().absoluteFilePath ("red.dat"))}; + m_wideGraph->setRedFile(fname); + m_wideGraph->setMode(m_mode); + m_wideGraph->setPeriod(m_TRperiod,6912); + m_wideGraph->setTol(ui->sbFtol->value()); + m_wideGraph->setRxFreq(ui->RxFreqSpinBox->value()); + m_wideGraph->setTxFreq(ui->TxFreqSpinBox->value()); + switch_mode (Modes::Q65); +// 01234567890123456789012345678901234567 + displayWidgets(nWidgets("11111101011011010011100000010000000011")); + ui->lh_decodes_headings_label->setText("UTC dB DT Freq " + tr ("Message")); + ui->rh_decodes_headings_label->setText("UTC dB DT Freq " + tr ("Message")); + if (m_tci_audio && ui->bandComboBox->currentText()!="OOB") + Q_EMIT m_config.transceiver_period(m_TRperiod); + + m_specOp=m_config.special_op_id(); + if(m_specOp!=SpecOp::NONE and m_specOp!=SpecOp::FOX and m_specOp!=SpecOp::HOUND) { + QString t0=""; + if(SpecOp::NA_VHF==m_specOp) t0="NA VHF"; + if(SpecOp::EU_VHF==m_specOp) t0="EU VHF"; + if(SpecOp::FIELD_DAY==m_specOp) t0="Field Day"; + if(SpecOp::RTTY==m_specOp) t0="FT RU"; + if(SpecOp::WW_DIGI==m_specOp) t0="WW Digi"; + if(SpecOp::ARRL_DIGI==m_specOp) t0="ARRL Digi"; + if(SpecOp::Q65_PILEUP==m_specOp) t0="Q65 Pileup"; + if(t0=="") { + ui->labDXped->setVisible(false); + } else { + ui->labDXped->setVisible(true); + ui->labDXped->setText(t0); + } + if(m_specOp!=SpecOp::Q65_PILEUP) { + on_contest_log_action_triggered(); + } else { + if(ui->txrb1->isChecked()) on_txb2_clicked(); + ui->tx1->setEnabled(true); + ui->txb1->setEnabled(true); + } + } + if (m_config.decode_at_52s() && m_config.auto_astro() && !ui->actionAstronomical_data->isChecked()) + ui->actionAstronomical_data->setChecked (true); + ui->txFirstCheckBox->setEnabled(true); + statusChanged(); +} + +void MainWindow::on_actionMSK144_triggered() +{ + m_hsymStop=105; + m_TRperiod=ui->sbTR->value(); + if(SpecOp::EU_VHF < m_specOp) { +// We are rejecting the requested mode change, so re-check the old mode + if("FT8"==m_mode) ui->actionFT8->setChecked(true); + if("JT4"==m_mode) ui->actionJT4->setChecked(true); + if("JT9"==m_mode) ui->actionJT9->setChecked(true); + if("JT65"==m_mode) ui->actionJT65->setChecked(true); + if("Q65"==m_mode) ui->actionQ65->setChecked(true); + if("WSPR"==m_mode) ui->actionWSPR->setChecked(true); + if("Echo"==m_mode) ui->actionEcho->setChecked(true); + if("FreqCal"==m_mode) ui->actionFreqCal->setChecked(true); + if("FST4"==m_mode) ui->actionFST4->setChecked(true); + if("FST4W"==m_mode) ui->actionFST4W->setChecked(true); +// Make sure that MSK144 is not checked. + ui->actionMSK144->setChecked(false); + MessageBox::warning_message (this, tr ("Improper mode"), + "MSK144 not available if Fox, Hound, Field Day, FT Roundup, WW Digi. or ARRL Digi contest is selected."); + return; + } + m_mode="MSK144"; + if(m_specOp==SpecOp::HOUND) { + m_config.setSpecial_None(); + m_specOp=m_config.special_op_id(); + } + ui->actionMSK144->setChecked(true); + switch_mode (Modes::MSK144); + m_nsps=6; + m_FFTSize = 7 * 512; + if (m_tci_audio) Q_EMIT m_config.transceiver_blocksize (m_FFTSize); + else Q_EMIT FFTSize (m_FFTSize); + setup_status_bar (true); + m_toneSpacing=0.0; + WSPR_config(false); + VHF_features_enabled(true); + ui->cbAutoSeq->setChecked(true); + m_bFastMode=true; + m_bFast9=false; + ui->sbTR->values ({5, 10, 15, 30}); + // restore last used parameters + if (!programStart) { + if (m_currentBand=="2m") ui->sbTR->setValue (m_msk144_tr2); + else if (m_currentBand=="6m" or m_currentBand=="4m") ui->sbTR->setValue (m_msk144_tr6); + else ui->sbTR->setValue (m_msk144_tr); + } + ui->txFirstCheckBox->setEnabled(true); + QTimer::singleShot (50, [=] {on_sbTR_valueChanged (ui->sbTR->value());}); + ui->sbFtol->setValue (m_settings->value ("Ftol_MSK144", 50).toInt()); // restore last used parameter + m_bShMsgs=m_settings->value("ShMsgs_MSK144",false).toBool(); + ui->cbShMsgs->setChecked(m_bShMsgs); + m_wideGraph->hide(); + m_fastGraph->showNormal(); + ui->TxFreqSpinBox->setValue(1500); + ui->RxFreqSpinBox->setValue(1500); + ui->RxFreqSpinBox->setMinimum(1400); + ui->RxFreqSpinBox->setMaximum(1600); + ui->RxFreqSpinBox->setSingleStep(10); + ui->lh_decodes_headings_label->setText(" UTC dB T Freq " + tr ("Message")); + ui->rh_decodes_headings_label->setText(" UTC dB T Freq " + tr ("Message")); + if (m_tci_audio && ui->bandComboBox->currentText()!="OOB") + Q_EMIT m_config.transceiver_period(m_TRperiod); + if (!m_tci_audio) { + m_modulator->setTRPeriod(m_TRperiod); // TODO - not thread safe + m_detector->setTRPeriod(m_TRperiod); // TODO - not thread safe + } + m_fastGraph->setTRPeriod(m_TRperiod); + ui->lh_decodes_title_label->setText(tr ("Band Activity")); + ui->rh_decodes_title_label->setText(tr ("Tx Messages")); + ui->actionMSK144->setChecked(true); + ui->rptSpinBox->setMinimum(-8); + ui->rptSpinBox->setMaximum(24); + ui->rptSpinBox->setValue(0); + ui->rptSpinBox->setSingleStep(1); + ui->sbFtol->values ({20, 50, 100, 150, 200, 250, 300, 350, 400, 450, 500}); + // 01234567890123456789012345678901234567 + displayWidgets(nWidgets("10111111010000000001000100011000000000")); + fast_config(m_bFastMode); + statusChanged(); + + QString t0=""; + if(SpecOp::NA_VHF==m_specOp) t0="NA VHF"; + if(SpecOp::EU_VHF==m_specOp) t0="EU VHF"; + if(t0=="") { + ui->labDXped->setVisible(false); + } else { + ui->labDXped->setVisible(true); + ui->labDXped->setText(t0); + on_contest_log_action_triggered(); + } + if(!(programStart or m_freqNominal == 0)) m_msk144basefreq = m_freqNominal; // MSK144 QSY +} + +void MainWindow::on_actionWSPR_triggered() +{ + m_mode="WSPR"; + if(m_specOp==SpecOp::HOUND) { + m_config.setSpecial_None(); + m_specOp=m_config.special_op_id(); + } + WSPR_config(true); + switch_mode (Modes::WSPR); + m_TRperiod=120.0; + if (m_tci_audio && ui->bandComboBox->currentText()!="OOB") + Q_EMIT m_config.transceiver_period(m_TRperiod); + if (!m_tci_audio) { + m_modulator->setTRPeriod(m_TRperiod); // TODO - not thread safe + m_detector->setTRPeriod(m_TRperiod); // TODO - not thread safe + } + m_nsps=6912; //For symspec only + m_FFTSize = m_nsps / 2; + if (m_tci_audio) Q_EMIT m_config.transceiver_blocksize (m_FFTSize); + else Q_EMIT FFTSize (m_FFTSize); + m_hsymStop=396; + m_toneSpacing=12000.0/8192.0; + setup_status_bar (false); + ui->actionWSPR->setChecked(true); + VHF_features_enabled(false); + ui->WSPRfreqSpinBox->setMinimum(1400); + ui->WSPRfreqSpinBox->setMaximum(1600); + m_wideGraph->setPeriod(m_TRperiod,m_nsps); + m_wideGraph->setMode(m_mode); + m_bFastMode=false; + m_bFast9=false; + ui->TxFreqSpinBox->setValue(ui->WSPRfreqSpinBox->value()); + // 01234567890123456789012345678901234567 + displayWidgets(nWidgets("00000000000000000101000000000000000000")); + fast_config(false); + statusChanged(); +} + +void MainWindow::on_actionEcho_triggered() +{ + int nd=int(m_ndepth&3); + on_actionJT4_triggered(); + // Don't allow decoding depth to be changed just because Echo mode was entered: + if(nd==1) ui->actionQuickDecode->setChecked (true); + if(nd==2) ui->actionMediumDecode->setChecked (true); + if(nd==3) ui->actionDeepestDecode->setChecked (true); + + m_mode="Echo"; + if(m_specOp==SpecOp::HOUND) { + m_config.setSpecial_None(); + m_specOp=m_config.special_op_id(); + } + ui->actionEcho->setChecked(true); + m_TRperiod=3.0; + if (m_tci_audio && ui->bandComboBox->currentText()!="OOB") + Q_EMIT m_config.transceiver_period(m_TRperiod); + if (!m_tci_audio) { + m_modulator->setTRPeriod(m_TRperiod); // TODO - not thread safe + m_detector->setTRPeriod(m_TRperiod); // TODO - not thread safe + } + m_nsps=6912; //For symspec only + m_FFTSize = m_nsps / 2; + if (m_tci_audio) Q_EMIT m_config.transceiver_blocksize (m_FFTSize); + else Q_EMIT FFTSize (m_FFTSize); + m_hsymStop=9; + m_toneSpacing=1.0; + switch_mode(Modes::Echo); + setup_status_bar (true); + m_wideGraph->setMode(m_mode); + ui->TxFreqSpinBox->setValue(1500); + ui->TxFreqSpinBox->setEnabled (false); + if(!m_echoGraph->isVisible()) m_echoGraph->show(); + if (!ui->actionAstronomical_data->isChecked ()) { + ui->actionAstronomical_data->setChecked (true); + } + m_bFastMode=false; + m_bFast9=false; + WSPR_config(true); + ui->lh_decodes_headings_label->setText(" UTC Hour Level Doppler Width N Q DF SNR dBerr TS EchoMsg"); + // 01234567890123456789012345678901234567 + displayWidgets(nWidgets("00000000000000000010001000000000000000")); + fast_config(false); + ui->sbEchoAvg->values ({1, 2, 5, 10, 20, 50, 100}); + statusChanged(); + monitor(false); //Don't auto-start Monitor in Echo mode. + + // Ensure that the correct frequency is set and displayed + QTimer::singleShot (500, [=] { + auto const& row = m_config.frequencies ()->best_working_frequency (m_freqNominal); + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0) on_bandComboBox_activated (row); + if (m_monitoring) ui->monitorButton->click(); + }); +} + +void MainWindow::on_actionFreqCal_triggered() +{ + on_actionJT9_triggered(); + m_mode="FreqCal"; + if(m_specOp==SpecOp::HOUND) { + m_config.setSpecial_None(); + m_specOp=m_config.special_op_id(); + } + ui->actionFreqCal->setChecked(true); + switch_mode(Modes::FreqCal); + m_wideGraph->setMode(m_mode); + ui->sbTR->values ({5, 10, 15, 30}); + on_sbTR_valueChanged (ui->sbTR->value()); + if (m_tci_audio && ui->bandComboBox->currentText()!="OOB") + Q_EMIT m_config.transceiver_period(m_TRperiod); + if (!m_tci_audio) { + m_modulator->setTRPeriod(m_TRperiod); // TODO - not thread safe + m_detector->setTRPeriod(m_TRperiod); // TODO - not thread safe + } + m_nsps=6912; //For symspec only + m_FFTSize = m_nsps / 2; + if (m_tci_audio) Q_EMIT m_config.transceiver_blocksize (m_FFTSize); + else Q_EMIT FFTSize (m_FFTSize); + m_hsymStop=((int(m_TRperiod/0.288))/8)*8; + m_frequency_list_fcal_iter = m_config.frequencies ()->begin (); + ui->RxFreqSpinBox->setValue(1500); + setup_status_bar (true); +// 18:15:47 0 1 1500 1550.349 0.100 3.5 10.2 + ui->lh_decodes_headings_label->setText(" UTC Freq CAL Offset fMeas DF Level S/N"); + ui->measure_check_box->setChecked (false); + // 01234567890123456789012345678901234567 + displayWidgets(nWidgets("00110100000000000000000000000100000000")); + statusChanged(); +} + +void MainWindow::switch_mode (Mode mode) +{ + no_a7_decodes = true; // Don't allow a7 decodes during the first period because they can be leftovers from the previous mode + msk144qsy = false; // MSK144 QSY + QTimer::singleShot ((int(1500.0*m_TRperiod)), [=] {no_a7_decodes = false;}); + if (m_mode != "Q65" && m_specOp==SpecOp::Q65_PILEUP) { + m_config.setSpecial_None(); + m_specOp=m_config.special_op_id(); + ui->tx1->setEnabled(true); + ui->txb1->setEnabled(true); + } + m_fastGraph->setMode(m_mode); + m_config.frequencies ()->filter (m_config.region (), mode, true); // filter on current time + auto const& row = m_config.frequencies ()->best_working_frequency (m_freqNominal); + if (!keep_frequency) { + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0 ) { + on_bandComboBox_activated (row); + } + } + ui->rptSpinBox->setSingleStep(1); + ui->rptSpinBox->setMinimum(-50); + ui->rptSpinBox->setMaximum(49); + ui->sbFtol->values ({1, 2, 5, 10, 20, 50, 100, 150, 200, 250, 300, 350, 400, 450, 500, 600, 700, 800, 900, 1000}); + ui->sbFST4W_FTol->values({1, 2, 5, 10, 20, 50, 100}); + if(m_mode=="MSK144") { + ui->RxFreqSpinBox->setMinimum(1400); + ui->RxFreqSpinBox->setMaximum(1600); + ui->RxFreqSpinBox->setSingleStep(25); + } else { + ui->RxFreqSpinBox->setMinimum(200); // UR 200->100 + ui->RxFreqSpinBox->setMaximum(5000); + ui->RxFreqSpinBox->setSingleStep(1); + } + bool b=m_mode=="FreqCal"; + ui->tabWidget->setVisible(!b); + if(b) { + ui->DX_controls_widget->setVisible(false); + ui->rh_decodes_widget->setVisible (false); // UR disable for AL + widescreen versions + ui->lh_decodes_title_label->setVisible(false); + } + QTimer::singleShot (500, [=] { + if (!(m_mode=="Echo" or ((m_mode=="Q65" or m_mode=="JT65") && m_config.decode_at_52s())) + && ui->actionAstronomical_data->isChecked () && m_config.auto_astro()) ui->actionAstronomical_data->setChecked (false); + }); + check_button_color(); +} + +void MainWindow::WSPR_config(bool b) +{ + ui->rh_decodes_widget->setVisible(!b); // UR disable for AL + widescreen version + ui->controls_stack_widget->setCurrentIndex (b && m_mode != "Echo" ? 1 : 0); + if(m_mode=="Echo") ui->controls_stack_widget->setCurrentIndex(2); + ui->QSO_controls_widget->setVisible (!b); + ui->DX_controls_widget->setVisible (!b or (m_mode=="Echo")); + ui->WSPR_controls_widget->setVisible (b); + ui->lh_decodes_title_label->setVisible(!b and ui->cbMenus->isChecked()); + ui->logQSOButton->setVisible(!b); + ui->DecodeButton->setEnabled(!b); + bool bFST4W=(m_mode=="FST4W"); + ui->sbTxPercent->setEnabled(!bFST4W or (tr("Random") == ui->RoundRobin->currentText())); + ui->band_hopping_group_box->setVisible(true); + ui->RoundRobin->setVisible(bFST4W); + ui->sbFST4W_RxFreq->setVisible(bFST4W); + ui->sbFST4W_FTol->setVisible(bFST4W); + ui->RoundRobin->lineEdit()->setAlignment(Qt::AlignCenter); + if(b and m_mode!="Echo" and m_mode!="FST4W") { + QString t="UTC dB DT Freq Drift Call Grid dBm "; + if(m_config.miles()) t += " mi"; + if(!m_config.miles()) t += " km"; + ui->lh_decodes_headings_label->setText(t); + if (m_config.is_transceiver_online ()) { + m_config.transceiver_tx_frequency (0); // turn off split + } + m_bSimplex = true; + } else + { + m_bSimplex = false; + } + enable_DXCC_entity (m_config.DXCC ()); // sets text window proportions and (re)inits the logbook +} + +void MainWindow::fast_config(bool b) +{ + m_bFastMode=b; + ui->TxFreqSpinBox->setEnabled(!b); + ui->sbTR->setVisible(b); + if(b and (m_bFast9 or m_mode=="MSK144")) { + m_wideGraph->hide(); + m_fastGraph->showNormal(); + } else { + m_wideGraph->showNormal(); + m_fastGraph->hide(); + } +} + +void MainWindow::on_TxFreqSpinBox_valueChanged(int n) +{ + if (m_config.superFox() && m_specOp==SpecOp::FOX && n!=750) { + ui->TxFreqSpinBox->setValue(750); + m_wideGraph->setTxFreq(750); + return; + } + m_config.transceiver_tune (false); // reset rig tuning + m_wideGraph->setTxFreq(n); +// if (ui->cbHoldTxFreq->isChecked ()) ui->RxFreqSpinBox->setValue(n); + if(m_mode!="MSK144") { + if (m_tci_audio) Q_EMIT m_config.transceiver_trfrequency(n - m_XIT); + else Q_EMIT transmitFrequency (n - m_XIT); + } + + if(m_mode=="Q65") { + if(((m_nSubMode==5 && m_TRperiod==120.0) || (m_nSubMode==4 && m_TRperiod==60.0) || (m_nSubMode==3 && m_TRperiod==30.0) || + (m_nSubMode==2 && m_TRperiod==15.0)) && abs(ui->TxFreqSpinBox->value() - 700) > 15) { + ui->TxFreqSpinBox->setStyleSheet("QSpinBox{background-color:red; color:white}"); + } else { + ui->TxFreqSpinBox->setStyleSheet(""); + } + } + if (m_mode != "MSK144" && m_mode != "FST4W" && m_mode != "WSPR" && m_mode != "Echo" && m_mode != "FreqCal" + && m_specOp!=SpecOp::FOX) { + QTimer::singleShot (200, [=] {m_settings->setValue("TxFreq_old",ui->TxFreqSpinBox->value());}); + } + if(m_specOp==SpecOp::FOX && !m_config.superFox()) QTimer::singleShot (50, [=] {m_TxFreqFox=n;}); + + // UK stations must transmit below 5358 kHz on 60m + if((m_config.my_callsign().startsWith("G") or m_config.my_callsign().startsWith("M") + or m_config.my_callsign().startsWith("2")) && (m_freqNominal + ui->TxFreqSpinBox->value()) > 5357950) { + QString band=m_config.bands()->find(m_freqNominal); + if(band=="60m") { + ui->TxFreqSpinBox->setValue(5357950 - m_freqNominal); + m_wideGraph->setTxFreq(5357950 - m_freqNominal); + QTimer::singleShot (0, [=] { // don't block guiUpdate + MessageBox::information_message (this, tr ("UK stations must transmit below 5358 kHz on 60m.")); + }); + } + } + statusUpdate (); +} + +void MainWindow::on_RxFreqSpinBox_valueChanged(int n) +{ + if (m_config.superFox() && m_specOp==SpecOp::HOUND) { + if (ui->RxFreqSpinBox->value() < 200) { + ui->RxFreqSpinBox->setValue(200); + return; + } + if (ui->RxFreqSpinBox->value() > 1400) { + ui->RxFreqSpinBox->setValue(1400); + return; + } + } + m_wideGraph->setRxFreq(n); + if (m_mode == "FreqCal") { + setRig (); + } + if (m_mode != "MSK144" && m_mode != "FST4W" && m_mode != "WSPR" && m_mode != "Echo" && m_mode != "FreqCal" + && !(SpecOp::HOUND == m_specOp && m_config.superFox())) { + QTimer::singleShot (200, [=] {m_settings->setValue("RxFreq_old",ui->RxFreqSpinBox->value());}); + } + statusUpdate (); +} + +void MainWindow::on_sbF_Low_valueChanged(int n) +{ + m_wideGraph->setFST4_FreqRange(n,ui->sbF_High->value()); + chk_FST4_freq_range(); +} + +void MainWindow::on_sbF_High_valueChanged(int n) +{ + m_wideGraph->setFST4_FreqRange(ui->sbF_Low->value(),n); + chk_FST4_freq_range(); +} + +void MainWindow::chk_FST4_freq_range() +{ + if(!m_bOK_to_chk) return; + if(ui->sbF_Low->value() < m_wideGraph->nStartFreq()) ui->sbF_Low->setValue(m_wideGraph->nStartFreq()); + if(ui->sbF_High->value() > m_wideGraph->Fmax()) { + int n=m_wideGraph->Fmax()/100; + ui->sbF_High->setValue(100*n); + } + int maxDiff=2000; + if(m_TRperiod==120) maxDiff=1000; + if(m_TRperiod==300) maxDiff=400; + if(m_TRperiod>=900) maxDiff=200; + int diff=ui->sbF_High->value() - ui->sbF_Low->value(); + + if(diff<100 or diff>maxDiff) { + ui->sbF_Low->setStyleSheet("QSpinBox { color: white; background-color: red; }"); + ui->sbF_High->setStyleSheet("QSpinBox { color: white; background-color: red; }"); + } else { + ui->sbF_Low->setStyleSheet(""); + ui->sbF_High->setStyleSheet(""); + } +} + +//ft8md +void MainWindow::on_actionDecFT8cycles1_triggered() { m_nFT8Cycles=1; ui->actionDecFT8cycles1->setChecked(true); } +void MainWindow::on_actionDecFT8cycles2_triggered() { m_nFT8Cycles=2; ui->actionDecFT8cycles2->setChecked(true); } +void MainWindow::on_actionDecFT8cycles3_triggered() { m_nFT8Cycles=3; ui->actionDecFT8cycles3->setChecked(true); } + +void MainWindow::on_actionRXfLow_triggered() { m_nFT8RXfSens=1; ui->actionRXfLow->setChecked(true); } +void MainWindow::on_actionRXfMedium_triggered() { m_nFT8RXfSens=2; ui->actionRXfMedium->setChecked(true); } +void MainWindow::on_actionRXfHigh_triggered() { m_nFT8RXfSens=3; ui->actionRXfHigh->setChecked(true); } + +void MainWindow::on_actionMTAuto_triggered() { m_ft8threads=0; } +void MainWindow::on_actionMT1_triggered() { m_ft8threads=1; } +void MainWindow::on_actionMT2_triggered() { m_ft8threads=2; } +void MainWindow::on_actionMT3_triggered() { m_ft8threads=3; } +void MainWindow::on_actionMT4_triggered() { m_ft8threads=4; } +void MainWindow::on_actionMT5_triggered() { m_ft8threads=5; } +void MainWindow::on_actionMT6_triggered() { m_ft8threads=6; } +void MainWindow::on_actionMT7_triggered() { m_ft8threads=7; } +void MainWindow::on_actionMT8_triggered() { m_ft8threads=8; } +void MainWindow::on_actionMT9_triggered() { m_ft8threads=9; } +void MainWindow::on_actionMT10_triggered() { m_ft8threads=10; } +void MainWindow::on_actionMT11_triggered() { m_ft8threads=11; } +void MainWindow::on_actionMT12_triggered() { m_ft8threads=12; } + +void MainWindow::on_actionFT8SensMin_toggled(bool checked) { if(checked) m_ft8Sensitivity=1; } +void MainWindow::on_actionlowFT8thresholds_toggled(bool checked) { if(checked) m_ft8Sensitivity=2; } +void MainWindow::on_actionFT8subpass_toggled(bool checked) { if(checked) m_ft8Sensitivity=3; } +void MainWindow::on_actionStartTwoStage_toggled(bool checked) { if(checked) m_ft8DecoderStart=0; } +void MainWindow::on_actionStartThreeStage_toggled(bool checked) { if(checked) m_ft8DecoderStart=1; } +void MainWindow::on_actionStartEarly_toggled(bool checked) { if(checked) m_ft8DecoderStart=2; } +void MainWindow::on_actionStartNormal_toggled(bool checked) { if(checked) m_ft8DecoderStart=3; } +void MainWindow::on_actionStartLate_toggled(bool checked) { if(checked) m_ft8DecoderStart=4; } +void MainWindow::on_actionFT8WidebandDXCallSearch_toggled(bool checked) { m_FT8WideDxCallSearch=checked; } +void MainWindow::on_actionUse_multithreaded_FT8_decoder_triggered(bool checked) +{ + m_multithreadFT8 = checked; + dec_data.params.lmultift8 = m_multithreadFT8; + qDebug() << "m_multithreadFT8 is" << m_multithreadFT8; + qDebug() << "dec_data.params.lmultift8 is" << dec_data.params.lmultift8; + if (checked && !(m_specOp==SpecOp::HOUND && m_config.superFox())) { + if (m_ft8DecoderStart==0) m_hsymStop=49; + else if (m_ft8DecoderStart==1) { + m_hsymStop=50; + m_earlyDecode2=46; + } + else if (m_ft8DecoderStart==2) m_hsymStop=48; + else if (m_ft8DecoderStart==3) m_hsymStop=49; + else if (m_ft8DecoderStart==4) m_hsymStop=50; + } else { + m_hsymStop=50; + m_earlyDecode2=47; + } +} +//ft8md + +void MainWindow::on_actionQuickDecode_toggled (bool checked) +{ + m_ndepth ^= (-checked ^ m_ndepth) & 0x00000001; +} + +void MainWindow::on_actionMediumDecode_toggled (bool checked) +{ + m_ndepth ^= (-checked ^ m_ndepth) & 0x00000002; +} + +void MainWindow::on_actionDeepestDecode_toggled (bool checked) +{ + m_ndepth ^= (-checked ^ m_ndepth) & 0x00000003; +} + +void MainWindow::on_actionInclude_averaging_toggled (bool checked) +{ + m_ndepth ^= (-checked ^ m_ndepth) & 0x00000010; + statusChanged(); +} + +void MainWindow::on_actionInclude_correlation_toggled (bool checked) +{ + m_ndepth ^= (-checked ^ m_ndepth) & 0x00000020; +} + +void MainWindow::on_actionEnable_AP_DXcall_toggled (bool checked) +{ + m_ndepth ^= (-checked ^ m_ndepth) & 0x00000040; +} + +void MainWindow::on_actionAuto_Clear_Avg_toggled (bool checked) +{ + m_ndepth ^= (-checked ^ m_ndepth) & 0x00000080; +} + +void MainWindow::on_actionErase_ALL_TXT_triggered() //Erase ALL.TXT +{ + int ret = MessageBox::query_message (this, tr ("Confirm Erase"), + tr ("Are you sure you want to erase file ALL.TXT?")); + if(ret==MessageBox::Yes) { + QFile f {m_config.writeable_data_dir ().absoluteFilePath ("ALL.TXT")}; + f.remove(); + m_RxLog=1; + } +} + +void MainWindow::on_actionErase_list_of_Q65_callers_triggered() +{ + int ret = MessageBox::query_message (this, tr ("Confirm Erase"), + tr ("Are you sure you want to erase the list of Q65 callers?")); + if(ret==MessageBox::Yes) { + QFile f {m_config.writeable_data_dir ().absoluteFilePath ("tsil.3q")}; + f.remove(); + } +} + +void MainWindow::on_reset_cabrillo_log_action_triggered () +{ + if (MessageBox::Yes == MessageBox::query_message (this, tr ("Confirm Reset"), + tr ("Are you sure you want to erase your contest log?"), + tr ("Doing this will remove all QSO records for the current contest. " + "They will be kept in the ADIF log file but will not be available " + "for export in your Cabrillo log."))) + { + if(m_config.RTTY_Exchange()!="SCC") ui->sbSerialNumber->setValue(1); + m_logBook.contest_log ()->reset (); + m_activeCall.clear(); //Erase the QMap of active calls + m_EMECall.clear(); //ditto for EME calls + m_score=0; + if (m_ActiveStationsWidget) { + m_ActiveStationsWidget->setScore(0); + if(m_mode=="Q65") m_ActiveStationsWidget->setRate(0); + } + } +} + +void MainWindow::on_actionExport_Cabrillo_log_triggered() +{ + if (QDialog::Accepted == ExportCabrillo {m_settings, &m_config, m_logBook.contest_log ()}.exec()) + { + MessageBox::information_message (this, tr ("Cabrillo Log saved")); + } +} + + +void MainWindow::on_actionErase_wsjtx_log_adi_triggered() +{ + int ret = MessageBox::query_message (this, tr ("Confirm Erase"), + tr ("Are you sure you want to erase file wsjtx_log.adi?")); + if(ret==MessageBox::Yes) { + QFile f {m_config.writeable_data_dir ().absoluteFilePath ("wsjtx_log.adi")}; + f.remove(); + } +} + +void MainWindow::on_actionErase_WSPR_hashtable_triggered() +{ + int ret = MessageBox::query_message(this, tr ("Confirm Erase"), + tr ("Are you sure you want to erase the WSPR hashtable?")); + if(ret==MessageBox::Yes) { + QFile f {m_config.writeable_data_dir().absoluteFilePath("hashtable.txt")}; + f.remove(); + } +} + + +void MainWindow::on_actionOpen_log_directory_triggered () +{ + QDesktopServices::openUrl (QUrl::fromLocalFile (m_config.writeable_data_dir ().absolutePath ())); +} + +void MainWindow::on_bandComboBox_currentIndexChanged (int index) +{ + auto const& frequencies = m_config.frequencies (); + auto const& source_index = frequencies->mapToSource (frequencies->index (index, FrequencyList_v2_101::frequency_column)); + Frequency frequency {m_freqNominal}; + if (source_index.isValid ()) + { + frequency = frequencies->frequency_list ()[source_index.row ()].frequency_; + } + + // Lookup band + auto const& band = m_config.bands ()->find (frequency); + ui->bandComboBox->setCurrentText (band.size () ? band : m_config.bands ()->oob ()); + setXIT (ui->TxFreqSpinBox->value ()); + displayDialFrequency (); +} + +void MainWindow::on_bandComboBox_editTextChanged (QString const& text) +{ + if (text.size () && m_config.bands ()->oob () != text) + { + ui->bandComboBox->lineEdit ()->setStyleSheet ({}); + } + else + { + ui->bandComboBox->lineEdit ()->setStyleSheet ("QLineEdit {color: yellow; background-color : red;}"); + } +} + +void MainWindow::on_bandComboBox_activated (int index) +{ + auto const& frequencies = m_config.frequencies (); + auto const& source_index = frequencies->mapToSource (frequencies->index (index, FrequencyList_v2_101::frequency_column)); + Frequency frequency {m_freqNominal}; + if (source_index.isValid ()) + { + frequency = frequencies->frequency_list ()[source_index.row ()].frequency_; + } + m_bandEdited = true; + band_changed (frequency); + m_wideGraph->setRxBand (m_config.bands ()->find (frequency)); +// m_specOp=m_config.special_op_id(); +// if (m_specOp==SpecOp::HOUND) auto_tx_mode(false); // only required if RETURN intiates TXing +} + +void MainWindow::band_changed (Frequency f) +{ + msk144qsy = false; // MSK144 QSY + // Don't allow a7 decodes during the first period because they can be leftovers from the previous band + no_a7_decodes = true; + QTimer::singleShot ((int(1500.0*m_TRperiod)), [=] {no_a7_decodes = false;}); + + // Set the attenuation value if options are checked + if (m_config.pwrBandTxMemory() && !m_tune) { + auto const&curBand = ui->bandComboBox->currentText(); + if (m_pwrBandTxMemory.contains(curBand)) { + ui->outAttenuation->setValue(m_pwrBandTxMemory[curBand].toInt()); + } + else { + m_pwrBandTxMemory[curBand] = ui->outAttenuation->value(); + } + } + + if (m_bandEdited && !keep_frequency) { + if (m_mode!="WSPR" && !ui->pbBandHopping->isChecked() && !ui->DX_Call_Button->isChecked()) { // preserves auto Tx + if (f + m_wideGraph->nStartFreq () > m_freqNominal + ui->TxFreqSpinBox->value () + || f + m_wideGraph->nStartFreq () + m_wideGraph->fSpan () <= + m_freqNominal + ui->TxFreqSpinBox->value ()) { +// qDebug () << "start f:" << m_wideGraph->nStartFreq () << "span:" << m_wideGraph->fSpan () << "DF:" << ui->TxFreqSpinBox->value (); + // disable auto Tx if "blind" QSY outside of waterfall + ui->stopTxButton->click (); // halt any transmission + auto_tx_mode (false); // disable auto Tx +// m_send_RR73 = false; // force user to reassess on new band + } + } + m_lastBand.clear (); + m_bandEdited = false; + if (m_config.spot_to_psk_reporter ()) + { + // Upload any queued spots before changing band + m_psk_Reporter.sendReport(); + } + if (!m_transmitting) monitor (true); + if ("FreqCal" == m_mode) + { + m_frequency_list_fcal_iter = m_config.frequencies ()->find (f); + } + if(m_tci) { + m_freqNominal = f; + m_freqTxNominal = m_freqNominal; + } + setRig (f); + setXIT (ui->TxFreqSpinBox->value ()); + m_specOp=m_config.special_op_id(); + if (m_specOp==SpecOp::FOX) FoxReset("BandChange"); // when changing bands, don't preserve the Fox queues + m_lastloggedcall.clear(); //ft8md + if (m_mode=="MSK144" && !(programStart or m_freqNominal == 0)) m_msk144basefreq = m_freqNominal; // MSK144 QSY + } + + // Erase the decodedTextBrowsers only if the band really changed + static QString band_save; + if (m_config.bands()->find(f) == band_save) return; // band didn't change + band_save = m_config.bands()->find(f); + m_band_changed = true; + if (m_astroWidget && !programStart) { + m_astroWidget->setSkedFreq(0.000001*f); + m_skedFreq=0.000001*f; + } + if (m_mode=="MSK144" && !programStart) { // restore MSK144 TRperiods by band + QTimer::singleShot (750, [=] { + if (m_currentBand=="2m" && m_msk144_tr2!=ui->sbTR->value()) ui->sbTR->setValue (m_msk144_tr2); + else if ((m_currentBand=="6m" or m_currentBand=="4m") && m_msk144_tr6!=ui->sbTR->value()) ui->sbTR->setValue (m_msk144_tr6); + else ui->sbTR->setValue (m_msk144_tr); + }); + } + + // UK stations must transmit below 5358 kHz on 60m + if((m_config.my_callsign().startsWith("G") or m_config.my_callsign().startsWith("M") + or m_config.my_callsign().startsWith("2")) && (m_freqNominal + ui->TxFreqSpinBox->value()) > 5357950) { + QString band=m_config.bands()->find(m_freqNominal); + if(band=="60m") { + ui->TxFreqSpinBox->setValue(5357950 - m_freqNominal); + m_wideGraph->setTxFreq(5357950 - m_freqNominal); + QTimer::singleShot (0, [=] { // don't block guiUpdate + MessageBox::information_message (this, tr ("UK stations must transmit below 5358 kHz on 60m.")); + }); + } + } + +/* + //ft8md + qint64 ms = QDateTime::currentMSecsSinceEpoch() % 86400000; + int nsec=ms/1000; + double TRperiod=60.0; // TR period is the only reliable way in this point of code at the mode change + if(m_mode=="FT8") TRperiod=15.0; + else if(m_mode=="FT4") TRperiod=7.5; + int nseqmod = fmod(double(nsec),TRperiod); + m_nsecBandChanged=nseqmod; + dec_data.params.nsecbandchanged=m_nsecBandChanged; + //ft8md end +*/ + + if (m_config.erase_BandActivity () && !not_erase) { + ui->decodedTextBrowser->erase (); // Mod for WD5DHK + ui->decodedTextBrowser2->erase (); + } + if (m_mode=="Echo" && m_monitoring) ui->monitorButton->click(); +} + +void MainWindow::enable_DXCC_entity (bool on) +{ + if (on and m_mode!="WSPR" and m_mode!="FST4W" and m_mode!="Echo") { + //m_logBook.init(); // re-read the log and cty.dat files +// ui->gridLayout->setColumnStretch(0,55); // adjust proportions of text displays +// ui->gridLayout->setColumnStretch(1,45); + } else { +// ui->gridLayout->setColumnStretch(0,0); +// ui->gridLayout->setColumnStretch(1,0); + } + updateGeometry (); +} + +void MainWindow::on_rptSpinBox_valueChanged(int n) +{ + int step=ui->rptSpinBox->singleStep(); + if(n%step !=0) { + n++; + ui->rptSpinBox->setValue(n); + } + m_rpt=QString::number(n); + int ntx0=m_ntx; + genStdMsgs(m_rpt); + m_ntx=ntx0; + if(m_ntx==1) ui->txrb1->setChecked(true); + if(m_ntx==2) ui->txrb2->setChecked(true); + if(m_ntx==3) ui->txrb3->setChecked(true); + if(m_ntx==4) ui->txrb4->setChecked(true); + if(m_ntx==5) ui->txrb5->setChecked(true); + if(m_ntx==6) ui->txrb6->setChecked(true); + statusChanged(); +} + +void MainWindow::on_tuneButton_clicked (bool checked) +{ + ui->pbBandHopping->setChecked(false); // disable band hopping + // prevent tuning on top of a SuperFox message + if (SpecOp::HOUND==m_specOp && m_config.superFox() && !m_tune) { + QDateTime now = QDateTime::currentDateTimeUtc(); + int s = now.time().toString("ss").toInt(); + if ((s >= 0 && s < 15) || (s >= 30 && s < 45)) { + ui->tuneButton->setChecked (false); + m_config.transceiver_tune (false); // reset rig tuning + return; + } + } + m_config.transceiver_tune (false); // reset rig tuning + if (blocked) return; + if (m_auto && !(m_mode=="WSPR" || m_mode=="FST4W")) ui->autoButton->click(); // stop any other transmission + stopWRTimer.stop(); // stop any Wait & Reply timeout + stopWCTimer.stop(); // stop any Wait & Call timeout + if (checked && m_config.tune_watchdog() && !(m_mode=="WSPR" || m_mode=="FST4W")) { + tuneATU_Timer.start (m_config.tune_watchdog_time()*1000); // tune watchdog + } + if (!checked) { + tuneATU_Timer.stop (); // stop tune watchdog when stopping Tune manually + ui->tuneButton->setText("Tune"); + } + static bool lastChecked = false; + if (lastChecked == checked) return; + lastChecked = checked; + if (checked && m_tune==false) { // we're starting tuning so remember Tx and change pwr to Tune value + if (m_config.pwrBandTuneMemory ()) { + auto const& curBand = ui->bandComboBox->currentText(); + m_pwrBandTxMemory[curBand] = ui->outAttenuation->value(); // remember our Tx pwr + m_PwrBandSetOK = false; + if (m_pwrBandTuneMemory.contains(curBand)) { + ui->outAttenuation->setValue(m_pwrBandTuneMemory[curBand].toInt()); // set to Tune pwr + } + m_PwrBandSetOK = true; + } + } + if (m_tune) { + tuneButtonTimer.start(250); + } else { + m_sentFirst73=false; + itone[0]=0; + on_monitorButton_clicked (true); + m_tune=true; + } + if (m_tci_audio) Q_EMIT m_config.transceiver_tune(checked); + else Q_EMIT tune (checked); +} + + +void MainWindow::end_tuning () +{ + tuneATU_Timer.stop (); // stop tune watchdog when stopping Tune manually + on_stopTxButton_clicked (); + // we're turning off so remember our Tune pwr setting and reset to Tx pwr + if (m_config.pwrBandTuneMemory() || m_config.pwrBandTxMemory()) { + auto const& curBand = ui->bandComboBox->currentText(); + m_pwrBandTuneMemory[curBand] = ui->outAttenuation->value(); // remember our Tune pwr + m_PwrBandSetOK = false; + ui->outAttenuation->setValue(m_pwrBandTxMemory[curBand].toInt()); // set to Tx pwr + m_PwrBandSetOK = true; + } +} + +void MainWindow::stop_tuning () +{ + tuneATU_Timer.stop (); // stop tune watchdog when stopping Tune manually + on_tuneButton_clicked(false); + ui->tuneButton->setChecked (false); + m_bTxTime=false; + m_tune=false; +} + +void MainWindow::stopTuneATU() +{ + tuneATU_Timer.stop (); // stop tune watchdog when stopping Tune manually + on_tuneButton_clicked(false); + m_bTxTime=false; + ui->tuneButton->setText("Tune"); +} + +void MainWindow::on_stopTxButton_clicked() // Stop Tx +{ + ui->pbBandHopping->setChecked(false); // disable band hopping + if (m_tune) stop_tuning (); + if (m_auto and !m_tuneup) auto_tx_mode (false); + m_btxok=false; + m_bCallingCQ = false; + m_bAutoReply = false; // ready for next + m_maxPoints=-1; + if (ui->DX_Call_Button->isChecked()) ui->DX_Call_Button->click (); + stopWRTimer.stop(); // Stop any Wait & Reply timeout + stopWCTimer.stop(); // Stop any Wait & Call timeout + tuneATU_Timer.stop (); // stop tune watchdog when stopping Tune manually + no_wait_and_call = false; + m_specOp=m_config.special_op_id(); + if (ui->respondComboBox->isVisible() && ui->respondComboBox->currentText() != "CQ: None") { + Dpoints=0; // reset points + maxDPoints=0; // reset points + dBpoints=-28; // reset points + dBpoints2=99; // reset points + maxdBPoints=-28; // reset points + mindBPoints=99; // reset points + } + pounce = false; + ui->autoButton->setChecked(false); // ensure auoButton is unchecked + filtered = false; + ignored = false; + m_muted = false; + check_button_color(); +} + +void MainWindow::rigOpen () +{ + update_dynamic_property (ui->readFreq, "state", "warning"); + ui->readFreq->setText (""); + ui->readFreq->setEnabled (true); + m_config.transceiver_online (); + m_config.sync_transceiver (true, true); +} + +void MainWindow::on_pbR2T_clicked() +{ + ui->TxFreqSpinBox->setValue(ui->RxFreqSpinBox->value ()); +} + +void MainWindow::on_pbT2R_clicked() +{ + if (ui->RxFreqSpinBox->isEnabled ()) + { + ui->RxFreqSpinBox->setValue (ui->TxFreqSpinBox->value ()); + } +} + + +void MainWindow::on_readFreq_clicked() +{ + if (m_transmitting) return; + + if (m_config.transceiver_online ()) + { + m_config.sync_transceiver (true, true); + } +} + +void MainWindow::setXIT(int n, Frequency base) +{ + if (m_transmitting && !m_config.tx_QSY_allowed ()) return; + // If "CQ nnn ..." feature is active, set the proper Tx frequency + if(m_config.split_mode () && ui->cbCQTx->isEnabled () && ui->cbCQTx->isVisible () && + ui->cbCQTx->isChecked()) + { + if (6 == m_ntx || (7 == m_ntx && m_gen_message_is_cq)) + { + // All conditions are met, use calling frequency + base = m_freqNominal / 1000000 * 1000000 + 1000 * ui->sbCQTxFreq->value () + m_XIT; + } + } + if (!base) base = m_freqNominal; + m_XIT = 0; + if (!(m_bSimplex || (SpecOp::FOX==m_specOp && m_config.superFox()))) { + // m_bSimplex is false, so we can use split mode if requested + if (m_config.split_mode () && (!m_config.enable_VHF_features () || + m_mode=="FT4" || m_mode == "FT8" || m_mode=="FST4")) { + // Don't use XIT for VHF & up + m_XIT=(n/500)*500 - 1500; + } + + if ((m_monitoring || m_transmitting) + && m_config.is_transceiver_online () + && m_config.split_mode ()) + { + // All conditions are met, reset the transceiver Tx dial + // frequency + m_freqTxNominal = base + m_XIT; + if (m_astroWidget) m_astroWidget->nominal_frequency (m_freqNominal, m_freqTxNominal); + m_config.transceiver_tx_frequency (m_freqTxNominal + m_astroCorrection.tx); + } + } + if (SpecOp::FOX==m_specOp && m_config.superFox() + && (m_monitoring || m_transmitting) + && m_config.is_transceiver_online ()) + { + // the transceiver Tx dial frequency must be consistent with + // zero m_XIT for SuperFox + m_freqTxNominal = base; + if (m_astroWidget) m_astroWidget->nominal_frequency (m_freqNominal, m_freqTxNominal); + m_config.transceiver_tx_frequency (m_freqTxNominal + m_astroCorrection.tx); + } + + //Now set the audio Tx freq + if (m_tci_audio) Q_EMIT m_config.transceiver_trfrequency(ui->TxFreqSpinBox->value () - m_XIT); + else Q_EMIT transmitFrequency (ui->TxFreqSpinBox->value () - m_XIT); +} + +void MainWindow::setFreq4(int rxFreq, int txFreq) +{ + if (m_mode=="Q65" && ui->actionDisable_clicks_on_waterfall->isVisible() && ui->actionDisable_clicks_on_waterfall->isChecked() + && !(Qt::AltModifier & QApplication::keyboardModifiers ())) return; + if (m_mode=="ECHO") return; // we do not adjust rx/tx for echo mode -- always 1500Hz + if (ui->RxFreqSpinBox->isEnabled () && !(SpecOp::HOUND==m_specOp && m_config.superFox() && + (rxFreq < 700 or rxFreq > 800))) ui->RxFreqSpinBox->setValue(rxFreq); + if(m_mode=="WSPR" or m_mode=="FST4W") { + ui->WSPRfreqSpinBox->setValue(txFreq); + } else { + if (ui->TxFreqSpinBox->isEnabled ()) { + ui->TxFreqSpinBox->setValue(txFreq); + if ("FT8" == m_mode || "FT4" == m_mode || m_mode=="FST4") + { + // we need to regenerate the current transmit waveform for + // GFSK modulated modes + if (m_transmitting) m_restart = true; + } + } + else if (m_config.enable_VHF_features () + && (Qt::ControlModifier & QApplication::keyboardModifiers ())) { + // for VHF & up we adjust Tx dial frequency to equalize Tx to Rx + // when user CTRL+clicks on waterfall + auto temp = ui->TxFreqSpinBox->value (); + ui->RxFreqSpinBox->setValue (temp); + setRig (m_freqNominal + txFreq - temp); + setXIT (ui->TxFreqSpinBox->value ()); + } + } +} + +void MainWindow::handle_transceiver_update (Transceiver::TransceiverState const& s) +{ + Transceiver::TransceiverState old_state {m_rigState}; + //transmitDisplay (s.ptt ()); + if (s.ptt () // && !m_rigState.ptt () + ) { // safe to start audio + // (caveat - DX Lab Suite Commander) + if (m_tx_when_ready && g_iptt) { // waiting to Tx and still needed + int ms_delay=1000*m_config.txDelay(); + if(m_mode=="FT4") ms_delay=20; + ptt1Timer.start(ms_delay); //Start-of-transmission sequencer delay + m_tx_when_ready = false; + } + } + + // Display PWR and SWR + if(m_config.PWR_and_SWR()) { + if (!band_hopping_label.isVisible ()) { + statusBar ()->addWidget (&band_hopping_label); + band_hopping_label.setMinimumSize (QSize {80, 18}); + band_hopping_label.show(); + } + if (m_rigState.power() != s.power() && m_transmitting) { + ui->label->setText(QString {tr("%1 W")}.arg (round(s.power()/1000.))); + if (round(s.power()/1000.) >= 100) { + qreal pointSize = m_config.text_font().pointSizeF(); + + ui->label->setMinimumWidth (2.8*pointSize + 16); + ui->outAttenuation->setMinimumWidth (2.8*pointSize + 16); + } + } else { + ui->label->setText("Pwr"); + } + if (m_rigState.swr() != s.swr()) { + static bool s_alreadyShowingSWRAlert = false; + if (s.swr() > 0) { + if (s.swr()>150) band_hopping_label.setStyleSheet ("QLabel{color: #000000; background-color: #ffff00}"); + if (s.swr()>200) band_hopping_label.setStyleSheet ("QLabel{color: #ffffff; background-color: #ff0000}"); + if (s.swr()>250 && m_config.check_SWR()) { + if (!s_alreadyShowingSWRAlert) { // avoid recursion + on_stopTxButton_clicked(); + s_alreadyShowingSWRAlert = true; + MessageBox::warning_message (this, tr ("SWR > 2.5 !!!\n\n" + "Transmission was stopped\n\n" + "Check your antenna")); + s_alreadyShowingSWRAlert = false; + } + } + if (s.swr()<1000) { + band_hopping_label.setText(QString {"SWR: %1"}.arg (s.swr()/100.,0,'f',2)); + } else { + band_hopping_label.setText(QString {"SWR: %1"}.arg (s.swr()/100.,0,'f',1)); + } + } else { + if (!s_alreadyShowingSWRAlert) { // retain value and color if SWR was > 2.5 + band_hopping_label.setText(""); + band_hopping_label.setStyleSheet(""); + } + } + } + } + + m_rigState = s; + auto old_freqNominal = m_freqNominal; + if (!old_freqNominal) + { + // always take initial rig frequency to avoid start up problems + // with bogus Tx frequencies + m_freqNominal = s.frequency (); + } + if (old_state.online () == false && s.online () == true) + { + // initializing + on_monitorButton_clicked (!(m_config.monitor_off_at_startup() or m_mode=="Echo")); + } + if (s.frequency () != old_state.frequency () || s.split () != m_splitMode) + { + m_splitMode = s.split (); + if (!s.ptt ()) + { + m_freqNominal = s.frequency () - m_astroCorrection.rx; + if (old_freqNominal != m_freqNominal) + { + m_freqTxNominal = m_freqNominal; + genCQMsg (); + } + + if (m_monitoring) + { + m_lastMonitoredFrequency = m_freqNominal; + } + if (m_lastDialFreq != m_freqNominal && + (m_mode != "MSK144" + || !(ui->cbCQTx->isEnabled () && ui->cbCQTx->isVisible () && ui->cbCQTx->isChecked()))) { + + if (m_lastDialFreq != m_freqNominal and m_ActiveStationsWidget != NULL) { + m_recentCall.clear(); + if(m_mode!="Q65") m_ActiveStationsWidget->erase(); + } + + m_lastDialFreq = m_freqNominal; + m_secBandChanged=QDateTime::currentMSecsSinceEpoch()/1000; +// pskSetLocal (); // better be done after a band change + statusChanged(); + m_wideGraph->setDialFreq(m_freqNominal / 1.e6); + } + } else { + m_freqTxNominal = s.split () ? s.tx_frequency () - m_astroCorrection.tx : s.frequency (); + } + if (m_astroWidget) m_astroWidget->nominal_frequency (m_freqNominal, m_freqTxNominal); + } + // ensure frequency display is correct + if (m_astroWidget && old_state.ptt () != s.ptt ()) setRig (); + + displayDialFrequency (); + update_dynamic_property (ui->readFreq, "state", "ok"); + ui->readFreq->setEnabled (false); + ui->readFreq->setText (s.split () ? "S" : ""); +} + +void MainWindow::handle_transceiver_failure (QString const& reason) +{ + update_dynamic_property (ui->readFreq, "state", "error"); + ui->readFreq->setEnabled (true); + on_stopTxButton_clicked (); + qDebug() << "MainWindow::handle_transceiver_failure fired"; + rigFailure (reason); + rigFailed = true; +} + +void MainWindow::rigFailure (QString const& reason) +{ + if (m_first_error) + { + // one automatic retry + QTimer::singleShot (0, this, SLOT (rigOpen ())); + m_first_error = false; + } + else + { + if (m_splash && m_splash->isVisible ()) m_splash->hide (); + m_rigErrorMessageBox.setDetailedText (reason + "\n\nTimestamp: " +#if QT_VERSION >= QT_VERSION_CHECK (5, 8, 0) + + QDateTime::currentDateTimeUtc ().toString (Qt::ISODateWithMs) +#else + + QDateTime::currentDateTimeUtc ().toString ("yyyy-MM-ddTHH:mm:ss.zzzZ") +#endif + ); + + // don't call slot functions directly to avoid recursion + m_rigErrorMessageBox.exec (); + auto const clicked_button = m_rigErrorMessageBox.clickedButton (); + if (clicked_button == m_configurations_button) + { + ui->menuConfig->exec (QCursor::pos ()); + } + else + { + switch (m_rigErrorMessageBox.standardButton (clicked_button)) + { + case MessageBox::Ok: + m_config.select_tab (1); + QTimer::singleShot (0, this, SLOT (on_actionSettings_triggered ())); + break; + + case MessageBox::Retry: + QTimer::singleShot (0, this, SLOT (rigOpen ())); + break; + + case MessageBox::Cancel: + QTimer::singleShot (0, this, SLOT (close ())); + break; + + default: break; // squashing compile warnings + } + } + m_first_error = true; // reset + } +} + +void MainWindow::transmit (double snr) +{ + double toneSpacing=0.0; + if (m_mode == "JT65") { + if(m_nSubMode==0) toneSpacing=11025.0/4096.0; + if(m_nSubMode==1) toneSpacing=2*11025.0/4096.0; + if(m_nSubMode==2) toneSpacing=4*11025.0/4096.0; + if (m_tci_audio) { + Q_EMIT m_config.transceiver_modulator_start(m_mode, NUM_JT65_SYMBOLS, + 4096.0*12000.0/11025.0, ui->TxFreqSpinBox->value () - m_XIT, + toneSpacing,true,false,snr,m_TRperiod); + } else { + Q_EMIT sendMessage (m_mode, NUM_JT65_SYMBOLS, + 4096.0*12000.0/11025.0, ui->TxFreqSpinBox->value () - m_XIT, + toneSpacing, m_soundOutput, m_config.audio_output_channel (), + true, false, snr, m_TRperiod); + } + } + + if((m_mode=="FT4" or m_mode=="FT8") and m_maxPoints>0 and SpecOp::ARRL_DIGI==m_specOp) { + ui->dxCallEntry->setText(m_deCall); + ui->dxGridEntry->setText(m_deGrid); + genStdMsgs("-10"); + } + + if (m_mode == "FT8") { +// toneSpacing=12000.0/1920.0; + toneSpacing=-3; + if(m_config.x2ToneSpacing()) toneSpacing=2*12000.0/1920.0; + if(m_config.x4ToneSpacing()) toneSpacing=4*12000.0/1920.0; + if(SpecOp::FOX==m_specOp and !m_tune) toneSpacing=-1; + if(SpecOp::FOX==m_specOp and m_config.superFox()) { + if (m_tci_audio) { + Q_EMIT m_config.transceiver_modulator_start(m_mode, NUM_SUPERFOX_SYMBOLS, + 1024.0,ui->TxFreqSpinBox->value()-m_XIT, + toneSpacing,true,false,snr,m_TRperiod); + } else { + Q_EMIT sendMessage (m_mode, NUM_SUPERFOX_SYMBOLS, + 1024.0, ui->TxFreqSpinBox->value () - m_XIT, + toneSpacing, m_soundOutput, m_config.audio_output_channel (), + true, false, snr, m_TRperiod); + } + } else { + if (m_tci_audio) { + Q_EMIT m_config.transceiver_modulator_start(m_mode, NUM_FT8_SYMBOLS, + 1920.0,ui->TxFreqSpinBox->value()-m_XIT, + toneSpacing,true,false,snr,m_TRperiod); + } else { + Q_EMIT sendMessage (m_mode, NUM_FT8_SYMBOLS, + 1920.0, ui->TxFreqSpinBox->value () - m_XIT, + toneSpacing, m_soundOutput, m_config.audio_output_channel (), + true, false, snr, m_TRperiod); + } + } + } + + if (m_mode == "FT4") { + m_dateTimeSentTx3=QDateTime::currentDateTimeUtc(); + toneSpacing=-2.0; //Transmit a pre-computed, filtered waveform. + if (m_tci_audio) { + Q_EMIT m_config.transceiver_modulator_start(m_mode, NUM_FT4_SYMBOLS, + 576.0,ui->TxFreqSpinBox->value()-m_XIT, + toneSpacing,true,false,snr,m_TRperiod); + } else { + Q_EMIT sendMessage (m_mode, NUM_FT4_SYMBOLS, + 576.0, ui->TxFreqSpinBox->value() - m_XIT, + toneSpacing, m_soundOutput, m_config.audio_output_channel(), + true, false, snr, m_TRperiod); + } + } + + if (m_mode == "FST4" or m_mode == "FST4W") { + m_dateTimeSentTx3=QDateTime::currentDateTimeUtc(); + toneSpacing=-2.0; //Transmit a pre-computed, filtered waveform. + int nsps=720; + if(m_TRperiod==30) nsps=1680; + if(m_TRperiod==60) nsps=3888; + if(m_TRperiod==120) nsps=8200; + if(m_TRperiod==300) nsps=21504; + if(m_TRperiod==900) nsps=66560; + if(m_TRperiod==1800) nsps=134400; + int hmod=1; + if(m_config.x2ToneSpacing()) hmod=2; + if(m_config.x4ToneSpacing()) hmod=4; + double dfreq=hmod*12000.0/nsps; + double f0=ui->WSPRfreqSpinBox->value() - m_XIT; + if(m_mode=="FST4") f0=ui->TxFreqSpinBox->value() - m_XIT; + if(!m_tune) f0 += 1.5*dfreq; + if (m_tci_audio) { + Q_EMIT m_config.transceiver_modulator_start(m_mode, NUM_FST4_SYMBOLS,double(nsps),f0,toneSpacing, + true,false,snr,m_TRperiod); + } else { + Q_EMIT sendMessage (m_mode, NUM_FST4_SYMBOLS,double(nsps),f0,toneSpacing, + m_soundOutput,m_config.audio_output_channel(), + true, false, snr, m_TRperiod); + } + } + + if (m_mode == "Q65") { + int nsps=1800; + if(m_TRperiod==30) nsps=3600; + if(m_TRperiod==60) nsps=7200; + if(m_TRperiod==120) nsps=16000; + if(m_TRperiod==300) nsps=41472; + int mode65=pow(2.0,double(m_nSubMode)); + toneSpacing=mode65*12000.0/nsps; +// toneSpacing=-4.0; + if (m_tci_audio) { + Q_EMIT m_config.transceiver_modulator_start(m_mode, NUM_Q65_SYMBOLS, + double(nsps),ui->TxFreqSpinBox->value()-m_XIT, + toneSpacing,true,false,snr,m_TRperiod); + } else { + Q_EMIT sendMessage (m_mode, NUM_Q65_SYMBOLS, + double(nsps), ui->TxFreqSpinBox->value () - m_XIT, + toneSpacing, m_soundOutput, m_config.audio_output_channel (), + true, false, snr, m_TRperiod); + } + } + + if (m_mode == "JT9") { + int nsub=pow(2,m_nSubMode); + int nsps[]={480,240,120,60}; + double sps=m_nsps; + m_toneSpacing=nsub*12000.0/6912.0; + if(m_config.x2ToneSpacing()) m_toneSpacing=2.0*m_toneSpacing; + if(m_config.x4ToneSpacing()) m_toneSpacing=4.0*m_toneSpacing; + bool fastmode=false; + if(m_bFast9 and (m_nSubMode>=4)) { + fastmode=true; + sps=nsps[m_nSubMode-4]; + m_toneSpacing=12000.0/sps; + } + if (m_tci_audio) { + Q_EMIT m_config.transceiver_modulator_start(m_mode, NUM_JT9_SYMBOLS,sps, + ui->TxFreqSpinBox->value()-m_XIT, + m_toneSpacing,true,fastmode,snr,m_TRperiod); + } else { + Q_EMIT sendMessage (m_mode, NUM_JT9_SYMBOLS, sps, + ui->TxFreqSpinBox->value() - m_XIT, m_toneSpacing, + m_soundOutput, m_config.audio_output_channel (), + true, fastmode, snr, m_TRperiod); + } + } + + if (m_mode == "MSK144") { + m_nsps=6; + double f0=1000.0; + if(!m_bFastMode) { + m_nsps=192; + f0=ui->TxFreqSpinBox->value () - m_XIT - 0.5*m_toneSpacing; + } + m_toneSpacing=6000.0/m_nsps; + m_FFTSize = 7 * 512; + if (m_tci_audio) Q_EMIT m_config.transceiver_blocksize (m_FFTSize); + else Q_EMIT FFTSize (m_FFTSize); + int nsym; + nsym=NUM_MSK144_SYMBOLS; + if(itone[40] < 0) nsym=40; + if (m_tci_audio) { + Q_EMIT m_config.transceiver_modulator_start(m_mode, nsym,double(m_nsps),f0, m_toneSpacing, + true,true,snr,m_TRperiod); + } else { + Q_EMIT sendMessage (m_mode, nsym, double(m_nsps), f0, m_toneSpacing, + m_soundOutput, m_config.audio_output_channel (), + true, true, snr, m_TRperiod); + } + } + + if (m_mode == "JT4") { + if(m_nSubMode==0) toneSpacing=4.375; + if(m_nSubMode==1) toneSpacing=2*4.375; + if(m_nSubMode==2) toneSpacing=4*4.375; + if(m_nSubMode==3) toneSpacing=9*4.375; + if(m_nSubMode==4) toneSpacing=18*4.375; + if(m_nSubMode==5) toneSpacing=36*4.375; + if(m_nSubMode==6) toneSpacing=72*4.375; + if (m_tci_audio) { + Q_EMIT m_config.transceiver_modulator_start(m_mode, NUM_JT4_SYMBOLS, + 2520.0*12000.0/11025.0,ui->TxFreqSpinBox->value()-m_XIT, + toneSpacing,true,false,snr,m_TRperiod); + } else { + Q_EMIT sendMessage (m_mode, NUM_JT4_SYMBOLS, + 2520.0*12000.0/11025.0, ui->TxFreqSpinBox->value () - m_XIT, + toneSpacing, m_soundOutput, m_config.audio_output_channel (), + true, false, snr, m_TRperiod); + } + } + + if (m_mode=="WSPR") { + int nToneSpacing=1; + if(m_config.x2ToneSpacing()) nToneSpacing=2; + if(m_config.x4ToneSpacing()) nToneSpacing=4; + if (m_tci_audio) { + Q_EMIT m_config.transceiver_modulator_start(m_mode, NUM_WSPR_SYMBOLS,8192.0, + ui->TxFreqSpinBox->value() - 1.5 * 12000 / 8192, + m_toneSpacing*nToneSpacing,true,false,snr, + m_TRperiod); + } else { + Q_EMIT sendMessage (m_mode, NUM_WSPR_SYMBOLS, 8192.0, + ui->TxFreqSpinBox->value() - 1.5 * 12000 / 8192, + m_toneSpacing*nToneSpacing, m_soundOutput, + m_config.audio_output_channel(),true, false, snr, + m_TRperiod); + } + } + + if(m_mode=="Echo") { + m_fDither=0.; +#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0) + if(m_astroWidget && m_astroWidget->bDither()) m_fDither = QRandomGenerator::global()->bounded(20.0) - 10.0; //Dither by +/- 10 Hz +#else + if(m_astroWidget && m_astroWidget->bDither()) m_fDither = 20.0*(double(qrand())/RAND_MAX) - 10.0; //Dither by +/- 10 Hz +#endif + + unsigned int numEchoSymbols=6; + double framesPerSymbol=4096; + double freq=1500.0+m_fDither; + double toneSpacing=0.0; + + if(ui->rbEchoMessage->isChecked() or ui->rbEchoCW->isChecked()) { + + if(ui->rbEchoCW->isChecked()) { + freq=1500.0; + int ifreq=freq; + int n=ui->leEchoMessage->text().length(); + gen_cw_wave_(const_cast<char *> (ui->leEchoMessage->text().toLatin1().constData()), &ifreq, + foxcom_.wave, (FCL)n); + } else { + toneSpacing=ui->sbToneSpacing->value(); + int nsps4=4*framesPerSymbol; //48000 Hz sampling + int nsym=numEchoSymbols; + float fsample=48000.0; + int nwave=nsym*nsps4; + int icmplx=0; + float f0=freq; + genwave_(const_cast<int *>(itone),&nsym,&nsps4,&nwave, + &fsample,&toneSpacing,&f0,&icmplx,foxcom_.wave,foxcom_.wave); + } + toneSpacing=-5.0; //Flag Modulator to use precomputed foxcom_.wave[]. + } + + m_msEchoTxStart=QDateTime::currentMSecsSinceEpoch(); + if (m_tci_audio) { + Q_EMIT m_config.transceiver_modulator_start(m_mode,numEchoSymbols,framesPerSymbol,freq,toneSpacing, + false,false,snr,m_TRperiod); + } else { + Q_EMIT sendMessage (m_mode,numEchoSymbols,framesPerSymbol,freq,toneSpacing,m_soundOutput, + m_config.audio_output_channel(), false, false, snr, m_TRperiod); + } + } + +// In auto-sequencing mode, stop after 5 transmissions of "73" message. + if (m_bFastMode || m_bFast9) { + if (ui->cbAutoSeq->isVisible () && ui->cbAutoSeq->isEnabled () && ui->cbAutoSeq->isChecked ()) { + if(m_ntx==5) { + m_nTx73 += 1; + } else { + m_nTx73=0; + } + } + } +} + +void MainWindow::on_outAttenuation_valueChanged (int a) +{ + QString tt_str; + qreal dBAttn {a / 10.}; // slider interpreted as dB / 100 + if (m_tune && m_config.pwrBandTuneMemory()) { + tt_str = tr ("Tune digital gain "); + } else { + tt_str = tr ("Transmit digital gain "); + } + tt_str += (a ? QString::number (-dBAttn, 'f', 1) : "0") + "dB"; + if (ui->outAttenuation->hasFocus() && !m_block_pwr_tooltip) { + QToolTip::showText (QCursor::pos (), tt_str, ui->outAttenuation); + } + QString curBand = ui->bandComboBox->currentText(); + if (m_PwrBandSetOK && !m_tune && m_config.pwrBandTxMemory ()) { + m_pwrBandTxMemory[curBand] = a; // remember our Tx pwr + } + if (m_PwrBandSetOK && m_tune && m_config.pwrBandTuneMemory()) { + m_pwrBandTuneMemory[curBand] = a; // remember our Tune pwr + } + // Updating attenuation for tuning is done in stop_tuning + if (m_tci_audio) { + Q_EMIT m_config.transceiver_txvolume(dBAttn); + } else { + Q_EMIT outAttenuationChanged (dBAttn); + } +} + +void MainWindow::on_actionShort_list_of_add_on_prefixes_and_suffixes_triggered() +{ + if (!m_prefixes) { + m_prefixes.reset (new HelpTextWindow {tr ("Prefixes") + , R"(Type 1 Prefixes: + + 1A 1S 3A 3B6 3B8 3B9 3C 3C0 3D2 3D2C 3D2R 3DA 3V 3W 3X + 3Y 3YB 3YP 4J 4L 4S 4U1I 4U1U 4W 4X 5A 5B 5H 5N 5R + 5T 5U 5V 5W 5X 5Z 6W 6Y 7O 7P 7Q 7X 8P 8Q 8R + 9A 9G 9H 9J 9K 9L 9M2 9M6 9N 9Q 9U 9V 9X 9Y A2 + A3 A4 A5 A6 A7 A9 AP BS7 BV BV9 BY C2 C3 C5 C6 + C9 CE CE0X CE0Y CE0Z CE9 CM CN CP CT CT3 CU CX CY0 CY9 + D2 D4 D6 DL DU E3 E4 EA EA6 EA8 EA9 EI EK EL EP + ER ES ET EU EX EY EZ F FG FH FJ FK FKC FM FO + FOA FOC FOM FP FR FRG FRJ FRT FT5W FT5X FT5Z FW FY M MD + MI MJ MM MU MW H4 H40 HA HB HB0 HC HC8 HH HI HK + HK0A HK0M HL HM HP HR HS HV HZ I IS IS0 J2 J3 J5 + J6 J7 J8 JA JDM JDO JT JW JX JY K KG4 KH0 KH1 KH2 + KH3 KH4 KH5 KH5K KH6 KH7 KH8 KH9 KL KP1 KP2 KP4 KP5 LA LU + LX LY LZ OA OD OE OH OH0 OJ0 OK OM ON OX OY OZ + P2 P4 PA PJ2 PJ7 PY PY0F PT0S PY0T PZ R1F R1M S0 S2 S5 + S7 S9 SM SP ST SU SV SVA SV5 SV9 T2 T30 T31 T32 T33 + T5 T7 T8 T9 TA TF TG TI TI9 TJ TK TL TN TR TT + TU TY TZ UA UA2 UA9 UK UN UR V2 V3 V4 V5 V6 V7 + V8 VE VK VK0H VK0M VK9C VK9L VK9M VK9N VK9W VK9X VP2E VP2M VP2V VP5 + VP6 VP6D VP8 VP8G VP8H VP8O VP8S VP9 VQ9 VR VU VU4 VU7 XE XF4 + XT XU XW XX9 XZ YA YB YI YJ YK YL YN YO YS YU + YV YV0 Z2 Z3 ZA ZB ZC4 ZD7 ZD8 ZD9 ZF ZK1N ZK1S ZK2 ZK3 + ZL ZL7 ZL8 ZL9 ZP ZS ZS8 KC4 E5 + +Type 1 Suffixes: /0 /1 /2 /3 /4 /5 /6 /7 /8 /9 /A /P)", {"Courier", 10}}); + } + m_prefixes->showNormal(); + m_prefixes->raise (); +} + +bool MainWindow::shortList(QString callsign) const +{ + int n=callsign.length(); + int i1=callsign.indexOf("/"); + Q_ASSERT(i1>0 and i1<n); + QString t1=callsign.mid(0,i1); + QString t2=callsign.mid(i1+1,n-i1-1); + bool b=(m_pfx.contains(t1) or m_sfx.contains(t2)); + return b; +} + +void MainWindow::pskSetLocal () +{ + if (!m_config.spot_to_psk_reporter ()) return; + + // find the station row, if any, that matches the band we are on + auto stations = m_config.stations (); + auto matches = stations->match (stations->index (0, StationList::band_column) + , Qt::DisplayRole + , ui->bandComboBox->currentText () + , 1 + , Qt::MatchExactly); + QString antenna_description; + if (!matches.isEmpty ()) { + antenna_description = stations->index (matches.first ().row () + , StationList::description_column).data ().toString (); + } + // qDebug() << "To PSKreporter: local station details"; + QString rig_information = m_config.rig_name(); + if (rig_information == "None") rig_information = "No CAT control"; + if (rig_information == "Ham Radio Deluxe") rig_information = "N/A (HRD)"; + if (rig_information == "DX Lab Suite Commander") rig_information = "N/A (DXLab)"; + if (rig_information.contains("OmniRig")) rig_information = "N/A (OmniRig)"; + if (rig_information == "FLRig") rig_information = "N/A (FLRig)"; + if (rig_information.contains("TCI Cli")) rig_information = "N/A (TCI)"; + m_psk_Reporter.setLocalStation(m_config.my_callsign (), m_config.my_grid (), antenna_description, rig_information); +} + +void MainWindow::transmitDisplay (bool transmitting) +{ + if (transmitting == m_transmitting) { + if (transmitting) { + ui->signal_meter_widget->setValue(0,0); + if (m_monitoring && !ui->actionFull_Duplex_Mode->isChecked()) monitor (false); + m_txing=true; + QTimer::singleShot ((int(1000.0*m_TRperiod)), [=] {m_txing=false;}); + m_btxok=true; + } + + auto QSY_allowed = !transmitting or m_config.tx_QSY_allowed () or + !m_config.split_mode (); + if (ui->cbHoldTxFreq->isChecked ()) { + ui->TxFreqSpinBox->setEnabled (QSY_allowed); + ui->pbT2R->setEnabled (QSY_allowed); + } + + if (m_mode!="WSPR" and m_mode!="FST4W") { + if(m_config.enable_VHF_features ()) { + ui->TxFreqSpinBox->setEnabled (true); + } else { + ui->TxFreqSpinBox->setEnabled (QSY_allowed and !m_bFastMode); + ui->pbR2T->setEnabled (QSY_allowed); + ui->cbHoldTxFreq->setEnabled (QSY_allowed); + } + } + + // the following are always disallowed in transmit + ui->menuMode->setEnabled (!transmitting); + } +} + +void MainWindow::on_sbFtol_valueChanged(int value) +{ + if (m_config.superFox() && m_specOp==SpecOp::HOUND && ui->sbFtol->value() > 100) { + ui->sbFtol->setValue(100); + return; + } + m_wideGraph->setTol (value); + statusUpdate (); + // save last used parameters + QTimer::singleShot (200, [=] { + if (m_mode=="FT8") m_settings->setValue ("Ftol_SF", ui->sbFtol->value()); + if (m_mode=="Q65") m_settings->setValue ("Ftol_Q65", ui->sbFtol->value()); + if (m_mode=="MSK144") m_settings->setValue ("Ftol_MSK144", ui->sbFtol->value()); + if (m_mode=="JT65") m_settings->setValue ("Ftol_JT65", ui->sbFtol->value ()); + if (m_mode=="JT4") m_settings->setValue ("Ftol_JT4", ui->sbFtol->value()); + if (m_mode=="JT9") m_settings->setValue ("Ftol_JT9", ui->sbFtol->value ()); + }); +} + +void::MainWindow::VHF_features_enabled(bool b) +{ + if(m_mode!="JT4" and m_mode!="JT65" and m_mode!="Q65") b=false; + if(b and m_mode!="Q65" and (ui->actionInclude_averaging->isChecked() or + ui->actionInclude_correlation->isChecked())) { + ui->actionDeepestDecode->setChecked (true); + } + ui->actionInclude_averaging->setVisible (b); + ui->actionInclude_correlation->setVisible (b && m_mode!="Q65"); + ui->actionMessage_averaging->setEnabled(b && (m_mode=="JT4" or m_mode=="JT65")); + ui->actionEnable_AP_JT65->setVisible (b && m_mode=="JT65"); + + if(!b && m_msgAvgWidget and (SpecOp::FOX != m_specOp) and !m_config.autoLog()) { + if(m_msgAvgWidget->isVisible() and m_mode!="JT4" and m_mode!="JT9" and m_mode!="JT65") { + m_msgAvgWidget->close(); + } + } +} + +void MainWindow::on_sbTR_valueChanged(int value) +{ + // if(!m_bFastMode and n>m_nSubMode) m_MinW=m_nSubMode; + if(m_bFastMode or m_mode=="FreqCal" or m_mode=="FST4" or m_mode=="FST4W" or m_mode=="Q65") { + m_TRperiod = value; + if (m_mode == "FST4" || m_mode == "FST4W" || m_mode=="Q65") + { + if (m_TRperiod < 60) + { + ui->lh_decodes_headings_label->setText(" UTC dB DT Freq " + tr ("Message")); + if (m_mode != "FST4W") + { + ui->rh_decodes_headings_label->setText(" UTC dB DT Freq " + tr ("Message")); + } + } + else + { + ui->lh_decodes_headings_label->setText("UTC dB DT Freq " + tr ("Message")); + if (m_mode != "FST4W") + { + ui->rh_decodes_headings_label->setText("UTC dB DT Freq " + tr ("Message")); + } + } + + if ("Q65" == m_mode) + { + switch (value) + { + case 15: ui->sbSubmode->setMaximum (2); break; + case 30: ui->sbSubmode->setMaximum (3); break; + case 120: ui->sbSubmode->setMaximum (5); break; + default: ui->sbSubmode->setMaximum (4); break; + } + } + } + m_fastGraph->setTRPeriod (value); + if (m_tci_audio && ui->bandComboBox->currentText()!="OOB") + Q_EMIT m_config.transceiver_period(m_TRperiod); + if (!m_tci_audio) { + m_modulator->setTRPeriod(m_TRperiod); // TODO - not thread safe + m_detector->setTRPeriod(m_TRperiod); // TODO - not thread safe + } + m_wideGraph->setPeriod (value, m_nsps); + progressBar.setMaximum (value); + } + // if(m_transmitting) on_stopTxButton_clicked(); //### Is this needed or desirable? ### + if (m_mode=="FST4") chk_FST4_freq_range(); + on_sbSubmode_valueChanged(ui->sbSubmode->value()); + statusUpdate (); + check_button_color(); + if (!programStart) QTimer::singleShot (1000, [=] { + if (m_mode=="Q65") m_settings->setValue ("TRPeriod_Q65", ui->sbTR->value ()); + if (m_mode=="MSK144") { + if (m_currentBand=="2m") { + m_msk144_tr2=ui->sbTR->value (); + m_settings->setValue ("TRPeriod_MSK144_2m", ui->sbTR->value ()); + } else if (m_currentBand=="6m" or m_currentBand=="4m") { + m_msk144_tr6=ui->sbTR->value (); + m_settings->setValue ("TRPeriod_MSK144_6m", ui->sbTR->value ()); + } else { + m_msk144_tr=ui->sbTR->value (); + m_settings->setValue ("TRPeriod_MSK144", ui->sbTR->value ()); + } + } + if (m_mode=="FST4") m_settings->setValue ("TRPeriod_FST4", ui->sbTR->value ()); + if (m_mode=="JT9") m_settings->setValue ("TRPeriod", ui->sbTR->value ()); + }); +} + +void MainWindow::on_sbTR_FST4W_valueChanged(int value) +{ + on_sbTR_valueChanged(value); +} + +QChar MainWindow::current_submode () const +{ + QChar submode {0}; + if (m_mode.contains (QRegularExpression {R"(^(JT65|JT9|JT4|Q65)$)"}) + && (m_config.enable_VHF_features () || "JT4" == m_mode)) + { + submode = m_nSubMode + 65; + } + return submode; +} + +void MainWindow::on_sbSubmode_valueChanged(int n) +{ + m_nSubMode=n; + m_wideGraph->setSubMode(m_nSubMode); + auto submode = current_submode (); + if (submode != QChar::Null) { + QString t{m_mode + " " + submode}; + if(m_mode=="Q65") t=m_mode + "-" + QString::number(m_TRperiod) + submode; + mode_label.setText (t); + } else { + mode_label.setText (m_mode); + } + if(m_mode=="Q65") { + if(((m_nSubMode==5 && m_TRperiod==120.0) || (m_nSubMode==4 && m_TRperiod==60.0) || (m_nSubMode==3 && m_TRperiod==30.0) || + (m_nSubMode==2 && m_TRperiod==15.0)) && abs(ui->TxFreqSpinBox->value() - 700) > 15) { + ui->TxFreqSpinBox->setStyleSheet("QSpinBox{background-color:red; color:white}"); + } else { + ui->TxFreqSpinBox->setStyleSheet(""); + } + } + if(m_mode=="JT9") { + if(m_nSubMode<4) { + ui->cbFast9->setChecked(false); + on_cbFast9_clicked(false); + ui->cbFast9->setEnabled(false); + ui->sbTR->setVisible(false); + m_TRperiod=60.0; + } else { + if(!blocked) ui->cbFast9->setEnabled(true); + } + ui->sbTR->setVisible(m_bFast9); + if(m_bFast9) ui->TxFreqSpinBox->setValue(700); + } + if(m_transmitting and m_bFast9 and m_nSubMode>=4) transmit (99.0); + if (m_mode !="Q65") ui->TxFreqSpinBox->setStyleSheet(""); + statusUpdate (); + check_button_color(); + // save last used parameters + QTimer::singleShot (200, [=] { + if (m_mode=="Q65") m_settings->setValue("SubMode_Q65",ui->sbSubmode->value()); + if (m_mode=="JT65") m_settings->setValue("SubMode_JT65",ui->sbSubmode->value()); + if (m_mode=="JT4") m_settings->setValue("SubMode_JT4",ui->sbSubmode->value()); + if (m_mode=="JT9") m_settings->setValue("SubMode",ui->sbSubmode->value()); + }); +} + +void MainWindow::on_cbFast9_clicked(bool b) +{ + if(m_mode=="JT9") { + m_bFast9=b; +// ui->cbAutoSeq->setVisible(b); + blocked=true; // needed to prevent a loop + on_actionJT9_triggered(); + QTimer::singleShot (50, [=] {blocked = false;}); // needed to prevent a loop + QTimer::singleShot (200, [=] { + if(m_mode=="JT9") m_settings->setValue("JT9_Fast",m_bFast9); + }); + } + + if(b) { + m_TRperiod = ui->sbTR->value (); + } else { + m_TRperiod=60.0; + } + progressBar.setMaximum(int(m_TRperiod)); + m_wideGraph->setPeriod(m_TRperiod,m_nsps); + fast_config(b); + statusChanged (); +} + +void MainWindow::on_cbSendMsg_toggled(bool b) +{ + if (!(m_config.superFox() && m_specOp==SpecOp::FOX)) + return; // don't do anything with slot values unless SuperFox mode + if(b) { + ui->sbNslots->setValue(2); + m_Nslots=2; + } else { + ui->sbNslots->setValue(5); + m_Nslots=5; + } +} + +void MainWindow::on_cbShMsgs_toggled(bool b) +{ + ui->cbTx6->setEnabled(b); + m_bShMsgs=b; + if(b) ui->cbSWL->setChecked(false); + if(m_bShMsgs and (m_mode=="MSK144")) ui->rptSpinBox->setValue(1); + int it0=itone[0]; + int ntx=m_ntx; + m_lastCallsign.clear (); // ensure Tx5 gets updated + genStdMsgs(m_rpt); + itone[0]=it0; + if(ntx==1) ui->txrb1->setChecked(true); + if(ntx==2) ui->txrb2->setChecked(true); + if(ntx==3) ui->txrb3->setChecked(true); + if(ntx==4) ui->txrb4->setChecked(true); + if(ntx==5) ui->txrb5->setChecked(true); + if(ntx==6) ui->txrb6->setChecked(true); + QTimer::singleShot (200, [=] { + if(m_mode=="MSK144") m_settings->setValue("ShMsgs_MSK144",m_bShMsgs); + if(m_mode=="Q65") m_settings->setValue("ShMsgs_Q65",m_bShMsgs); + if(m_mode=="JT65") m_settings->setValue("ShMsgs_JT65",m_bShMsgs); + if(m_mode=="JT4") m_settings->setValue("ShMsgs_JT4",m_bShMsgs); + }); +} + +void MainWindow::on_cbSWL_toggled(bool b) +{ + if(b) ui->cbShMsgs->setChecked(false); +} + +void MainWindow::on_cbTx6_toggled(bool) +{ + genCQMsg (); +} + +void MainWindow::on_rbFixedTone_toggled(bool b) +{ + ui->leEchoMessage->setEnabled(!b); + ui->sbToneSpacing->setEnabled(!b); +} + +void MainWindow::on_rbEchoMessage_toggled(bool b) +{ + ui->sbToneSpacing->setEnabled(b); +} + +void MainWindow::on_rbEchoCW_toggled(bool b) +{ + ui->sbToneSpacing->setEnabled(!b); +} + +void MainWindow::on_leEchoMessage_textChanged() +{ + QString t=ui->leEchoMessage->text().toUpper(); + ui->leEchoMessage->setText(t); +} + + +// Takes a decoded CQ line and sets it up for reply +void MainWindow::replyToCQ (QTime time, qint32 snr, float delta_time, quint32 delta_frequency + , QString const& mode, QString const& message_text + , bool /*low_confidence*/, quint8 modifiers) +{ + QString format_string {"%1 %2 %3 %4 %5 %6"}; + auto const& time_string = time.toString ("~" == mode || "&" == mode || "+" == mode + || (m_TRperiod < 60. && ("`" == mode || ":" == mode)) + ? "hhmmss" : "hhmm"); + auto text = message_text; + auto ap_pos = text.lastIndexOf (QRegularExpression {R"((?:\?\s)?(?:a[0-9]|q[0-9][0-9]?)$)"}); + if (ap_pos >= 0) + { + // beware of decodes ending on shorter version of wanted call so + // add a space + text = text.left (ap_pos).trimmed () + ' '; + } + auto message_line = format_string + .arg (time_string) + .arg (snr, 3) + .arg (delta_time, 4, 'f', 1) + .arg (delta_frequency, 4) + .arg (mode, -2) + .arg (text); + QTextCursor start {ui->decodedTextBrowser->document ()}; + start.movePosition (QTextCursor::End); + auto cursor = ui->decodedTextBrowser->document ()->find (message_line, start, QTextDocument::FindBackward); + if (cursor.isNull ()) + { + // try again with with -0.0 delta time + cursor = ui->decodedTextBrowser->document ()->find (format_string + .arg (time_string) + .arg (snr, 3) + .arg ('-' + QString::number (delta_time, 'f', 1), 4) + .arg (delta_frequency, 4) + .arg (mode, -2) + .arg (text), start, QTextDocument::FindBackward); + } + if (!cursor.isNull ()) + { + if (m_config.udpWindowToFront ()) + { + show (); + raise (); + activateWindow (); + } + if (m_config.udpWindowRestore () && isMinimized ()) + { + showNormal (); + raise (); + } + if ((text.contains (QRegularExpression {R"(^(CQ |CQDX |QRZ ))"})) + || text.contains("73 ") || (ui->cbHoldTxFreq->isChecked ())) { + // a message we are willing to accept and auto reply to + m_bDoubleClicked = true; + } + DecodedText message {message_line}; + Qt::KeyboardModifiers kbmod {modifiers << 24}; + processMessage (message, kbmod); + tx_watchdog (false); + QApplication::alert (this); + } + else + { + qDebug () << "process reply message ignored, decode not found:" << message_line; + } +} + +void MainWindow::locationChange (QString const& location) +{ + QString grid {location.trimmed ()}; + int len; + + // string 6 chars or fewer, interpret as a grid, or use with a 'GRID:' prefix + if (grid.size () > 6) { + if (grid.toUpper ().startsWith ("GRID:")) { + grid = grid.mid (5).trimmed (); + } + else { + // TODO - support any other formats, e.g. latlong? Or have that conversion done external to wsjtx + return; + } + } + if (MaidenheadLocatorValidator::Acceptable == MaidenheadLocatorValidator ().validate (grid, len)) { + qDebug() << "locationChange: Grid supplied is " << grid; + if (m_config.my_grid () != grid) { + m_config.set_location (grid); + genStdMsgs (m_rpt, false); + pskSetLocal (); + statusUpdate (); + } + } else { + qDebug() << "locationChange: Invalid grid " << grid; + } +} + +void MainWindow::replayDecodes () +{ + // we accept this request even if the setting to accept UDP requests + // is not checked + + // attempt to parse the decoded text + for (QTextBlock block = ui->decodedTextBrowser->document ()->firstBlock (); block.isValid (); block = block.next ()) + { + auto message = block.text (); + message = message.left (message.indexOf (QChar::Nbsp)); // discard + // any + // appended info + if (message.size() >= 4 && message.left (4) != "----") + { + auto const& parts = message.split (' ', SkipEmptyParts); + if (parts.size () >= 5 && parts[3].contains ('.')) { + postWSPRDecode (false, parts); + } else { + postDecode (false, message); + } + } + } + statusChanged (); +} + +void MainWindow::postDecode (bool is_new, QString const& message) +{ + if (no_decodes_to_UDP) return; // Don't send decoded messages to messageClient after a band change + if (filtered) return; // Don't send filtered messages to messageClient + if (message.contains("$VERIFY$")) return; // Don't send SuperFox OTP messages to messageClient + auto const& decode = message.trimmed (); + auto const& parts = decode.left (22).split (' ', SkipEmptyParts); + if (parts.size () >= 5) + { + auto has_seconds = parts[0].size () > 4; + m_messageClient->decode (is_new + , QTime::fromString (parts[0], has_seconds ? "hhmmss" : "hhmm") + , parts[1].toInt () + , parts[2].toFloat (), parts[3].toUInt (), parts[4] + , decode.mid (has_seconds ? 24 : 22) + , QChar {'?'} == decode.mid (has_seconds ? 24 + 36 : 22 + 36, 1) + , m_diskData); + } +} + +void MainWindow::postWSPRDecode (bool is_new, QStringList parts) +{ + if (parts.size () < 8) + { + parts.insert (6, ""); + } + m_messageClient->WSPR_decode (is_new, QTime::fromString (parts[0], "hhmm"), parts[1].toInt () + , parts[2].toFloat (), Radio::frequency (parts[3].toFloat (), 6) + , parts[4].toInt (), parts[5], parts[6], parts[7].toInt () + , m_diskData); +} + +void MainWindow::networkError (QString const& e) +{ + if (m_splash && m_splash->isVisible ()) m_splash->hide (); + if (MessageBox::Retry == MessageBox::warning_message (this, tr ("Network Error") + , tr ("Error: %1\nUDP server %2:%3") + .arg (e) + .arg (m_config.udp_server_name ()) + .arg (m_config.udp_server_port ()) + , QString {} + , MessageBox::Cancel | MessageBox::Retry + , MessageBox::Cancel)) + { + // retry server lookup + m_messageClient->set_server (m_config.udp_server_name (), m_config.udp_interface_names ()); + } +} + +void MainWindow::on_syncSpinBox_valueChanged(int n) +{ + m_minSync=n; +} + +void MainWindow::p1ReadFromStdout() //p1readFromStdout +{ + QString t1; + while(p1.canReadLine()) { + QString t(p1.readLine()); + if(ui->cbNoOwnCall->isChecked()) { + if(t.contains(" " + m_config.my_callsign() + " ")) continue; + if(t.contains(" <" + m_config.my_callsign() + "> ")) continue; + } + if(t.indexOf("<DecodeFinished>") >= 0) { + m_bDecoded = m_nWSPRdecodes > 0; + if(!m_diskData) { + WSPR_history(m_dialFreqRxWSPR, m_nWSPRdecodes); + if(m_nWSPRdecodes==0 and ui->band_hopping_group_box->isChecked()) { + t = " " + tr ("Receiving") + " " + m_mode + " ----------------------- " + + m_config.bands ()->find (m_dialFreqRxWSPR); + t=beacon_start_time (-m_TRperiod / 2) + ' ' + t.rightJustified (66, '-'); + ui->decodedTextBrowser->insertText(t); + } + killFileTimer.start (45*1000); //Kill in 45s (for slow modes) + } + ndecodes_label.setText(QString::number(m_nWSPRdecodes)); + m_nWSPRdecodes=0; + ui->DecodeButton->setChecked (false); + if(m_uploadWSPRSpots && m_config.is_transceiver_online()) { // need working rig control +#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0) + uploadTimer.start(QRandomGenerator::global ()->bounded (0, 20000)); // Upload delay +#else + uploadTimer.start(20000 * qrand()/((double)RAND_MAX + 1.0)); // Upload delay +#endif + } else { + QFile f {QDir::toNativeSeparators (m_config.writeable_data_dir ().absoluteFilePath ("wspr_spots.txt"))}; + if (f.exists ()) f.remove (); + } + m_RxLog=0; + m_startAnother=m_loopall; + m_decoderBusy = false; + statusUpdate (); + } else { + int n=t.length(); + t=t.mid(0,n-2) + " "; + t.remove(QRegExp("\\s+$")); + QStringList rxFields = t.split(QRegExp("\\s+")); + QString rxLine; + QString grid=""; + if ( rxFields.count() == 8 ) { + rxLine = QString("%1 %2 %3 %4 %5 %6 %7 %8") + .arg(rxFields.at(0), 4) + .arg(rxFields.at(1), 4) + .arg(rxFields.at(2), 5) + .arg(rxFields.at(3), 11) + .arg(rxFields.at(4), 4) + .arg(rxFields.at(5).leftJustified (12)) + .arg(rxFields.at(6), -6) + .arg(rxFields.at(7), 3); + postWSPRDecode (true, rxFields); + grid = rxFields.at(6); + } else if ( rxFields.count() == 7 ) { // Type 2 message + rxLine = QString("%1 %2 %3 %4 %5 %6 %7 %8") + .arg(rxFields.at(0), 4) + .arg(rxFields.at(1), 4) + .arg(rxFields.at(2), 5) + .arg(rxFields.at(3), 11) + .arg(rxFields.at(4), 4) + .arg(rxFields.at(5).leftJustified (12)) + .arg("", -6) + .arg(rxFields.at(6), 3); + postWSPRDecode (true, rxFields); + } else { + rxLine = t; + } + if(grid!="") { + double utch=0.0; + int nAz,nEl,nDmiles,nDkm,nHotAz,nHotABetter; + azdist_(const_cast <char *> ((m_config.my_grid () + " ").left (6).toLatin1 ().constData ()), + const_cast <char *> ((grid + " ").left (6).toLatin1 ().constData ()),&utch, + &nAz,&nEl,&nDmiles,&nDkm,&nHotAz,&nHotABetter,(FCL)6,(FCL)6); + QString t1; + if(m_config.miles()) { + t1 = t1.asprintf("%7d",nDmiles); + } else { + t1 = t1.asprintf("%7d",nDkm); + } + rxLine += t1; + } + + if (rxLine.left (4) != m_tBlankLine) { + ui->decodedTextBrowser->new_period (); + if (m_config.insert_blank ()) { + QString band; + Frequency f=1000000.0*rxFields.at(3).toDouble()+0.5; + band = ' ' + m_config.bands ()->find (f); + m_dateTimeSeqStart = qt_truncate_date_time_to (QDateTime::currentDateTimeUtc (), m_TRperiod * 1.e3); + if (ui->actionUse_Dark_Style->isChecked()) { + if (m_config.detailed_blank()) { + if (m_config.DXCC()) { + ui->decodedTextBrowser->insertText(("------------ " + m_dateTimeSeqStart.toString("yyyy-MM-dd - hh:mm:ss' UTC - '") + band + " - " + m_mode + " --------------"), "#a2a2a2", "#000000"); + } else { + ui->decodedTextBrowser->insertText(("------------ " + m_dateTimeSeqStart.toString("yyyy-MM-dd - hh:mm:ss' UTC - '") + band + " - " + m_mode), "#a2a2a2", "#000000"); + } + } else { + ui->decodedTextBrowser->insertText(band.rightJustified(71, '-'), "#a2a2a2", "#000000"); + } + } else { + if (m_config.detailed_blank()) { + if (m_config.DXCC()) { + ui->decodedTextBrowser->insertLineSpacer ("------------ " + m_dateTimeSeqStart.toString("yyyy-MM-dd - hh:mm:ss' UTC - '") + band + " - " + m_mode + " --------------"); + } else { + ui->decodedTextBrowser->insertLineSpacer ("------------ " + m_dateTimeSeqStart.toString("yyyy-MM-dd - hh:mm:ss' UTC - '") + band + " - " + m_mode); + } + } else { + ui->decodedTextBrowser->insertLineSpacer (band.rightJustified (71, '-')); + } + } + } + m_tBlankLine = rxLine.left(4); + } + m_nWSPRdecodes += 1; + ui->decodedTextBrowser->insertText(rxLine); + } + if(m_position != 0) ui->decodedTextBrowser->horizontalScrollBar()->setValue(m_position); + } +} + +QString MainWindow::beacon_start_time (int n) +{ + auto bt = qt_truncate_date_time_to (QDateTime::currentDateTimeUtc ().addSecs (n), m_TRperiod * 1.e3); + if (m_TRperiod < 60.) + { + return bt.toString ("HHmmss"); + } + else + { + return bt.toString ("HHmm"); + } +} + +void MainWindow::WSPR_history(Frequency dialFreq, int ndecodes) +{ + QDateTime t=QDateTime::currentDateTimeUtc().addSecs(-60); + QString t1=t.toString("yyMMdd"); + QString t2=beacon_start_time (-m_TRperiod / 2); + QString t3; + t3 = t3.asprintf("%13.6f",0.000001*dialFreq); + if(ndecodes<0) { + t1=t1 + " " + t2 + t3 + " T"; + } else { + QString t4; + t4 = t4.asprintf("%4d",ndecodes); + t1=t1 + " " + t2 + t3 + " R" + t4; + } + QFile f {m_config.writeable_data_dir ().absoluteFilePath ("WSPR_history.txt")}; + if (f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append)) { + QTextStream out(&f); + out << t1 +#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0) + << Qt::endl +#else + << endl +#endif + ; + f.close(); + } else { + MessageBox::warning_message (this, tr ("File Error") + , tr ("Cannot open \"%1\" for append: %2") + .arg (f.fileName ()).arg (f.errorString ())); + } +} + +void MainWindow::uploadWSPRSpots (bool direct_post, QString const& decode_text) +{ + // do not spot if disabled, replays, or if rig control not working + if(!m_uploadWSPRSpots || m_diskData || !m_config.is_transceiver_online ()) return; + if(m_uploading && !decode_text.size ()) { + qDebug() << "Previous upload has not completed, spots were lost"; + wsprNet->abortOutstandingRequests (); + m_uploading = false; + } + QString rfreq = QString("%1").arg((m_dialFreqRxWSPR + 1500) / 1e6, 0, 'f', 6); + QString tfreq = QString("%1").arg((m_dialFreqRxWSPR + + ui->TxFreqSpinBox->value()) / 1e6, 0, 'f', 6); + auto pct = QString::number (ui->autoButton->isChecked () ? ui->sbTxPercent->value () : 0); + if (direct_post) + { + // queues one FST4W spot + wsprNet->post (m_config.my_callsign (), m_config.my_grid (), rfreq, tfreq, + m_mode, m_TRperiod, pct, + QString::number (m_dBm), version (), decode_text); + } + else + { + // queues spots for each decode in wspr_spots.txt + wsprNet->upload (m_config.my_callsign (), m_config.my_grid (), rfreq, tfreq, + m_mode, m_TRperiod, pct, + QString::number (m_dBm), version (), + m_config.writeable_data_dir ().absoluteFilePath ("wspr_spots.txt")); + } + // trigger upload of any queued spots + if (!decode_text.size ()) + { + m_uploading = true; + } +} + +void MainWindow::uploadResponse(QString const& response) +{ + if (response == "done") { + m_uploading=false; + } else { + if (response.startsWith ("Upload Failed")) { + m_uploading=false; + } + qDebug () << "WSPRnet.org status:" << response; + } +} + +void MainWindow::on_TxPowerComboBox_currentIndexChanged(int index) +{ + m_dBm = ui->TxPowerComboBox->itemData (index).toInt (); +} + +void MainWindow::on_cbUploadWSPR_Spots_toggled(bool b) +{ + m_uploadWSPRSpots=b; +} + +void MainWindow::on_WSPRfreqSpinBox_valueChanged(int n) +{ + ui->TxFreqSpinBox->setValue(n); +} + +void MainWindow::on_sbFST4W_RxFreq_valueChanged(int n) +{ + m_wideGraph->setRxFreq(n); + statusUpdate (); +} + +void MainWindow::on_sbFST4W_FTol_valueChanged(int n) +{ + ui->sbFST4W_RxFreq->setSingleStep(n); + m_wideGraph->setTol(n); + statusUpdate (); +} + +void MainWindow::on_pbTxNext_clicked(bool b) +{ + if (b && !ui->autoButton->isChecked ()) + { + ui->autoButton->click (); // make sure Tx is possible + } +} + +void MainWindow::WSPR_scheduling () +{ + if (ui->pbTxNext->isEnabled () && ui->pbTxNext->isChecked ()) + { + // Tx Next button overrides all scheduling + m_WSPR_tx_next = true; + return; + } + QString t=ui->RoundRobin->currentText(); + if(m_mode=="FST4W" and t != tr ("Random")) { + bool ok; + int i=t.left (1).toInt (&ok) - 1; + if (!ok) return; + int n=t.right (1).toInt (&ok); + if (!ok || 0 == n) return; + + qint64 ms = QDateTime::currentMSecsSinceEpoch() % 86400000; + int nsec=ms/1000; + int ntr=m_TRperiod; + int j=((nsec+ntr-1) % (n*ntr))/ntr; + m_WSPR_tx_next = i == j; + return; + } + m_WSPR_tx_next = false; + if (!ui->sbTxPercent->isEnabled ()) + { + return; // don't schedule if %age disabled + } + if (m_config.is_transceiver_online () // need working rig control for hopping + && !m_config.is_dummy_rig () + && ui->band_hopping_group_box->isChecked ()) { + auto hop_data = m_WSPR_band_hopping.next_hop (m_auto); + qDebug () << "hop data: period:" << hop_data.period_name_ + << "frequencies index:" << hop_data.frequencies_index_ + << "tune:" << hop_data.tune_required_ + << "tx:" << hop_data.tx_next_; + m_WSPR_tx_next = hop_data.tx_next_; + if (hop_data.frequencies_index_ >= 0) { // new band + ui->bandComboBox->setCurrentIndex (hop_data.frequencies_index_); + on_bandComboBox_activated (hop_data.frequencies_index_); + // Execute user's hardware controller + auto band = m_config.bands ()->find (m_freqNominal).remove ('m'); +#if defined(Q_OS_WIN) + // On windows we use CMD.EXE to find and execute the + // user_hardware executable. This means that the first matching + // file extension on the PATHEXT environment variable found on + // the PATH environment variable path list. This give maximum + // flexibility for users to write user_hardware in their + // language of choice, and place the file anywhere on the PATH + // environment variable. Equivalent to typing user_hardware + // without any path or extension at the CMD.EXE prompt. + p3.start("CMD", QStringList {"/C", "user_hardware", band}); +#else + // On non-Windows systems we expect the user_hardware executable + // to be anywhere in the paths specified in the PATH environment + // variable path list, and executable. Equivalent to typing + // user_hardware without any path at the shell prompt. + p3.start("/bin/sh", QStringList {"-c", "user_hardware " + band}); +#endif + + // Produce a short tuneup signal + m_tuneup = false; + if (hop_data.tune_required_) { + m_tuneup = true; + on_tuneButton_clicked (true); + tuneATU_Timer.start (2500); + } + } + + // Display grayline status + band_hopping_label.setText (hop_data.period_name_); + } + else { + m_WSPR_tx_next = m_WSPR_band_hopping.next_is_tx(m_mode=="FST4W"); + } +} + +void MainWindow::astroUpdate () +{ + if (m_astroWidget) { + // no Doppler correction while CTRL pressed allows manual tuning + if (Qt::ControlModifier & QApplication::queryKeyboardModifiers ()) return; + if (m_tci && (ui->bandComboBox->currentText()=="OOB")) { + qDebug() << "TCI Mode and OOB so MainWindow::setRig returning at top\n"; + return; + } + + auto correction = m_astroWidget->astroUpdate(QDateTime::currentDateTimeUtc (), + m_config.my_grid(), m_hisGrid,m_freqNominal,"Echo" == m_mode, + m_transmitting,m_auto,!m_config.tx_QSY_allowed (),m_TRperiod); + m_fDop=correction.dop; + m_fSpread=correction.width; + m_tEcho=correction.techo; + + if (m_transmitting && !m_config.tx_QSY_allowed ()) return; // No Tx Doppler correction if rig can't do it + if (!m_astroWidget->doppler_tracking() or m_astroWidget->DopplerMethod()==0) { + // We are not using RF Doppler correction + m_fAudioShift=m_fDop; + return; + } else if (m_astroWidget->DopplerMethod()==10) { // else if added for enableShift fx + // We are not using RF Doppler correction + m_fAudioShift=m_fDop; + } + + if ((m_monitoring || m_transmitting) + && m_freqNominal >= 21000000 // No Doppler correction below 15m + && m_config.split_mode ()) // Doppler correcion needs split mode + { + // adjust for rig resolution + if (m_config.transceiver_resolution () > 2) + { + correction.rx = (correction.rx + 50) / 100 * 100; + correction.tx = (correction.tx + 50) / 100 * 100; + } + else if (m_config.transceiver_resolution () > 1) + { + correction.rx = (correction.rx + 10) / 20 * 20; + correction.tx = (correction.tx + 10) / 20 * 20; + } + else if (m_config.transceiver_resolution () > 0) + { + correction.rx = (correction.rx + 5) / 10 * 10; + correction.tx = (correction.tx + 5) / 10 * 10; + } + else if (m_config.transceiver_resolution () < -2) + { + correction.rx = correction.rx / 100 * 100; + correction.tx = correction.tx / 100 * 100; + } + else if (m_config.transceiver_resolution () < -1) + { + correction.rx = correction.rx / 20 * 20; + correction.tx = correction.tx / 20 * 20; + } + else if (m_config.transceiver_resolution () < 0) + { + correction.rx = correction.rx / 10 * 10; + correction.tx = correction.tx / 10 * 10; + } + m_astroCorrection = correction; + if (m_reverse_Doppler) m_astroCorrection.reverse (); + } else { + m_astroCorrection = {}; + } + if(!(m_tci && inSettings)) setRig (); + m_fAudioShift=m_fDop - correction.rx; + } +} + +void MainWindow::setRig (Frequency f) +{ + if (f) { + m_freqNominal = f; + genCQMsg (); + m_freqTxNominal = m_freqNominal; + if (m_astroWidget) m_astroWidget->nominal_frequency (m_freqNominal, m_freqTxNominal); + } + if (m_mode == "FreqCal" && m_frequency_list_fcal_iter != m_config.frequencies ()->end ()) { + m_freqNominal = m_frequency_list_fcal_iter->frequency_ - ui->RxFreqSpinBox->value (); + } + if (m_transmitting && !m_config.tx_QSY_allowed ()) return; + if ((m_monitoring || m_transmitting) && m_config.transceiver_online ()) { + if (m_transmitting && m_config.split_mode () && !(m_config.superFox() && m_specOp==SpecOp::FOX)) { + m_config.transceiver_tx_frequency (m_freqTxNominal + m_astroCorrection.tx); + } else { + m_config.transceiver_frequency (m_freqNominal + m_astroCorrection.rx); + } + } +} + +void MainWindow::fastPick(int x0, int x1, int y) +{ + float pixPerSecond=12000.0/512.0; + if(m_TRperiod<30.0) pixPerSecond=12000.0/256.0; + if(m_mode!="MSK144") return; + if(!m_decoderBusy) { + dec_data.params.newdat=0; + dec_data.params.nagain=1; + m_nPick=1; + if(y > 120) m_nPick=2; + m_t0Pick=x0/pixPerSecond; + m_t1Pick=x1/pixPerSecond; + m_dataAvailable=true; + decode(); + } +} + +void MainWindow::on_actionMeasure_reference_spectrum_triggered() +{ + if(!m_monitoring) on_monitorButton_clicked (true); + m_bRefSpec=true; +} + +void MainWindow::on_actionMeasure_phase_response_triggered() +{ + if(m_bTrain) { + m_bTrain=false; + MessageBox::information_message (this, tr ("Phase Training Disabled")); + } else { + m_bTrain=true; + MessageBox::information_message (this, tr ("Phase Training Enabled")); + } +} + +void MainWindow::on_actionErase_reference_spectrum_triggered() +{ + m_bClearRefSpec=true; +} + +void MainWindow::freqCalStep() +{ + if (m_frequency_list_fcal_iter == m_config.frequencies ()->end () + || ++m_frequency_list_fcal_iter == m_config.frequencies ()->end ()) { + m_frequency_list_fcal_iter = m_config.frequencies ()->begin (); + } + + // allow for empty list + if (m_frequency_list_fcal_iter != m_config.frequencies ()->end ()) { + setRig (m_frequency_list_fcal_iter->frequency_ - ui->RxFreqSpinBox->value ()); + } +} + +void MainWindow::on_sbCQTxFreq_valueChanged(int) +{ + setXIT (ui->TxFreqSpinBox->value ()); +} + +void MainWindow::on_cbCQTx_toggled(bool b) +{ + ui->sbCQTxFreq->setEnabled(b); + genCQMsg(); + if(b) { + ui->txrb6->setChecked(true); + m_ntx=6; + m_QSOProgress = CALLING; + } + setRig (); + setXIT (ui->TxFreqSpinBox->value ()); +} + +void MainWindow::statusUpdate () const +{ + if (!ui || m_block_udp_status_updates) return; + auto submode = current_submode (); + auto ftol = ui->sbFtol->value (); + if ("FST4W" == m_mode) + { + ftol = ui->sbFST4W_FTol->value (); + } + else if (!(ui->sbFtol->isVisible () && ui->sbFtol->isEnabled ())) + { + ftol = quint32_max; + } + auto tr_period = ui->sbTR->value (); + auto rx_frequency = ui->RxFreqSpinBox->value (); + if ("FST4W" == m_mode) + { + tr_period = ui->sbTR_FST4W->value (); + rx_frequency = ui->sbFST4W_RxFreq->value (); + } + else if (!(ui->sbTR->isVisible () && ui->sbTR->isEnabled ())) + { + tr_period = quint32_max; + } + m_messageClient->status_update (m_freqNominal, m_mode, m_hisCall, + QString::number (ui->rptSpinBox->value ()), + m_mode, ui->autoButton->isChecked (), + m_transmitting, m_decoderBusy, + rx_frequency, ui->TxFreqSpinBox->value (), + m_config.my_callsign (), m_config.my_grid (), + m_hisGrid, m_tx_watchdog, + submode != QChar::Null ? QString {submode} : QString {}, m_bFastMode, + static_cast<quint8> (m_specOp), + ftol, tr_period, m_multi_settings->configuration_name (), + m_currentMessage); +} + +void MainWindow::childEvent (QChildEvent * e) +{ + if (e->child ()->isWidgetType ()) + { + switch (e->type ()) + { + case QEvent::ChildAdded: add_child_to_event_filter (e->child ()); break; + case QEvent::ChildRemoved: remove_child_from_event_filter (e->child ()); break; + default: break; + } + } + QMainWindow::childEvent (e); +} + +// add widget and any child widgets to our event filter so that we can +// take action on key press ad mouse press events anywhere in the main window +void MainWindow::add_child_to_event_filter (QObject * target) +{ + if (target && target->isWidgetType ()) + { + target->installEventFilter (this); + } + auto const& children = target->children (); + for (auto iter = children.begin (); iter != children.end (); ++iter) + { + add_child_to_event_filter (*iter); + } +} + +// recursively remove widget and any child widgets from our event filter +void MainWindow::remove_child_from_event_filter (QObject * target) +{ + auto const& children = target->children (); + for (auto iter = children.begin (); iter != children.end (); ++iter) + { + remove_child_from_event_filter (*iter); + } + if (target && target->isWidgetType ()) + { + target->removeEventFilter (this); + } +} + +void MainWindow::tx_watchdog (bool triggered) +{ + auto prior = m_tx_watchdog; + m_tx_watchdog = triggered; + if (triggered) + { + m_bTxTime=false; + if (m_tune) stop_tuning (); + if (m_auto) auto_tx_mode (false); + // Highlight watchdog label red when watchdog stops TXing, and keep the value + if ((m_config.watchdog () && m_mode!="WSPR" && m_mode!="FST4W") && !m_config.button_coloring_disabled()) { + watchdog_label.setStyleSheet ("QLabel{color: #ffffff; background-color: #ff0000}"); + watchdog_label.setText (tr (" WD:0m ")); + } + tx_status_label.setStyleSheet ("QLabel{color: #ffffff; background-color: #ff0000}"); + tx_status_label.setText (tr (" Runaway Tx watchdog ")); + QApplication::alert (this); + if (SpecOp::HOUND == m_specOp) ui->txrb1->click (); // Go back to Tx1 + } + else + { + m_idleMinutes = 0; + update_watchdog_label (); + } + if (prior != triggered) statusUpdate (); +} + +void MainWindow::update_watchdog_label () +{ + if (!m_auto) m_idleMinutes = 0; // No countdown unless Enable Tx is active (important for Wait & Call) + if (m_config.watchdog () && m_mode!="WSPR" && m_mode!="FST4W") + { + watchdog_label.setText (tr (" WD:%1m ").arg (m_config.watchdog () - m_idleMinutes)); + watchdog_label.setVisible (true); + // Highlight watchdog label yellow when there is less than one minute left + if ((m_config.watchdog() - m_idleMinutes == 1) && (m_auto or m_tune)) + watchdog_label.setStyleSheet ("QLabel{color: #000000; background-color: #ffff00}"); + if (m_config.watchdog() - m_idleMinutes > 1) watchdog_label.setStyleSheet (""); + } + else + { + watchdog_label.setText (QString {}); + watchdog_label.setVisible (false); + } +} + +void MainWindow::on_cbMenus_toggled(bool b) +{ + select_geometry (!b ? 2 : ui->actionSWL_Mode->isChecked () ? 1 : 0); +} + +void MainWindow::on_cbCQonly_toggled(bool) +{ //Fix this -- no decode here? + to_jt9(m_ihsym,1,-1); //Send m_ihsym to jt9[.exe] and start decoding + decodeBusy(true); +} + +void MainWindow::on_cbAutoSeq_toggled(bool b) +{ + ui->respondComboBox->setVisible((m_mode=="FT8" or m_mode=="FT4" or m_mode=="FST4" + or m_mode=="Q65" or m_mode=="MSK144" or m_mode=="JT65" or m_mode=="JT9") and b); + check_button_color(); +} + +void MainWindow::on_measure_check_box_stateChanged (int state) +{ + m_config.enable_calibration (Qt::Checked != state); +} + +void MainWindow::write_transmit_entry (QString const& file_name) +{ + QFile f {m_config.writeable_data_dir ().absoluteFilePath (file_name)}; + if (f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append)) + { + QTextStream out(&f); + auto time = QDateTime::currentDateTimeUtc (); + time = time.addSecs (-fmod(double(time.time().second()),m_TRperiod)); + out << time.toString("yyMMdd_hhmmss") + << " Transmitting " << qSetRealNumberPrecision (12) << (m_freqNominal / 1.e6) + << " MHz " << m_mode + << ": " << m_currentMessage +#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0) + << Qt::endl +#else + << endl +#endif + ; + f.close(); + } + else + { + auto const& message = tr ("Cannot open \"%1\" for append: %2") + .arg (f.fileName ()).arg (f.errorString ()); + QTimer::singleShot (0, [=] { // don't block guiUpdate + MessageBox::warning_message (this, tr ("Log File Error"), message); + }); + } +} + +void MainWindow::readWidebandDecodes() +{ + if(m_ActiveStationsWidget==NULL) return; + int nhr=0; + int nmin=0; + int nsec=0; + int nsnr=0; + while(m_fetched < qmapcom.ndecodes) { + // Recover and parse each decoded line. + QString line=QString::fromLatin1(qmapcom.result[m_fetched]); + m_fetched++; + nhr=line.mid(0,2).toInt(); + nmin=line.mid(2,2).toInt(); + nsec=line.mid(4,2).toInt(); + int sTimeString = line.mid(0,6).toInt(); + QTime time2(nhr, nmin, nsec); + QDateTime qSpotTime; + if (sTimeString + m_TRperiod < 236000) { + qSpotTime = QDateTime(QDateTime::currentDateTimeUtc().date(), time2, Qt::UTC); + } + else { + qSpotTime = QDateTime((QDateTime::currentDateTimeUtc().addDays(-1)).date(), time2, Qt::UTC); + } + double frx=line.mid(6,9).toDouble(); + double fsked=line.mid(16,7).toDouble(); + QString submode=line.mid(36,3); + QString msg=line.mid(41,-1); + int i1=msg.indexOf(" "); + int i2=i1 +1 + msg.mid(i1+1,-1).indexOf(" "); + QString dxcall=msg.mid(i1+1,i2-i1-1); + if(stdCall(dxcall)) { + QString w3=msg.mid(i2+1,-1); + nsnr=line.mid(31,3).toInt(); + m_EMECall[dxcall].frx=frx; + m_EMECall[dxcall].fsked=fsked; + m_EMECall[dxcall].nsnr=nsnr; + m_EMECall[dxcall].t=3600*nhr + 60*nmin + nsec; + m_EMECall[dxcall].submode=submode; + if(w3.contains(grid_regexp)) m_EMECall[dxcall].grid4=w3; + bool bCQ=line.contains(" CQ "); +// m_EMECall[dxcall].ready2call=(bCQ or line.contains(" 73") or line.contains(" RR73")); + m_EMECall[dxcall].ready2call=(bCQ); + Frequency frequency = (m_freqNominal/1000000) * 1000000 + int(fsked*1000.0); + bool bFromDisk=qmapcom.nQDecoderDone==2; + if(!bFromDisk and (m_EMECall[dxcall].grid4.contains(grid_regexp) or bCQ)) { + qDebug() << "To PSKreporter:" << dxcall << m_EMECall[dxcall].grid4 << frequency << m_mode << nsnr; + if (!m_psk_Reporter.addRemoteStation (dxcall, m_EMECall[dxcall].grid4, frequency, m_mode, nsnr, qSpotTime)) { + showStatusMessage (tr ("Spotting to PSK Reporter unavailable")); + } + } + } + } + + if (m_config.spot_to_psk_reporter ()) { + m_psk_Reporter.sendReport(); // Upload any queued spots + } + +// Update "m_wEMECall" by reading qmap_decodes.txt + QMap<QString,EMECall>::iterator i; + QString t=""; + QString t1; + QString dxcall; + QString dxgrid4; + QStringList list; + float f[100]; + int indx[100]; + int maxAge=m_ActiveStationsWidget->maxAge(); + + m_ActiveStationsWidget->setClickOK(false); + int k=0; + + for(i=m_EMECall.begin(); i!=m_EMECall.end(); i++) { + bool bSkip=false; + if(m_ActiveStationsWidget->wantedOnly() and m_EMEworked[i.key()]) bSkip=true; + if(m_ActiveStationsWidget->readyOnly() and !i->ready2call) bSkip=true; + if(!bSkip) { + int snr=i->nsnr; + QString submode=i->submode; + int odd=0; + if(submode.left(2)=="30" and (i->t%60)==0) odd=1; + if(submode.left(2)=="60" and (i->t%120)==0) odd=1; + int age=(3600*nhr + 60*nmin + nsec - (i->t))/60; + char c2[3]={32,32,0}; + if(age<0) age += 1440; + if(age<=maxAge) { + dxcall=(i.key()+" ").left(8); + dxgrid4=(i->grid4+"... ").left(4); + if(!m_EMEworked[dxcall.trimmed()]) c2[0]=35; //# for not in log + if(i->ready2call) c2[1]=42; //* for ready to call + t1=t1.asprintf("%7.3f %5.1f %+03d %3s %8s %4s %3d %3d %2s\n",i->frx,i->fsked,snr, + submode.toLatin1().constData(),dxcall.toLatin1().constData(), + dxgrid4.toLatin1().constData(),odd,age,c2); + f[k]=i->fsked; + list.append(t1); + k++; + } + m_ActiveStationsWidget->setClickOK(true); + } + } + + if(k>0) { + t1=""; + int kz=k; + indexx_(f,&kz,indx); + for(int k=0; k<kz; k++) { + int j=indx[k]-1; + t1=t1.asprintf("%2d. ",k+1); + t1+=list[j]; + m_ready2call[k]=list[j]; + t+=t1; + } + } + + if(m_ActiveStationsWidget != NULL) { + m_ActiveStationsWidget->erase(); + m_ActiveStationsWidget->displayRecentStations(m_mode,t); + m_ActiveStationsWidget->setClickOK(true); + } + if(ipc_qmap[2]!=0) { + m_fetched=0; + ipc_qmap[0]=0; + ipc_qmap[2]=0; + } +} + +// -------------------------- Code for FT8 DXpedition Mode --------------------------- + +void MainWindow::hound_reply () +{ + if (!m_tune) { + // Select Tx3, set TxFreq to FoxFreq, and Force Auto ON. + ui->txrb3->setChecked (true); + m_nSentFoxRrpt = 1; + ui->rptSpinBox->setValue(m_rptSent.toInt()); + if (!m_auto) auto_tx_mode(true); + if (!m_config.superFox()) ui->TxFreqSpinBox->setValue (m_nFoxFreq); + stopWRTimer.start(int(11000.0*m_TRperiod)); // Tx3 timeout when in Hound mode + } +} + +void MainWindow::on_sbNlist_valueChanged(int n) +{ + m_Nlist=n; +} + +void MainWindow::on_sbNslots_valueChanged(int n) +{ + if(m_specOp!=SpecOp::FOX) return; + if(m_config.superFox()) return; // Don't allow setting m_Nslots manually in SF mode + m_Nslots=n; + if(m_specOp!=SpecOp::FOX) return; + QString t; + t = t.asprintf(" NSlots %d",m_Nslots); + writeFoxQSO(t); + if(!m_config.superFox()) m_Nslots0=n; +} + +void MainWindow::FoxReset(QString reason="") +{ + QFile f(m_config.temp_dir().absoluteFilePath("houndcallers.txt")); + f.remove(); + ui->decodedTextBrowser->setText(""); + ui->houndQueueTextBrowser->setText(""); + ui->foxTxListTextBrowser->setText(""); + + m_houndQueue.clear(); + m_foxQSO.clear(); + m_foxQSOinProgress.clear(); + m_discard_decoded_hounds_this_cycle = true; // discard decoded messages until the next cycle + if (reason != "") writeFoxQSO(" " + reason); + writeFoxQSO(" Reset"); +} + +void MainWindow::on_pbFoxReset_clicked() +{ + if(m_specOp!=SpecOp::FOX) return; + auto button = MessageBox::query_message (this, tr ("Confirm Reset"), + tr ("Are you sure you want to clear the QSO queues?")); + if(button == MessageBox::Yes) { + FoxReset(); + } +} + +void MainWindow::on_pbFreeText_clicked() +{ + bool ok; + if(m_config.superFox()) { + m_freeTextMsg = QInputDialog::getText (this, tr("Free Text Message"), + tr("Message:"), QLineEdit::Normal, m_freeTextMsg0, &ok).left(26); + } else { + m_freeTextMsg = QInputDialog::getText (this, tr("Free Text Message"), + tr("Message:"), QLineEdit::Normal, m_freeTextMsg0, &ok).left(13); + } + if(ok) { + m_freeTextMsg=m_freeTextMsg.toUpper(); + m_freeTextMsg0=m_freeTextMsg; + } +} + +void MainWindow::on_comboBoxHoundSort_activated(int index) +{ + if(index!=-99) houndCallers(); //Silence compiler warning +} + +void MainWindow::on_comboBoxCQ_activated() +{ + if(m_config.superFox()) { + ui->comboBoxCQ->setCurrentIndex(0); // No directional calls supported yet for SuperFox mode + QTimer::singleShot (0, [=] { // don't block guiUpdate + MessageBox::information_message(this, tr ("Directional calls not yet supported in SuperFox mode")); + }); + } +} + +#ifdef FOX_OTP +QString MainWindow::foxOTPcode() +{ + QString code; + if (!m_config.OTPSeed().isEmpty()) + { + + OTPGenerator totp; + QDateTime dateTime = dateTime.currentDateTime(); + code = totp.generateTOTP(m_config.OTPSeed(), dateTime, 6); + LOG_INFO(QString("foxOTPcode: code is %1").arg(code)); + } else + { + code = "000000"; + showStatusMessage(tr("TOTP: No seed entered in fox configuration to generate verification code.")); + LOG_INFO(QString("foxOTPcode: No seed entered in fox configuration to generate verification code.")); + } + return code; +} +#endif + +//------------------------------------------------------------------------------ +QString MainWindow::sortHoundCalls(QString t, int isort, int max_dB) +{ +/* Called from "houndCallers()" to sort the list of calling stations by + * specified criteria. + * + * QString "t" contains a list of Hound callers read from file "houndcallers.txt". + * isort=0: random (shuffled order) + * 1: Call + * 2: Grid + * 3: SNR (reverse order) + * 4: Distance (reverse order) + * 5: Age (reverse order) + * 6: Continent + * 7: User defined (reverse order) + * +*/ + + QMap<QString,QString> map; + QStringList lines,lines2; + QString msg,houndCall,t1; + QString ABC{"ABCDEFGHIJKLMNOPQRSTUVWXYZ _"}; + QList<int> reverse_sorted{3,4,5,6}; + QString Continents{" AF AN AS EU NA OC SA UN "}; // matches what we get from AD1C's country list + QList<int> list; + int i,j,k,n,nlines; + bool bReverse = reverse_sorted.contains(isort); + + isort=qAbs(isort); +// Save only the most recent transmission from each caller. + lines = t.split("\n"); + nlines=lines.length()-1; + for(i=0; i<nlines; i++) { + msg=lines.at(i); //key = callsign + if(msg.mid(13,1)==" ") msg=msg.mid(0,13) + "...." + msg.mid(17); + houndCall=msg.split(" ").at(0); //value = "call grid snr freq dist age continent user-defined + map[houndCall]=msg; + } + + j=0; + t=""; + for(auto a: map.keys()) { + t1=map[a].split(" ",SkipEmptyParts).at(2); + // add the user-defined value to the end of the line. Example: + // JJ0NCC PM97 15 2724 7580 2 AS 67 + // PY7ZZ HI21 -13 1673 10549 1 SA - + + QString annotated_value_s{" - "}; // default + qint32 annotated_value = 0; + + if (m_annotated_callsigns.contains(a)) { + annotated_value = m_annotated_callsigns.value(a); + annotated_value_s = QString::number(annotated_value); + } + + map[a] += QString(" %1").arg(annotated_value_s, 8); + int nsnr=t1.toInt(); // get snr + if(nsnr <= max_dB) { // keep only if snr in specified range + if(isort==1) t += map[a] + "\n"; + if (isort==3 or isort==4 or isort==5) { // numeric ones: snr, distance, age + if (isort==3) + i=2; // sort Hound calls by snr + else + i=isort; // part of the line that we want + t1=map[a].split(" ",SkipEmptyParts).at(i); + int isort_value = t1.toInt(); + if (isort==5) { // sort by age ascending + isort_value = (100 < isort_value ? 100 : 100-isort_value); + } + n=1000*(isort_value+100) + j; // pack (snr or dist or age) and index j into n + list.insert(j,n); // add n to list at [j] + } + if (isort == 6) { // sort by continent + i = 6; + QStringList parts = map[a].split(" ", SkipEmptyParts); + if (parts.size() <= i + 1) { + n = j; + } else { + QString cont = map[a].split(" ", SkipEmptyParts).at(i); + int cont_n = Continents.indexOf(" " + cont + " "); + n = 1000 + 1000 * cont_n + j; // index may return -1, so add 1000 to make it positive + } + list.insert(j, n); + } + + if(isort==2) { // sort Hound calls by grid + t1=map[a].split(" ",SkipEmptyParts).at(1); + if(t1=="....") t1="ZZ99"; + int i1=ABC.indexOf(t1.mid(0,1)); + int i2=ABC.indexOf(t1.mid(1,1)); + n=100*(26*i1+i2)+t1.mid(2,2).toInt(); + n=1000*n + j; // pack ngrid and index j into n + list.insert(j,n); // add n to list at [j] + } + + if(isort==7) { // annotated value provided by external app + n = 1000 + 1000 * std::max((qint32) 0, annotated_value) + j; + list.insert(j, n); + } + + lines2.insert(j,map[a]); // add map[a] to lines2 at [j] + j++; + } + } + + if(isort>1) { + if(bReverse) { + std::sort (list.begin (), list.end (), std::greater<int> ()); + } else { + std::sort (list.begin (), list.end ()); + } + } + + if(isort>1) { + for(i=0; i<j; i++) { + k=list[i]%1000; + n=list[i]/1000 - 100; + t += lines2.at(k) + "\n"; + } + } + + int nn=lines2.length(); + if(isort==0) { // shuffle Hound calls to random order + int a[nn]; + for(i=0; i<nn; i++) { + a[i]=i; + } + for(i=nn-1; i>-1; i--) { +#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0) + j = (i + 1) * QRandomGenerator::global ()->generateDouble (); +#else + j=(i+1)*double(qrand())/RAND_MAX; +#endif + std::swap (a[j], a[i]); + t += lines2.at(a[i]) + "\n"; + } + } + + int i0=t.indexOf("\n") + 1; + m_nSortedHounds=0; + if(i0 > 0) { + m_nSortedHounds=qMin(t.length(),m_Nlist*i0)/i0; // Number of sorted & displayed Hounds + } + m_houndCallers=t.mid(0,m_Nlist*i0); + + return m_houndCallers; +} + +void MainWindow::removeHoundFromCallingList(QString callsign) +{ + QString text = m_houndCallers; + QRegularExpression re = QRegularExpression("^" + callsign + "[^\\n]+\\n", QRegularExpression::MultilineOption); + text.remove(re); + if (text != m_houndCallers) { + m_nSortedHounds--; + m_houndCallers = text; + ui->decodedTextBrowser->setHighlightedHoundText(m_houndCallers); + } +} +//------------------------------------------------------------------------------ +void MainWindow::selectHound(QString line, bool bTopQueue) +{ +/* Called from doubleClickOnCall() in DXpedition Fox mode. + * QString "line" is a user-selected line from left text window. + * The line may be selected by double-clicking; alternatively, hitting + * <Enter> is equivalent to double-clicking on the top-most line. +*/ + if(line.simplified().isEmpty()) return; + if(line.length() < 6) return; + QString houndCall=line.split(" ",SkipEmptyParts).at(0); + +// Don't add a call already enqueued or in QSO + if(ui->houndQueueTextBrowser->toPlainText().indexOf(houndCall) >= 0) return; + + QString houndGrid=line.split(" ",SkipEmptyParts).at(1); // Hound caller's grid + QString rpt=line.split(" ",SkipEmptyParts).at(2); // Hound SNR + + m_houndCallers=m_houndCallers.remove(line+"\n"); // Remove t from sorted Hound list + m_nSortedHounds--; + ui->decodedTextBrowser->setHighlightedHoundText(m_houndCallers); // Populate left window with Hound callers + QString t1=houndCall + " "; + QString t2=rpt; + QString t1_with_grid; + if(rpt.mid(0,1) != "-" and rpt.mid(0,1) != "+") t2="+" + rpt; + if(t2.length()==2) t2=t2.mid(0,1) + "0" + t2.mid(1,1); + t1=t1.mid(0,12) + t2; + // display the callers, highlighting calls if necessary + ui->houndQueueTextBrowser->insertText(bTopQueue ? t1 + "\n" : t1, QColor{}, QColor{}, houndCall, "", bTopQueue ? QTextCursor::Start : QTextCursor::End); + t1_with_grid=t1 + " " + houndGrid; // Append the grid + if (bTopQueue) { + m_houndQueue.prepend(t1_with_grid); // Put this hound into the queue at the top + } else { + m_houndQueue.enqueue(t1_with_grid); // Put this hound into the queue + } + writeFoxQSO(" Sel: " + t1_with_grid); + QTextCursor cursor = ui->houndQueueTextBrowser->textCursor(); + cursor.setPosition(0); // Scroll to top of list + ui->houndQueueTextBrowser->setTextCursor(cursor); + cursor = ui->decodedTextBrowser->textCursor(); + cursor.setPosition(0); // Highlighting happens in the forward direction + ui->decodedTextBrowser->setTextCursor(cursor); +} + +//------------------------------------------------------------------------------ +void MainWindow::houndCallers() +{ +/* Called from decodeDone(), in DXpedition Fox mode. Reads decodes from file + * "houndcallers.txt", ignoring any that are not addressed to MyCall, are already + * in the stack, or with whom a QSO has been started. Others are considered to + * be Hounds eager for a QSO. We add caller information (Call, Grid, SNR, Freq, + * Distance, Age, and Continent) to a list, sort the list by specified criteria, + * and display the top N_Hounds entries in the left text window. +*/ + // if frequency was changed in the middle of an interval, there's a flag set to ignore the decodes. Reset it here + // + + if (m_discard_decoded_hounds_this_cycle) + { + m_discard_decoded_hounds_this_cycle = false; // + return; // don't use these decodes + } + +// Read decodes of the current period + QFile d(m_config.temp_dir().absoluteFilePath("decoded.txt")); + QTextStream ds(&d); + QString decoded=""; + if(d.open(QIODevice::ReadOnly | QIODevice::Text)) { + while (!ds.atEnd()) { + decoded = ds.readAll(); + } + ds.flush(); + d.close(); + } + + QFile f(m_config.temp_dir().absoluteFilePath("houndcallers.txt")); + if(f.open(QIODevice::ReadOnly | QIODevice::Text)) { + QTextStream s(&f); + QString t=""; + QString line,houndCall,paddedHoundCall; + m_nHoundsCalling=0; + int nTotal=0; //Total number of decoded Hounds calling Fox in 4 most recent Rx sequences + +// Read and process the file of Hound callers. + while(!s.atEnd()) { + line=s.readLine(); + nTotal++; + int i0=line.indexOf(" "); + houndCall=line.mid(0,i0); + paddedHoundCall=houndCall + " "; + //Don't list a hound already in the queue + if(!ui->houndQueueTextBrowser->toPlainText().contains(paddedHoundCall)) { + if(ui->cbWorkDupes->isChecked()) { + if(m_loggedByFox[houndCall].contains(m_lastBand) + and !decoded.contains(paddedHoundCall)) continue; // don't display old messages again of stations already logged + } + if(m_foxQSOinProgress.contains(houndCall) || m_foxQSO.contains(houndCall)) + { + continue; + } // still in the QSO map, or was (very) recently worked + + if(m_foxQSO.contains(houndCall) && !ui->cbRxAll->isChecked()) { + continue; + } // already worked + auto const& entity = m_logBook.countries ()->lookup (houndCall); + auto const& continent = AD1CCty::continent (entity.continent); + +// If we are using a directed CQ, ignore Hound calls that do not comply. + QString CQtext=ui->comboBoxCQ->currentText(); + if(CQtext.length()==5 and (continent!=CQtext.mid(3,2))) continue; + int nCallArea=-1; + if(CQtext.length()==4) { + for(int i=houndCall.length()-1; i>0; i--) { + if(houndCall.mid(i,1).toInt() > 0) nCallArea=houndCall.mid(i,1).toInt(); + if(houndCall.mid(i,1)=="0") nCallArea=0; + if(nCallArea>=0) break; + } + if(nCallArea!=CQtext.mid(3,1).toInt()) continue; + } +// This houndCall passes all tests, add it to the list. + t = t + line + " " + continent + "\n"; + m_nHoundsCalling++; // Number of accepted Hounds to be sorted + } + } + if(m_foxLogWindow) m_foxLogWindow->callers (nTotal); + +// Sort and display accumulated list of Hound callers + if(t.length()>30) { + m_isort=ui->comboBoxHoundSort->currentIndex(); + QString t1=sortHoundCalls(t,m_isort,m_max_dB); + ui->decodedTextBrowser->setHighlightedHoundText(t1); + } + QTextCursor cursor = ui->decodedTextBrowser->textCursor(); + cursor.setPosition(0); // Set scroll at top, in preparation for highlighting messages + ui->decodedTextBrowser->setTextCursor(cursor); + f.close(); + } +} + +void MainWindow::foxRxSequencer(QString msg, QString houndCall, QString rptRcvd) +{ +/* Called from "readFromStdOut()" to process decoded messages of the form + * "myCall houndCall R+rpt". + * + * If houndCall matches a callsign in one of our active QSO slots, we + * prepare to send "houndCall RR73" to that caller. +*/ + if(m_foxQSO.contains(houndCall)) { + m_foxQSO[houndCall].rcvd=rptRcvd.mid(1); //Save report Rcvd, for the log + m_foxQSO[houndCall].tFoxRrpt=m_tFoxTx; //Save time R+rpt was received + writeFoxQSO(" Rx: " + msg.trimmed()); + } else { + for(QString hc: m_foxQSO.keys()) { //Check for a matching compound call + if(hc.contains("/"+houndCall) or hc.contains(houndCall+"/")) { + m_foxQSO[hc].rcvd=rptRcvd.mid(1); //Save report Rcvd, for the log + m_foxQSO[hc].tFoxRrpt=m_tFoxTx; //Save time R+rpt was received + writeFoxQSO(" Rx: " + msg.trimmed()); + } + } + } +} + +void MainWindow::updateFoxQSOsInProgressDisplay() +{ + + ui->foxTxListTextBrowser->clear(); + for (int i = 0; i < m_foxQSOinProgress.count(); i++) + { + //First do those for QSOs in progress + QString hc = m_foxQSOinProgress.at(i); + QString status = m_foxQSO[hc].ncall > m_maxStrikes ? QString(" (rx) ") : QString(" "); + QString str = (hc + " ").left(13) + QString::number(m_foxQSO[hc].ncall) + status; + ui->foxTxListTextBrowser->insertText(str, QColor{}, QColor{}, hc, "", QTextCursor::End); + } +} + +void MainWindow::foxTxSequencer() +{ +/* Called from guiUpdate at the point where an FT8 Fox-mode transmission + * is to be started. + * + * Determine what the Tx message(s) will be for each active slot, call + * foxgen() to generate and accumulate the corresponding waveform. +*/ + + qint64 now=QDateTime::currentMSecsSinceEpoch()/1000; + QStringList list1; //Up to NSlots Hound calls to be sent RR73 + QStringList list2; //Up to NSlots Hound calls to be sent a report + QString fm; //Fox message to be transmitted + QString hc,hc1,hc2; //Hound calls + QString t,rpt; + qint32 islot=0; + qint32 ncalls_sent=0; + qint32 n1,n2,n3; + int nMaxRemainingSlots=0; + static unsigned int m_tFoxTxSinceOTP=99; + + m_tFoxTxSinceOTP++; + m_tFoxTx++; //Increment Fox Tx cycle counter + + // Is it time for a stand-alone CQ? + if(m_tFoxTxSinceCQ >= m_foxCQtime and ui->cbMoreCQs->isChecked()) { + fm=ui->comboBoxCQ->currentText() + " " + m_config.my_callsign(); + if(!fm.contains("/")) { + //If Fox is not a compound callsign, add grid to the CQ message. + fm += " " + m_config.my_grid().mid(0,4); + m_fullFoxCallTime=now; + } + m_tFoxTx0=m_tFoxTx; //Remember when we sent a CQ + islot++; + foxGenWaveform(islot-1,fm); + goto Transmit; + } + + // Maybe send out the freetext message? + if (!m_config.superFox() && ui->cbSendMsg->isChecked() && (islot < m_Nslots)) { + fm = m_freeTextMsg; + islot++; + foxGenWaveform(islot - 1, fm); + } + +#ifdef FOX_OTP + // Send OTP message maybe for regular fox mode + if (!m_config.superFox() && m_config.OTPEnabled() && (islot < m_Nslots) && (m_tFoxTxSinceOTP >= m_config.OTPinterval())) + { + // truncated callsign + OTP code (to be under 13 character limit of free text) + QString trunc_call=m_config.my_callsign().left(6).split("/").at(0); // truncate callsign to 6 characters + fm = trunc_call + "." + foxOTPcode(); // N5J-> N5J.123456, W1AW/7 -> W1AW.123456, 4U1IARU -> 4U1IAR.123456 + m_tFoxTxSinceOTP = 0; //Remember when we sent a Tx5 + islot++; + foxGenWaveform(islot - 1, fm); + } +#endif + +//Compile list1: up to NSLots Hound calls to be sent RR73 + for(QString hc: m_foxQSO.keys()) { //Check all Hound calls: First priority + if(m_foxQSO[hc].tFoxRrpt<0) continue; + if(m_foxQSO[hc].tFoxRrpt - m_foxQSO[hc].tFoxTxRR73 > 3) { + //Has been a long time since we sent RR73 + if(list1.size()>=(m_Nslots - islot)) goto list1Done; + list1 << hc; //Add to list1 + m_foxQSO[hc].tFoxTxRR73 = m_tFoxTx; //Time RR73 is sent + m_foxQSO[hc].nRR73++; //Increment RR73 counter + } + } + + for(QString hc: m_foxQSO.keys()) { //Check all Hound calls: Second priority + if(m_foxQSO[hc].tFoxRrpt<0) continue; + if(m_foxQSO[hc].tFoxTxRR73 < 0) { + //Have not yet sent RR73 + if(list1.size()>=(m_Nslots - islot)) goto list1Done; + list1 << hc; //Add to list1 + m_foxQSO[hc].tFoxTxRR73 = m_tFoxTx; //Time RR73 is sent + m_foxQSO[hc].nRR73++; //Increment RR73 counter + } + } + + for(QString hc: m_foxQSO.keys()) { //Check all Hound calls: Third priority + if(m_foxQSO[hc].tFoxRrpt<0) continue; + if(m_foxQSO[hc].tFoxTxRR73 <= m_foxQSO[hc].tFoxRrpt) { + //We received R+rpt more recently than we sent RR73 + if(list1.size()>=(m_Nslots - islot)) goto list1Done; + list1 << hc; //Add to list1 + m_foxQSO[hc].tFoxTxRR73 = m_tFoxTx; //Time RR73 is sent + m_foxQSO[hc].nRR73++; //Increment RR73 counter + } + } + +list1Done: +//Compile list2: Up to Nslots Hound calls to be sent a report. +// For Superfox, up to 5 RR73, but only 4 callsigns with reports. m_NSlots should be 5 for SF. + nMaxRemainingSlots = (m_config.superFox()) ? m_Nslots - 1 : m_Nslots; + if(m_config.superFox() and ui->cbSendMsg->isChecked()) nMaxRemainingSlots=4; + for(int i=0; i<m_foxQSOinProgress.count(); i++) { + //First do those for QSOs in progress + hc=m_foxQSOinProgress.at(i); + if((m_foxQSO[hc].tFoxRrpt < 0) and (m_foxQSO[hc].ncall < m_maxStrikes)) { + //Sent him a report and have not received R+rpt: call him again + if(list2.size()>=(nMaxRemainingSlots - islot)) goto list2Done; + list2 << hc; //Add to list2 + if(list2.size() == nMaxRemainingSlots) goto list2Done; + } + } + + while(!m_houndQueue.isEmpty()) { + //Start QSO with a new Hound + if (list2.size() == (nMaxRemainingSlots - islot)) + { + break; + } + t=m_houndQueue.dequeue(); //Fetch new hound from queue + int i0=t.indexOf(" "); + hc=t.mid(0,i0); //hound call + list2 << hc; //Add new Hound to list2 + m_foxQSOinProgress.enqueue(hc); //Put him in the QSO queue + m_foxQSO[hc].grid=t.mid(16,4); //Hound grid + rpt=t.mid(12,3); //report to send Hound + m_foxQSO[hc].sent=rpt; //Report to send him + m_foxQSO[hc].ncall=0; //Start a new Hound + m_foxQSO[hc].nRR73 = 0; //Have not sent RR73 + m_foxQSO[hc].rcvd = -99; //Have not received R+rpt + m_foxQSO[hc].tFoxRrpt = -1; //Have not received R+rpt + m_foxQSO[hc].tFoxTxRR73 = -1; //Have not sent RR73 + refreshHoundQueueDisplay(); + } + +list2Done: + + n1=list1.size(); + n2=list2.size(); + n3=qMax(n1,n2); + if(n3>m_Nslots) n3=m_Nslots; + for(int i=0; i<n3; i++) { + hc1=""; + fm=""; + if(i<n1 and i<n2) { + hc1=list1.at(i); + hc2=list2.at(i); + m_foxQSO[hc2].ncall++; + fm = Radio::base_callsign(hc1) + " RR73; " + Radio::base_callsign(hc2) + + " <" + m_config.my_callsign() + "> " + m_foxQSO[hc2].sent; + } + if(i<n1 and i>=n2) { + hc1=list1.at(i); + fm = Radio::base_callsign(hc1) + " " + m_baseCall + " RR73"; //Standard FT8 message + } + + if(hc1!="") { + auto already_logged = m_loggedByFox[hc1].contains(m_lastBand + " "); // already logged this call on this band? + + if (!already_logged) { // Log this QSO! + auto QSO_time = QDateTime::currentDateTimeUtc (); + m_hisCall=hc1; + m_hisGrid=m_foxQSO[hc1].grid; + m_rptSent=m_foxQSO[hc1].sent; + m_rptRcvd=m_foxQSO[hc1].rcvd; + if (!m_foxLogWindow) on_fox_log_action_triggered (); + if (m_logBook.fox_log ()->add_QSO (QSO_time, m_hisCall, m_hisGrid, m_rptSent, m_rptRcvd, m_lastBand)) + { + writeFoxQSO (QString {" Log: %1 %2 %3 %4 %5"}.arg (m_hisCall).arg (m_hisGrid) + .arg (m_rptSent).arg (m_rptRcvd).arg (m_lastBand)); + on_logQSOButton_clicked (); + QTimer::singleShot (13000, [=] { + m_foxQSOinProgress.removeOne(hc1); //Remove from In Progress window + updateFoxQSOsInProgressDisplay(); //Update InProgress display after Tx is complete + }); + } + m_loggedByFox[hc1] += (m_lastBand + " "); + } + else + { + // note that this is a duplicate + writeFoxQSO(QString{" Dup: %1 %2 %3 %4 %5"}.arg(m_hisCall).arg(m_hisGrid) + .arg(m_rptSent).arg(m_rptRcvd).arg(m_lastBand)); + } + } + + if(i<n2 and fm=="") { + hc2=list2.at(i); + m_foxQSO[hc2].ncall++; + fm = Radio::base_callsign(hc2) + " " + m_baseCall + " " + m_foxQSO[hc2].sent; //Standard FT8 message + } + islot++; + ncalls_sent++; + foxGenWaveform(islot-1,fm); //Generate tx waveform + } + + if(islot < m_Nslots) { + //At least one slot is still open + if(ncalls_sent==0 or ((m_tFoxTx-m_tFoxTx0>=4) and ui->cbMoreCQs->isChecked())) { + //Roughly every 4th Tx sequence, put a CQ message in an otherwise empty slot + fm=ui->comboBoxCQ->currentText() + " " + m_config.my_callsign(); + if(!fm.contains("/")) { + fm += " " + m_config.my_grid().mid(0,4); + m_tFoxTx0=m_tFoxTx; //Remember when we send a CQ + m_fullFoxCallTime=now; + } + islot++; + foxGenWaveform(islot-1,fm); + } + } + +Transmit: + foxcom_.nslots=islot; + foxcom_.nfreq=ui->TxFreqSpinBox->value(); + if(m_config.split_mode()) foxcom_.nfreq = foxcom_.nfreq - m_XIT; //Fox Tx freq + QString foxCall=m_config.my_callsign() + " "; + ::memcpy(foxcom_.mycall, foxCall.toLatin1(),sizeof foxcom_.mycall); //Copy Fox callsign into foxcom_ + bool bSuperFox=m_config.superFox(); + foxcom_.bMoreCQs=ui->cbMoreCQs->isChecked(); + foxcom_.bSendMsg=ui->cbSendMsg->isChecked(); + ::memcpy(foxcom_.textMsg, m_freeTextMsg0.leftJustified(26,' ').toLatin1(),26); + auto fname {QDir::toNativeSeparators(m_config.writeable_data_dir().absoluteFilePath("sfox_1.dat")).toLocal8Bit()}; + foxgen_(&bSuperFox, fname.constData(), (FCL)fname.size()); + if(bSuperFox) { + writeFoxTxMsgs(); + sfox_tx(); + } + m_tFoxTxSinceCQ++; + + for(QString hc: m_foxQSO.keys()) { //Check for strikeout or timeout + if(m_foxQSO[hc].ncall>=m_maxStrikes) m_foxQSO[hc].ncall++; + bool b1=((m_tFoxTx - m_foxQSO[hc].tFoxRrpt) > 2*m_maxFoxWait) and + (m_foxQSO[hc].tFoxRrpt > 0); + bool b2=((m_tFoxTx - m_foxQSO[hc].tFoxTxRR73) > m_maxFoxWait) and + (m_foxQSO[hc].tFoxTxRR73>0); + bool b3=(m_foxQSO[hc].ncall >= m_maxStrikes+m_maxFoxWait); + bool b4=(m_foxQSO[hc].nRR73 >= m_maxStrikes); + if(b1 or b2 or b3 or b4) { + m_foxQSO.remove(hc); + m_foxQSOinProgress.removeOne(hc); + } + } + + if (m_foxLogWindow) + { + update_foxLogWindow_rate(); + m_foxLogWindow->queued (m_foxQSOinProgress.count ()); + } + updateFoxQSOsInProgressDisplay(); +} + +void MainWindow::update_foxLogWindow_rate() +{ + if (m_foxLogWindow) { + m_foxLogWindow->rate(m_logBook.fox_log()->rate()); + } +} + +void MainWindow::refreshHoundQueueDisplay() +{ + ui->houndQueueTextBrowser->clear(); + for (QString line: m_houndQueue) { + auto hc = line.mid(0, 12).trimmed(); + ui->houndQueueTextBrowser->insertText(line, QColor{}, QColor{}, hc, "", QTextCursor::End); + } +} + +void MainWindow::doubleClickOnFoxQueue(Qt::KeyboardModifiers modifiers) +{ + if(modifiers==9999) return; //Silence compiler warning + QTextCursor cursor=ui->houndQueueTextBrowser->textCursor(); + cursor.setPosition(cursor.selectionStart()); + QString houndLine=cursor.block().text(); + QString houndCall=houndLine.mid(0,12).trimmed(); + + if (modifiers == (Qt::AltModifier)) + { + //Alt-click on a Fox queue entry - put on top of queue + // remove + for(auto i=0; i<m_houndQueue.size(); i++) { + QString t = m_houndQueue[i]; + QString hc = t.mid(0, 12).trimmed(); + if (hc == houndCall) { + m_houndQueue.removeAt(i); + break; + } + } + m_houndQueue.prepend(houndLine); + refreshHoundQueueDisplay(); + } else + { + writeFoxQSO(" Del: " + houndCall); + QQueue <QString> tmpQueue; + while (!m_houndQueue.isEmpty()) + { + QString t = m_houndQueue.dequeue(); + QString hc = t.mid(0, 12).trimmed(); + if (hc != houndCall) tmpQueue.enqueue(t); + } + m_houndQueue.swap(tmpQueue); + refreshHoundQueueDisplay(); + } +} + +void MainWindow::doubleClickOnFoxInProgress(Qt::KeyboardModifiers modifiers) +{ + if (modifiers == 9999) return; //Silence compiler warning + QTextCursor cursor = ui->foxTxListTextBrowser->textCursor(); + cursor.setPosition(cursor.selectionStart()); + QString houndLine = cursor.block().text(); + QString houndCall = houndLine.mid(0, 12).trimmed(); + + if (modifiers == 0) + { + m_foxQSO[houndCall].ncall = m_maxStrikes + 1; // time them out + updateFoxQSOsInProgressDisplay(); + } +} + +void MainWindow::foxQueueTopCallCommand() +{ + m_decodedText2 = true; + if(SpecOp::FOX==m_specOp && m_decodedText2 && m_houndQueue.count() < MAX_HOUNDS_IN_QUEUE) + { + + QTextCursor cursor = ui->decodedTextBrowser->textCursor(); + cursor.setPosition(cursor.selectionStart()); + QString houndCallLine = cursor.block().text(); + + writeFoxQSO(" QTop: " + houndCallLine); + selectHound(houndCallLine, true); // alt double-click gets put at top of queue + } +} + +void MainWindow::foxGenWaveform(int i,QString fm) +{ +//Generate and accumulate the Tx waveform + fm += " "; + fm=fm.mid(0,40); + if(fm.mid(0,3)=="CQ ") m_tFoxTxSinceCQ=-1; + + QString txModeArg; + txModeArg = txModeArg.asprintf("FT8fox %d",i+1); + int nfreq=ui->TxFreqSpinBox->value()+60*i; + + if(m_config.superFox() && SpecOp::FOX==m_specOp) { + nfreq=750; + if(i==0 && ui->cbSendMsg->isChecked()) { + ui->decodedTextBrowser2->displayTransmittedText(m_freeTextMsg0, txModeArg, + nfreq,m_bFastMode,m_TRperiod,m_config.superFox()); + } + } + + ui->decodedTextBrowser2->displayTransmittedText(fm.trimmed(), txModeArg, + nfreq,m_bFastMode,m_TRperiod,m_config.superFox()); + foxcom_.i3bit[i]=0; + if(fm.indexOf("<")>0) foxcom_.i3bit[i]=1; + strncpy(&foxcom_.cmsg[i][0],fm.toLatin1(),40); //Copy this message into cmsg[i] + if(i==0) m_fm1=fm; + QString t; + t = t.asprintf(" Tx%d: ",i+1); + writeFoxQSO(t + fm.trimmed()); +} + +void MainWindow::writeFoxTxMsgs() { + // references extern struct foxcom_ + QString t; + for (int i = 0; i < 5; i++) { + t = QString::fromLatin1(foxcom_.cmsg[i]).left(40); + if (t.length() > 0) { + write_all("Tx", t); + } + } + t = QString::fromLatin1(foxcom_.textMsg).left(38); + if (foxcom_.bSendMsg) { + write_all("Tx", "-Free Text- "+t); + } + if (foxcom_.bMoreCQs) { + write_all("Tx", "-MoreCQs- "); + } +} + void MainWindow::writeFoxQSO(QString const& msg) +{ + QString t; + t = t.asprintf("%3d%3d%3d",m_houndQueue.count(),m_foxQSOinProgress.count(),m_foxQSO.count()); + QFile f {m_config.writeable_data_dir ().absoluteFilePath ("FoxQSO.txt")}; + if (f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append)) { + QTextStream out(&f); + out << QDateTime::currentDateTimeUtc().toString("yyyy-MM-dd hh:mm:ss") << " " +#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0) + << Qt::fixed +#else + << fixed +#endif + << qSetRealNumberPrecision (3) << (m_freqNominal/1.e6) + << t << msg +#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0) + << Qt::endl +#else + << endl +#endif + ; + f.close(); + } else { + MessageBox::warning_message (this, tr("File Open Error"), + tr("Cannot open \"%1\" for append: %2").arg(f.fileName()).arg(f.errorString())); + } +} + +/*################################################################################### */ +void MainWindow::foxTest() +{ + QString curdir = QDir::currentPath(); + bool b_hounds_written = false; + + QFile fdiag(m_config.writeable_data_dir ().absoluteFilePath("diag.txt")); + if(!fdiag.open(QIODevice::WriteOnly | QIODevice::Text)) return; + + QFile f(m_config.writeable_data_dir ().absoluteFilePath("steps.txt")); + if(!f.open(QIODevice::ReadOnly | QIODevice::Text)) { + fdiag.write("Cannot open steps.txt"); + return; + } + + QTextStream s(&f); + QTextStream sdiag(&fdiag); + + QFile fhounds(m_config.temp_dir().absoluteFilePath("houndcallers.txt")); + if(!fhounds.open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Text)) + { + sdiag << "can't write to houndcallers.txt"; + return; + } + QTextStream houndstream(&fhounds); + + QString line; + QString t; + QString msg; + QString hc1; + QString rptRcvd; + qint32 n=0; + + while(!s.atEnd()) { + line=s.readLine(); + if(line.length()==0) continue; + if(line.mid(0,4).toInt()==0) line=" " + line; + if(line.contains("NSlots")) { + n=line.mid(44,1).toInt(); + ui->sbNslots->setValue(n); + } + if(line.contains("Sel:")) { + t=line.mid(43,6) + " " + line.mid(54,4) + " " + line.mid(50,3); + selectHound(t, false); + } + auto line_trimmed = line.trimmed(); + if(line_trimmed.startsWith("Hound:")) { + t=line_trimmed.mid(6,-1).trimmed(); + b_hounds_written = true; + houndstream << t +#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0) + << Qt::endl +#else + << endl +#endif + ; + } + + if(line.contains("Del:")) { + int i0=line.indexOf("Del:"); + hc1=line.mid(i0+6); + int i1=hc1.indexOf(" "); + hc1=hc1.mid(0,i1); + + writeFoxQSO(" Del: " + hc1); + QQueue<QString> tmpQueue; + while(!m_houndQueue.isEmpty()) { + t=m_houndQueue.dequeue(); + QString hc=t.mid(0,6).trimmed(); + if(hc != hc1) tmpQueue.enqueue(t); + } + m_houndQueue.swap(tmpQueue); + refreshHoundQueueDisplay(); + } + if(line.contains("Rx:")) { + msg=line.mid(37+6); + t=msg.mid(24); + int i0=t.indexOf(" "); + hc1=t.mid(i0+1); + int i1=hc1.indexOf(" "); + hc1=hc1.mid(0,i1); + int i2=qMax(msg.indexOf("R+"),msg.indexOf("R-")); + if(i2>10) { + rptRcvd=msg.mid(i2,4); + foxRxSequencer(msg,hc1,rptRcvd); + } + } + if(line.contains("Tx1:")) { + foxTxSequencer(); + } else { + t = t.asprintf("%3d %3d %3d %3d %5d ",m_houndQueue.count(), + m_foxQSOinProgress.count(),m_foxQSO.count(), + m_loggedByFox.count(),m_tFoxTx); + sdiag << t << line.mid(37).trimmed() << "\n"; + } + } + if (b_hounds_written) + { + fhounds.close(); + houndCallers(); + } +} + +void MainWindow::write_all(QString txRx, QString message) +{ + if (!(ui->actionDisable_writing_of_ALL_TXT->isChecked())) { + QString line; + QString t; + QString msg; + QString mode_string; + QString file_name="ALL.TXT"; + QRegularExpression verified_call_regex {"[A-Z0-9/]+\\sverified\\s*"}; + + if(m_mode!="Echo") { + if (message.size () > 5 && message[4]==' ') { + msg=message.mid(4,-1); + } else { + msg=message.mid(6,-1); + } + + if (message.size () > 19 && message[19]=='#') { + mode_string="JT65 "; + } else if (message.size () > 19 && message[19]=='@') { + mode_string="JT9 "; + } else if(m_mode=="Q65") { + mode_string=mode_label.text(); + } else { + mode_string=m_mode.leftJustified(6,' '); + } + + if(mode_string=="FT8 " and txRx=="Tx" and m_config.superFox() and + m_specOp==SpecOp::FOX) mode_string="FT8_SF"; + + if(mode_string=="FT8 " and m_config.superFox() and + m_specOp==SpecOp::HOUND) mode_string="FT8_SH"; + + if (mode_string == "FT8_SH" && verified_call_regex.match(message).hasMatch()) { + msg = " "+message; + } else { + msg = msg.mid(0, 15) + msg.mid(18, -1); + } + + t = t.asprintf("%5d",ui->TxFreqSpinBox->value()); + if (txRx=="Tx") msg=" 0 0.0" + t + " " + message; + auto time = QDateTime::currentDateTimeUtc (); + if( (txRx=="Rx" || txRx=="Ck") && !m_bFastMode ) time=m_dateTimeSeqStart; + + if (txRx=="Rx") { + t = t.asprintf("%10.3f ",m_freqNominalPeriod/1.e6); // prevent writing of wrong frequencies + } else { + t = t.asprintf("%10.3f ",m_freqNominal/1.e6); + } + if (m_diskData) { + if (m_fileDateTime.size()==11) { + line=m_fileDateTime + " " + t + txRx + " " + mode_string + msg; + } else { + line=m_fileDateTime + t + txRx + " " + mode_string + msg; + } + } else { + line=time.toString("yyMMdd_hhmmss") + t + txRx + " " + mode_string + msg; + } + + if (ui->actionSplit_ALL_TXT_yearly->isChecked()) file_name=(time.toString("yyyy") + "-" + "ALL.TXT"); + if (ui->actionSplit_ALL_TXT_monthly->isChecked()) file_name=(time.toString("yyyy-MM") + "-" + "ALL.TXT"); + if (m_mode=="WSPR") file_name="ALL_WSPR.TXT"; + } else { + file_name="all_echo.txt"; + line=message; + } + + QFile f{m_config.writeable_data_dir().absoluteFilePath(file_name)}; + if (f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append)) { + QTextStream out(&f); + out << line.trimmed() +#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0) + << Qt::endl +#else + << endl +#endif + ; + f.close(); + } else { + auto const& message2 = tr ("Cannot open \"%1\" for append: %2") + .arg (f.fileName ()).arg (f.errorString ()); + QTimer::singleShot (0, [=] { // don't block guiUpdate + MessageBox::warning_message(this, tr ("Log File Error"), message2); }); + } + } +} + +void MainWindow::chkFT4() +{ + if(m_mode!="FT4") return; + ui->cbAutoSeq->setEnabled(true); + ui->respondComboBox->setVisible(true); + ui->respondComboBox->setEnabled(true); + ui->labDXped->setVisible(m_specOp!=SpecOp::NONE); + ui->respondComboBox->setVisible(ui->cbAutoSeq->isChecked()); + + m_specOp=m_config.special_op_id(); + if(m_specOp!=SpecOp::NONE and m_specOp!=SpecOp::FOX and m_specOp!=SpecOp::HOUND) { + QString t0=""; + if(SpecOp::NA_VHF==m_specOp && m_config.NCCC_Sprint()) t0="NCCC Sprint"; + if(SpecOp::NA_VHF==m_specOp && !m_config.NCCC_Sprint()) t0="NA VHF"; + if(SpecOp::EU_VHF==m_specOp) t0="EU VHF"; + if(SpecOp::FIELD_DAY==m_specOp) t0="Field Day"; + if(SpecOp::RTTY==m_specOp) t0="FT RU"; + if(SpecOp::WW_DIGI==m_specOp) t0="WW Digi"; + if(SpecOp::ARRL_DIGI==m_specOp) t0="ARRL Digi"; + if(SpecOp::Q65_PILEUP==m_specOp) t0="Q65 Pileup"; + if(t0=="") { + ui->labDXped->setVisible(false); + } else { + ui->labDXped->setVisible(true); + ui->labDXped->setText(t0); + } + if(m_specOp!=SpecOp::Q65_PILEUP) on_contest_log_action_triggered(); + } + if (SpecOp::HOUND == m_specOp or SpecOp::FOX == m_specOp) { + ui->labDXped->setVisible(false); + } + +} + +void MainWindow::on_pbBestSP_clicked() +{ + m_bBestSPArmed = !m_bBestSPArmed; + if(m_bBestSPArmed and !m_transmitting) ui->pbBestSP->setStyleSheet ("QPushButton{color:red}"); + if(!m_bBestSPArmed) ui->pbBestSP->setStyleSheet (""); + if(m_bBestSPArmed) m_dateTimeBestSP=QDateTime::currentDateTimeUtc(); +} + +void MainWindow::set_mode (QString const& mode) +{ + if ("FT4" == mode) on_actionFT4_triggered (); + else if ("FST4" == mode) on_actionFST4_triggered (); + else if ("FST4W" == mode) on_actionFST4W_triggered (); + else if ("FT8" == mode) on_actionFT8_triggered (); + else if ("JT4" == mode) on_actionJT4_triggered (); + else if ("JT9" == mode) on_actionJT9_triggered (); + else if ("JT65" == mode) on_actionJT65_triggered (); + else if ("Q65" == mode) on_actionQ65_triggered (); + else if ("FreqCal" == mode) on_actionFreqCal_triggered (); + else if ("MSK144" == mode) on_actionMSK144_triggered (); + else if ("WSPR" == mode) on_actionWSPR_triggered (); + else if ("Echo" == mode) on_actionEcho_triggered (); +} + +void MainWindow::configActiveStations() +{ + if (m_ActiveStationsWidget != NULL and (m_mode == "Q65" or m_mode == "FT4" or m_mode == "FT8")) { + if (m_specOp == SpecOp::Q65_PILEUP) { + m_ActiveStationsWidget->displayRecentStations("Q65-pileup", ""); + } else { + if (m_specOp == SpecOp::FOX) + if (m_config.superFox()) + m_ActiveStationsWidget->displayRecentStations("SuperFox Mode", ""); + else + m_ActiveStationsWidget->displayRecentStations("Fox Mode", ""); + else + m_ActiveStationsWidget->displayRecentStations(m_mode, ""); + } + } +} + +void MainWindow::remote_configure (QString const& mode, quint32 frequency_tolerance + , QString const& submode, bool fast_mode, quint32 tr_period, quint32 rx_df + , QString const& dx_call, QString const& dx_grid, bool generate_messages) +{ + if (mode.size ()) + { + if (mode != m_mode) set_mode (mode); + } + auto is_FST4W = "FST4W" == m_mode; + if (frequency_tolerance != quint32_max && (ui->sbFtol->isVisible () || is_FST4W)) + { + m_block_udp_status_updates = true; + if (is_FST4W) + { + ui->sbFST4W_FTol->setValue (frequency_tolerance); + } + else + { + ui->sbFtol->setValue (frequency_tolerance); + } + m_block_udp_status_updates = false; + } + if (submode.size () && ui->sbSubmode->isVisible ()) + { + ui->sbSubmode->setValue (submode.toUpper ().at (0).toLatin1 () - 'A'); + } + if (ui->cbFast9->isVisible () && ui->cbFast9->isChecked () != fast_mode) + { + ui->cbFast9->click (); + } + if (tr_period != quint32_max && ui->sbTR->isVisible ()) + { + if (is_FST4W) + { + ui->sbTR_FST4W->setValue (tr_period); + ui->sbTR_FST4W->interpretText (); + } + else + { + ui->sbTR->setValue (tr_period); + ui->sbTR->interpretText (); + } + } + if (rx_df != quint32_max && ui->RxFreqSpinBox->isVisible ()) + { + m_block_udp_status_updates = true; + if (is_FST4W) + { + ui->sbFST4W_RxFreq->setValue (rx_df); + ui->sbFST4W_RxFreq->interpretText (); + } + else + { + ui->RxFreqSpinBox->setValue (rx_df); + ui->RxFreqSpinBox->interpretText (); + } + m_block_udp_status_updates = false; + } + if (dx_call.size () && ui->dxCallEntry->isVisible ()) + { + ui->dxCallEntry->setText (dx_call); + } + if (dx_grid.size () && ui->dxGridEntry->isVisible ()) + { + ui->dxGridEntry->setText (dx_grid); + } + if (generate_messages && ui->genStdMsgsPushButton->isVisible ()) + { + ui->genStdMsgsPushButton->click (); + } + if (m_config.udpWindowToFront ()) + { + show (); + raise (); + activateWindow (); + } + if (m_config.udpWindowRestore () && isMinimized ()) + { + showNormal (); + raise (); + } + tx_watchdog (false); + QApplication::alert (this); +} + +QString MainWindow::WSPR_message() +{ + QString sdBm,msg0,msg1,msg2; + sdBm = sdBm.asprintf(" %d",m_dBm); + m_tx=1-m_tx; + int i2=m_config.my_callsign().indexOf("/"); + if(i2>0 + || (6 == m_config.my_grid ().size () + && !ui->WSPR_prefer_type_1_check_box->isChecked ())) { + if(i2<0) { // "Type 2" WSPR message + msg1=m_config.my_callsign() + " " + m_config.my_grid().mid(0,4) + sdBm; + } else { + msg1=m_config.my_callsign() + sdBm; + } + msg0="<" + m_config.my_callsign() + "> " + m_config.my_grid(); + if(m_mode=="WSPR") msg0 += sdBm; + if(m_tx==0) msg2=msg0; + if(m_tx==1) msg2=msg1; + } else { + msg2=m_config.my_callsign() + " " + m_config.my_grid().mid(0,4) + sdBm; // Normal WSPR message + } + return msg2; +} + +void MainWindow::on_houndButton_clicked (bool checked) +{ + if (checked) { + HoldTxFreqStatus = ui->cbHoldTxFreq->isChecked(); // save state of the Hold Tx Freq checkbox + m_config.setSpecial_Hound(); + ui->tx1->setVisible(true); + ui->tx1->setEnabled(true); + ui->txb1->setEnabled(true); + } else { + m_config.setSpecial_None(); + keep_frequency = true; + QTimer::singleShot (250, [=] {keep_frequency = false;}); + } + m_specOp=m_config.special_op_id(); + on_actionFT8_triggered(); + check_button_color(); +} + +void MainWindow::on_cbHoldTxFreq_clicked (bool) +{ + HoldTxFreqStatus = ui->cbHoldTxFreq->isChecked(); // save state of the Hold Tx Freq checkbox +} + +void MainWindow::on_ft8Button_clicked() +{ + if (m_specOp==SpecOp::HOUND or m_specOp==SpecOp::FOX) { + m_config.setSpecial_None(); + m_specOp=m_config.special_op_id(); + } + on_actionFT8_triggered(); +} + +void MainWindow::on_ft4Button_clicked() +{ + on_actionFT4_triggered(); +} + +void MainWindow::on_msk144Button_clicked() +{ + on_actionMSK144_triggered(); +} + +void MainWindow::on_q65Button_clicked() +{ + if (m_specOp==SpecOp::Q65_PILEUP) { + m_config.setSpecial_None(); + m_specOp=m_config.special_op_id(); + } + on_actionQ65_triggered(); +} + +void MainWindow::on_jt65Button_clicked() +{ + on_actionJT65_triggered(); +} + +void MainWindow::on_echoButton_clicked() +{ + on_actionEcho_triggered(); +} + +void MainWindow::sfox_tx() { + auto fname{QDir::toNativeSeparators(m_config.writeable_data_dir().absoluteFilePath("sfox_1.dat")).toLocal8Bit()}; + QString ckey{"OTP:000000"}; + LOG_INFO(QString("sfox_tx: OTP code is %1").arg(foxOTPcode())); +#ifdef FOX_OTP + qint32 otp_key = 0; + if (m_config.OTPEnabled()) + { + LOG_INFO(QString("TOTP: Generating OTP key with %1").arg(m_config.OTPSeed())); + if (m_config.OTPSeed().length() == 16) { + QString output=foxOTPcode(); + if (6 == output.length()) + { + otp_key = QString(output).toInt(); + LOG_INFO(QString("TOTP SF: %1 [%2]").arg(output).arg(otp_key).toStdString()); + } else + { + otp_key = 0; + LOG_INFO(QString("TOTP SF: Incorrect length")); + } + ckey=(QString("OTP:%1").arg(otp_key)); + } else + { + showStatusMessage (tr ("TOTP SF: seed not long enough.")); + LOG_INFO(QString("TOTP SF: seed not long enough")); + } + } +#endif + sftx_sub_(ckey.toLatin1().constData(), (FCL)ckey.size()); + sfox_wave_gfsk_(); +} + +void MainWindow::on_pb15A_clicked() +{ + ui->sbTR->setValue(15); + ui->sbSubmode->setValue(0); +} + +void MainWindow::on_pb15C_clicked() +{ + ui->sbTR->setValue(15); + ui->sbSubmode->setValue(2); + ui->TxFreqSpinBox->setValue(700); +} + +void MainWindow::on_pb30B_clicked() +{ + ui->sbTR->setValue(30); + ui->sbSubmode->setValue(1); +} + +void MainWindow::on_pb60C_clicked() +{ + ui->sbTR->setValue(60); + ui->sbSubmode->setValue(2); +} + +void MainWindow::on_pb60D_clicked() +{ + ui->sbTR->setValue(60); + ui->sbSubmode->setValue(3); +} + +void MainWindow::on_pb60E_clicked() +{ + ui->sbTR->setValue(60); + ui->sbSubmode->setValue(4); + ui->TxFreqSpinBox->setValue(700); +} + +void MainWindow::bandHoppingTimer() +{ + if(ui->pbBandHopping->isChecked()) { + static int startIndex = 0; + int nextStartIndex = startIndex +1; + switch (startIndex){ + case 0: + startIndex = nextStartIndex; // band hopping every other minute + return; + case 1: + m_displayBand = false; + bandHopping(); + startIndex = 0; + return; + } + } +} + +void MainWindow::bandHopping() +{ + if(ui->pbBandHopping->isChecked() && !ui->autoButton->isChecked() && !ui->tuneButton->isChecked()) { + static int startIndex = 0; + int nextStartIndex = startIndex +1; + switch (startIndex){ + case 0: + if (ui->cb160m->isChecked()) { + on_actionFT8_triggered(); + auto const& row = m_config.frequencies ()->best_working_frequency (1840000); + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0) on_bandComboBox_activated (row); + ui->pbBandHopping->setChecked(true); + startIndex = nextStartIndex; + return; + } else { + nextStartIndex++; + } + Q_FALLTHROUGH(); + case 1: + if (ui->cb80m->isChecked()) { + on_actionFT8_triggered(); + auto const& row = m_config.frequencies ()->best_working_frequency (3573000); + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0) on_bandComboBox_activated (row); + ui->pbBandHopping->setChecked(true); + startIndex = nextStartIndex; + return; + } else { + nextStartIndex++; + } + Q_FALLTHROUGH(); + case 2: + if (ui->cb60m->isChecked()) { + on_actionFT8_triggered(); + auto const& row = m_config.frequencies ()->best_working_frequency (5357000); + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0) on_bandComboBox_activated (row); + ui->pbBandHopping->setChecked(true); + startIndex = nextStartIndex; + return; + } else { + nextStartIndex++; + } + Q_FALLTHROUGH(); + case 3: + if (ui->cb40m->isChecked()) { + on_actionFT8_triggered(); + auto const& row = m_config.frequencies ()->best_working_frequency (7074000); + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0) on_bandComboBox_activated (row); + ui->pbBandHopping->setChecked(true); + startIndex = nextStartIndex; + return; + } else { + nextStartIndex++; + } + Q_FALLTHROUGH(); + case 4: + if (ui->cb30m->isChecked()) { + on_actionFT8_triggered(); + auto const& row = m_config.frequencies ()->best_working_frequency (10136000); + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0) on_bandComboBox_activated (row); + ui->pbBandHopping->setChecked(true); + startIndex = nextStartIndex; + return; + } else { + nextStartIndex++; + } + Q_FALLTHROUGH(); + case 5: + if (ui->cb20m->isChecked()) { + on_actionFT8_triggered(); + auto const& row = m_config.frequencies ()->best_working_frequency (14074000); + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0) on_bandComboBox_activated (row); + ui->pbBandHopping->setChecked(true); + startIndex = nextStartIndex; + return; + } else { + nextStartIndex++; + } + Q_FALLTHROUGH(); + case 6: + if (ui->cb17m->isChecked()) { + on_actionFT8_triggered(); + auto const& row = m_config.frequencies ()->best_working_frequency (18100000); + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0) on_bandComboBox_activated (row); + ui->pbBandHopping->setChecked(true); + startIndex = nextStartIndex; + return; + } else { + nextStartIndex++; + } + Q_FALLTHROUGH(); + case 7: + if (ui->cb15m->isChecked()) { + on_actionFT8_triggered(); + auto const& row = m_config.frequencies ()->best_working_frequency (21074000); + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0) on_bandComboBox_activated (row); + ui->pbBandHopping->setChecked(true); + startIndex = nextStartIndex; + return; + } else { + nextStartIndex++; + } + Q_FALLTHROUGH(); + case 8: + if (ui->cb12m->isChecked()) { + on_actionFT8_triggered(); + auto const& row = m_config.frequencies ()->best_working_frequency (24915000); + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0) on_bandComboBox_activated (row); + ui->pbBandHopping->setChecked(true); + startIndex = nextStartIndex; + return; + } else { + nextStartIndex++; + } + Q_FALLTHROUGH(); + case 9: + if (ui->cb10m->isChecked()) { + on_actionFT8_triggered(); + auto const& row = m_config.frequencies ()->best_working_frequency (28074000); + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0) on_bandComboBox_activated (row); + ui->pbBandHopping->setChecked(true); + startIndex = nextStartIndex; + return; + } else { + nextStartIndex++; + } + Q_FALLTHROUGH(); + case 10: + if (ui->cb6m->isChecked()) { + on_actionFT8_triggered(); + auto const& row = m_config.frequencies ()->best_working_frequency (50313000); + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0) on_bandComboBox_activated (row); + ui->pbBandHopping->setChecked(true); + startIndex = nextStartIndex; + return; + } else { + nextStartIndex++; + } + Q_FALLTHROUGH(); + case 11: + if (ui->cb4m->isChecked()) { + on_actionFT8_triggered(); + auto const& row = m_config.frequencies ()->best_working_frequency (70154000); + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0) on_bandComboBox_activated (row); + ui->pbBandHopping->setChecked(true); + startIndex = nextStartIndex; + return; + } else { + nextStartIndex++; + } + Q_FALLTHROUGH(); + case 12: + if (ui->cb2m->isChecked()) { + on_actionFT8_triggered(); + auto const& row = m_config.frequencies ()->best_working_frequency (144174000); + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0) on_bandComboBox_activated (row); + ui->pbBandHopping->setChecked(true); + startIndex = nextStartIndex; + return; + } else { + nextStartIndex++; + } + Q_FALLTHROUGH(); + case 13: + if (ui->cb70cm->isChecked()) { + on_actionFT8_triggered(); + auto const& row = m_config.frequencies ()->best_working_frequency (432174000); + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0) on_bandComboBox_activated (row); + ui->pbBandHopping->setChecked(true); + startIndex = nextStartIndex; + return; + } else { + nextStartIndex++; + } + Q_FALLTHROUGH(); + case 14: + if (ui->cb80mFT4->isChecked()) { + on_actionFT4_triggered(); + auto const& row = m_config.frequencies ()->best_working_frequency (3575000); + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0) on_bandComboBox_activated (row); + ui->pbBandHopping->setChecked(true); + startIndex = nextStartIndex; + return; + } else { + nextStartIndex++; + } + Q_FALLTHROUGH(); + case 15: + if (ui->cb40mFT4->isChecked()) { + on_actionFT4_triggered(); + auto const& row = m_config.frequencies ()->best_working_frequency (7047500); + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0) on_bandComboBox_activated (row); + ui->pbBandHopping->setChecked(true); + startIndex = nextStartIndex; + return; + } else { + nextStartIndex++; + } + Q_FALLTHROUGH(); + case 16: + if (ui->cb30mFT4->isChecked()) { + on_actionFT4_triggered(); + auto const& row = m_config.frequencies ()->best_working_frequency (10140000); + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0) on_bandComboBox_activated (row); + ui->pbBandHopping->setChecked(true); + startIndex = nextStartIndex; + return; + } else { + nextStartIndex++; + } + Q_FALLTHROUGH(); + case 17: + if (ui->cb20mFT4->isChecked()) { + on_actionFT4_triggered(); + auto const& row = m_config.frequencies ()->best_working_frequency (14080000); + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0) on_bandComboBox_activated (row); + ui->pbBandHopping->setChecked(true); + startIndex = nextStartIndex; + return; + } else { + nextStartIndex++; + } + Q_FALLTHROUGH(); + case 18: + if (ui->cb17mFT4->isChecked()) { + on_actionFT4_triggered(); + auto const& row = m_config.frequencies ()->best_working_frequency (18104000); + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0) on_bandComboBox_activated (row); + ui->pbBandHopping->setChecked(true); + startIndex = nextStartIndex; + return; + } else { + nextStartIndex++; + } + Q_FALLTHROUGH(); + + case 19: + if (ui->cb15mFT4->isChecked()) { + on_actionFT4_triggered(); + auto const& row = m_config.frequencies ()->best_working_frequency (21140000); + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0) on_bandComboBox_activated (row); + ui->pbBandHopping->setChecked(true); + startIndex = nextStartIndex; + return; + } else { + nextStartIndex++; + } + Q_FALLTHROUGH(); + case 20: + if (ui->cb12mFT4->isChecked()) { + on_actionFT4_triggered(); + auto const& row = m_config.frequencies ()->best_working_frequency (24919000); + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0) on_bandComboBox_activated (row); + ui->pbBandHopping->setChecked(true); + startIndex = nextStartIndex; + return; + } else { + nextStartIndex++; + } + Q_FALLTHROUGH(); + case 21: + if (ui->cb10mFT4->isChecked()) { + on_actionFT4_triggered(); + auto const& row = m_config.frequencies ()->best_working_frequency (28180000); + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0) on_bandComboBox_activated (row); + ui->pbBandHopping->setChecked(true); + startIndex = nextStartIndex; + return; + } else { + nextStartIndex++; + } + Q_FALLTHROUGH(); + case 22: + if (ui->cb2mMSK->isChecked()) { + on_actionMSK144_triggered(); + auto const& row = m_config.frequencies ()->best_working_frequency (144360000); + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0) on_bandComboBox_activated (row); + ui->pbBandHopping->setChecked(true); + startIndex = nextStartIndex; + return; + } else { + nextStartIndex++; + } + Q_FALLTHROUGH(); + case 23: + if (ui->cbQRG1->isChecked()) { + int f1 = ui->sbQRG1->value()*1000; + keep_frequency = true; + QTimer::singleShot (250, [=] {keep_frequency = false;}); + setRig (f1); + on_actionFT8_triggered(); + ui->pbBandHopping->setChecked(true); + startIndex = nextStartIndex; + return; + } else { + nextStartIndex++; + } + Q_FALLTHROUGH(); + case 24: + if (ui->cbQRG2->isChecked()) { + int f2 = ui->sbQRG2->value()*1000; + keep_frequency = true; + QTimer::singleShot (250, [=] {keep_frequency = false;}); + setRig (f2); + on_actionFT8_triggered(); + ui->pbBandHopping->setChecked(true); + startIndex = nextStartIndex; + return; + } else { + nextStartIndex++; + } + Q_FALLTHROUGH(); + case 25: + if (ui->cbQRG3->isChecked()) { + int f3 = ui->sbQRG3->value()*1000; + keep_frequency = true; + QTimer::singleShot (250, [=] {keep_frequency = false;}); + setRig (f3); + on_actionFT8_triggered(); + ui->pbBandHopping->setChecked(true); + startIndex = nextStartIndex; + return; + } else { + nextStartIndex++; + } + Q_FALLTHROUGH(); + case 26: + if (ui->cbQRG4->isChecked()) { + int f4 = ui->sbQRG4->value()*1000; + keep_frequency = true; + QTimer::singleShot (250, [=] {keep_frequency = false;}); + setRig (f4); + on_actionFT8_triggered(); + ui->pbBandHopping->setChecked(true); + startIndex = nextStartIndex; + return; + } else { + nextStartIndex++; + } + Q_FALLTHROUGH(); + case 27: + if (ui->cbQRG5->isChecked()) { + int f5 = ui->sbQRG5->value()*1000; + keep_frequency = true; + QTimer::singleShot (250, [=] {keep_frequency = false;}); + setRig (f5); + on_actionFT8_triggered(); + ui->pbBandHopping->setChecked(true); + startIndex = nextStartIndex; + return; + } else { + nextStartIndex++; + } + Q_FALLTHROUGH(); + case 28: + if (ui->cbQRG6->isChecked()) { + int f6 = ui->sbQRG6->value()*1000; + keep_frequency = true; + QTimer::singleShot (250, [=] {keep_frequency = false;}); + setRig (f6); + on_actionFT8_triggered(); + ui->pbBandHopping->setChecked(true); + startIndex = nextStartIndex; + return; + } else { + nextStartIndex++; + } + Q_FALLTHROUGH(); + case 29: + if (ui->cbQRG7->isChecked()) { + int f7 = ui->sbQRG7->value()*1000; + keep_frequency = true; + QTimer::singleShot (250, [=] {keep_frequency = false;}); + setRig (f7); + on_actionFT8_triggered(); + ui->pbBandHopping->setChecked(true); + startIndex = nextStartIndex; + return; + } else { + nextStartIndex++; + } + Q_FALLTHROUGH(); + case 30: + if (ui->cbQRG8->isChecked()) { + int f8 = ui->sbQRG8->value()*1000; + keep_frequency = true; + QTimer::singleShot (250, [=] {keep_frequency = false;}); + setRig (f8); + on_actionFT8_triggered(); + ui->pbBandHopping->setChecked(true); + startIndex = 0; + return; + bandHopping(); + } else { + startIndex = 0; + bandHopping(); + } + } + } +} + +void MainWindow::on_actionDefault_event_logging_triggered() +{ +#if defined(Q_OS_WIN) + QFile::remove (QDir {QStandardPaths::writableLocation (QStandardPaths::DataLocation)}.absoluteFilePath ("wsjtx_log_config.ini")); +#else + QFile::remove (QDir {QStandardPaths::writableLocation (QStandardPaths::ConfigLocation)}.absoluteFilePath ("wsjtx_log_config.ini")); +#endif +} + +void MainWindow::on_actionDiagnostic_mode_triggered() +{ +#if defined(Q_OS_WIN) + static QFile f {QDir {QStandardPaths::writableLocation (QStandardPaths::DataLocation)}.absoluteFilePath ("wsjtx_log_config.ini")}; +#else + static QFile f {QDir {QStandardPaths::writableLocation (QStandardPaths::ConfigLocation)}.absoluteFilePath ("wsjtx_log_config.ini")}; +#endif + if(!f.open(QIODevice::WriteOnly | QIODevice::Text)) { + QMessageBox mb; + mb.setText("Cannot write wsjtx_log_config.ini file"); + mb.exec(); + return; + } + QString instance = ""; + QString path = QStandardPaths::writableLocation (QStandardPaths::DataLocation); + QStringList tw; + if (path.contains("/WSJT-X")) tw=path.split("/WSJT-X"); + if (tw.size () > 0 && tw[1].remove(" - ") != "") instance = tw[1].remove(" - ") + "/"; + QString EventConfig = ( + "\[Sinks.SYSLOG]\n" + "Destination=TextFile\n" + "Asynchronous=true\n" + "AutoFlush=true\n" + "FileName=\"${DesktopLocation}/logs/" + instance + "wsjtx_syslog.log\"\n" + "Append=true\n" + "Format=\"[%Channel%][%TimeStamp(format=\\\"%Y-%m-%d %H:%M:%S.%f\\\")%][%Uptime(format=\\\"%O:%M:%S.%f\\\")%][%Severity%] %Message%\"\n" + "Filter=\"%Channel% matches \\\"SYSLOG\\\" | %Severity% >= info\"\n" + "\n" + "\[Sinks.RIGCTRL]\n" + "Destination=TextFile\n" + "Asynchronous=true\n" + "AutoFlush=true\n" + "FileName=\"${DesktopLocation}/logs/" + instance + "WSJT-X_RigControl.log\"\n" + "Append=true\n" + "Format=\"[%TimeStamp(format=\\\"%Y-%m-%d %H:%M:%S.%f\\\")%][%Uptime(format=\\\"%O:%M:%S.%f\\\")%][%Channel%:%Severity%] %Message%\"\n" + "Filter=\"%Channel% matches \\\"RIGCTRL\\\" | %Severity% >= info\"" + ); + QTextStream out(&f); + out << EventConfig; + f.close(); + MessageBox::critical_message (this, + " DIAGNOSTIC MODE\n" + "\n" + "You have switched to diagnostic mode. It allows you to collect data to\n" + "troubleshoot problems with WSJT-X, or its communication with your rig.\n" + "\n" + "The diagnostic mode is active after closing and restarting WSJT-X,\n" + "and is then automatically deactivated when the program is next closed.\n" + "In the diagnostic mode a new \"logs\" folder appears on your screen, and\n" + "in it two files are created: \"wsjtx_syslog.log\" and \"WSJT-X_RigControl.log\".\n" + "Open these files with a text editor and look for error messages,\n" + "or send these files to the development team for further analysis.\n" + "\n" + "In dagnostic mode, you should close the program as soon as the fault\n" + "has appeared, because the two log files grow to large sizes quickly.\n" + "\n" + "If you have accidentally switched to diagnostic mode, simply click\n" + "\"Default event logging\" again."); +} + +void MainWindow::on_actionDisable_event_logging_triggered() +{ +#if defined(Q_OS_WIN) + static QFile f {QDir {QStandardPaths::writableLocation (QStandardPaths::DataLocation)}.absoluteFilePath ("wsjtx_log_config.ini")}; +#else + static QFile f {QDir {QStandardPaths::writableLocation (QStandardPaths::ConfigLocation)}.absoluteFilePath ("wsjtx_log_config.ini")}; +#endif + if(!f.open(QIODevice::WriteOnly | QIODevice::Text)) { + QMessageBox mb; + mb.setText("Cannot write wsjtx_log_config.ini file"); + mb.exec(); + return; + } + QString EventConfig = ( + "\[Core]\n" + "DisableLogging=\"true\"" + ); + QTextStream out(&f); + out << EventConfig; + f.close(); + QFile::remove (QDir {QStandardPaths::writableLocation (QStandardPaths::DataLocation)}.absoluteFilePath ("wsjtx_syslog.log")); +} + +void MainWindow::on_actionUse_Dark_Style_triggered (bool checked) +{ + QFont font = m_config.text_font(); + if (checked) { + QFile f(":qdarkstyle/style.qss"); + if (!f.exists()) { + printf("Unable to set stylesheet, file not found\n"); + } else { + qApp->setFont (font); + QString ss; + f.open(QFile::ReadOnly | QFile::Text); + QTextStream ts(&f); + qApp->setStyleSheet(ts.readAll() + "* {" + font_as_stylesheet (font) + '}'); + m_useDarkStyle = true; + m_wideGraph->setDarkStyle(m_useDarkStyle); + check_button_color(); + ui->tabWidget->setTabShape(QTabWidget::Rounded); + } + } else { + m_useDarkStyle = false; + m_wideGraph->setDarkStyle(m_useDarkStyle); + check_button_color(); + ui->tabWidget->setTabShape(QTabWidget::Triangular); + qApp->setFont (font); + QString ss; + if (qApp->styleSheet ().size ()) { + auto sheet = qApp->styleSheet (); + sheet.remove ("file:///"); + QFile sf {sheet}; + if (sf.open (QFile::ReadOnly | QFile::Text)) ss = sf.readAll () + ss; + } + qApp->setStyleSheet (ss + "* {" + font_as_stylesheet (font) + '}'); + } + // ensure a balanced layout + qreal pointSize = m_config.text_font().pointSizeF(); +// if (pointSize < 9) ui->controls_stack_widget->setMaximumWidth(180); // UR for AL +// if (pointSize == 9) ui->controls_stack_widget->setMaximumWidth(200); // UR for AL +// if (pointSize == 10) ui->controls_stack_widget->setMaximumWidth(220); // UR for AL +// if (pointSize > 10) ui->controls_stack_widget->setMaximumWidth(240); // UR for AL + if (pointSize < 11) { +// ui->tabWidget->setMaximumHeight(210); // UR for AL +// ui->controls_stack_widget->setMaximumHeight(200); // UR for AL + if (ui->actionUse_Dark_Style->isChecked()) ui->tabWidget->setMaximumHeight(225); // UR for normal + widescreen + } else { +// ui->tabWidget->setMaximumHeight(255); // UR for AL +// ui->controls_stack_widget->setMaximumHeight(225); // UR for AL + ui->tabWidget->setMaximumHeight(500); // UR for normal + widescreen + } + for (auto& widget : qApp->topLevelWidgets ()) + { + widget->updateGeometry (); + } + statusChanged(); + guiUpdate(); +} + +void MainWindow:: on_actionBand_Buttons_triggered () +{ + if (ui->actionBand_Buttons->isChecked()) { + ui->actionVHF_UHF_Buttons->setVisible(true); + } else { + ui->actionVHF_UHF_Buttons->setVisible(false); + } +} + +void MainWindow:: on_actionVHF_UHF_Buttons_triggered () +{ + check_button_color(); +} + +void MainWindow::check_button_color() +{ + // Yellow background for the DX Call and Enable Tx buttons when the rig is allowed to Tx automatically + if((((m_mode=="FT8" or m_mode=="FT4" or m_mode=="Q65" or m_mode=="FST4" or m_mode=="MSK144" or m_mode=="JT65" or m_mode=="JT9" or m_mode=="JT4") && + m_specOp==SpecOp::NONE && ui->cbAutoSeq->isChecked() && ui->cbAutoSeq->isChecked() + && m_config.Wait_features_enabled()) or m_specOp==SpecOp::HOUND) && (m_hisCall!="" or (m_mode=="FT8" && m_specOp==SpecOp::HOUND))) { + if (ui->DX_Call_Button->isChecked()) { + ui->DX_Call_Button->setStyleSheet("QPushButton {background-color: #ff0000; color: #ffffff; border-style: outset; border-width: 1px; border-radius: 5px; border-color: black; min-width: 5em; padding: 3px;}"); + } else { + if (m_mode=="FT8" && m_specOp==SpecOp::HOUND && m_hisCall=="") { + if (m_useDarkStyle) { + ui->DX_Call_Button->setStyleSheet("QPushButton {background-color: #505F69; color: #ffffff; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}"); + } else { + ui->DX_Call_Button->setStyleSheet("QPushButton {background-color: #9fafd5; border: none;}"); + } + } else { + ui->DX_Call_Button->setStyleSheet("QPushButton {background-color: #ffff00; color: #000000; border: 1px solid #32414B; border-radius: 4px; padding: 3px; outline: none;}"); + } + } + if (!m_auto) { + if (m_mode=="FT8" && m_specOp==SpecOp::HOUND && m_hisCall=="") { + if (m_useDarkStyle) { + ui->autoButton->setStyleSheet("QPushButton {background-color: #505F69; color: #ffffff; border: 1px solid #32414B; color: #F0F0F0; border-radius: 5px; padding: 3px; outline: none; min-width: 5em;}"); + } else { + ui->autoButton->setStyleSheet(""); + ui->autoButton->setStyleSheet("QPushButton {min-width: 5em;}"); + } + } else { + ui->autoButton->setStyleSheet("QPushButton {background-color: #ffff00; color: #000000; border: 1px solid #32414B; border-radius: 4px; padding: 3px; outline: none; min-width: 5em;}"); + } + } + if (m_auto) ui->autoButton->setStyleSheet("QPushButton {background-color: #ff0000; color: #ffffff; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none; min-width: 5em;}"); + } else { + ui->DX_Call_Button->setChecked(false); + if (m_useDarkStyle) { + ui->DX_Call_Button->setStyleSheet("QPushButton {background-color: #505F69; color: #ffffff; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}"); + if (!m_auto) ui->autoButton->setStyleSheet("QPushButton {background-color: #505F69; color: #ffffff; border: 1px solid #32414B; color: #F0F0F0; border-radius: 5px; padding: 3px; outline: none; min-width: 5em;}"); + if (m_auto) ui->autoButton->setStyleSheet("QPushButton {background-color: #ff0000; color: #ffffff; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none; min-width: 5em;}"); + } else { + ui->DX_Call_Button->setStyleSheet("QPushButton {background-color: #9fafd5; border: none;}"); + if (!m_auto) { + ui->autoButton->setStyleSheet(""); + ui->autoButton->setStyleSheet("QPushButton {min-width: 5em;}"); + } + if (m_auto) ui->autoButton->setStyleSheet("QPushButton {background-color: #ff0000; color: #ffffff; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none; min-width: 5em;}"); + } + } + + ui->autoButton->setToolTip("Toggle Auto-Tx On/Off"); + if (m_config.Wait_features_enabled()) { + ui->DX_Call_Button->setToolTip("Toggle Wait & Call On/Off.\n" + "Right-click to clear the DX Call box."); + ui->autoButton->setToolTip("Toggle Auto-Tx On/Off.\n" + "Right-click to toggle Wait & Pounce On/Off."); + } else { + ui->DX_Call_Button->setToolTip("Right-click to clear the DX Call box"); + ui->autoButton->setToolTip("Toggle Auto-Tx On/Off"); + } + if (m_config.alternate_erase_button()) { + ui->EraseButton->setToolTip("Left-click to erase left window.\n" + "Right-click to erase right window."); + } else { + ui->EraseButton->setToolTip("Erase right window.\n" + "Double-click to erase both windows."); + } + if (pounce && !m_auto) { + ui->autoButton->setStyleSheet("QPushButton {background-color: #ff7a05; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none; min-width: 5em;}"); + ui->autoButton->setChecked(false); // ensure auoButton is unchecked + } + if (m_config.Territory1()=="") { + ui->actionHideTerritory1->setText("Hide stations from Territory 1"); + ui->actionHighlightTerritory1->setText("Highlight stations from Territory 1"); + } else { + ui->actionHideTerritory1->setText("Hide stations from " + m_config.Territory1()); + ui->actionHighlightTerritory1->setText("Highlight stations from " + m_config.Territory1()); + } + if (m_config.Territory2()=="") { + ui->actionHideTerritory2->setText("Hide stations from Territory 2"); + ui->actionHighlightTerritory2->setText("Highlight stations from Territory 2"); + } else { + ui->actionHideTerritory2->setText("Hide stations from " + m_config.Territory2()); + ui->actionHighlightTerritory2->setText("Highlight stations from " + m_config.Territory2()); + } + if (m_config.Territory3()=="") { + ui->actionHideTerritory3->setText("Hide stations from Territory 3"); + ui->actionHighlightTerritory3->setText("Highlight stations from Territory 3"); + } else { + ui->actionHideTerritory3->setText("Hide stations from " + m_config.Territory3()); + ui->actionHighlightTerritory3->setText("Highlight stations from " + m_config.Territory3()); + } + if (m_config.Territory4()=="") { + ui->actionHideTerritory4->setText("Hide stations from Territory 4"); + ui->actionHighlightTerritory4->setText("Highlight stations from Territory 4"); + } else { + ui->actionHideTerritory4->setText("Hide stations from " + m_config.Territory4()); + ui->actionHighlightTerritory4->setText("Highlight stations from " + m_config.Territory4()); + } + + if (m_config.twoDays()) { + ui->actionHideToday->setText("Hide stations worked today or yesterday"); + ui->actionIgnoreToday->setText("Ignore stations worked today or yesterday"); + ui->actionHighlightToday->setText("Highlight callsigns worked today or yesterday"); + } else { + ui->actionHideToday->setText("Hide stations worked today"); + ui->actionIgnoreToday->setText("Ignore stations worked today"); + ui->actionHighlightToday->setText("Highlight callsigns worked today"); + } + + if (!m_config.button_coloring_disabled()) { + if (m_mode=="Q65" && m_config.enable_VHF_features() && m_TRperiod==15 && m_nSubMode==0) { + ui->pb15A->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}"); + } else { + if (m_useDarkStyle) { + ui->pb15A->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}"); + } else { + ui->pb15A->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}"); + } + } + if (m_mode=="Q65" && m_config.enable_VHF_features() && m_TRperiod==15 && m_nSubMode==2) { + ui->pb15C->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}"); + } else { + if (m_useDarkStyle) { + ui->pb15C->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}"); + } else { + ui->pb15C->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}"); + } + } + if (m_mode=="Q65" && m_config.enable_VHF_features() && m_TRperiod==30 && m_nSubMode==1) { + ui->pb30B->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}"); + } else { + if (m_useDarkStyle) { + ui->pb30B->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}"); + } else { + ui->pb30B->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}"); + } + } + if (m_mode=="Q65" && m_config.enable_VHF_features() && m_TRperiod==60 && m_nSubMode==2) { + ui->pb60C->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}"); + } else { + if (m_useDarkStyle) { + ui->pb60C->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}"); + } else { + ui->pb60C->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}"); + } + } + if (m_mode=="Q65" && m_config.enable_VHF_features() && m_TRperiod==60 && m_nSubMode==3) { + ui->pb60D->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}"); + } else { + if (m_useDarkStyle) { + ui->pb60D->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}"); + } else { + ui->pb60D->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}"); + } + } + if (m_mode=="Q65" && m_config.enable_VHF_features() && m_TRperiod==60 && m_nSubMode==4) { + ui->pb60E->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}"); + } else { + if (m_useDarkStyle) { + ui->pb60E->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}"); + } else { + ui->pb60E->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}"); + } + } + if (ui->houndButton->isChecked() && !m_config.button_coloring_disabled()) { + ui->houndButton->setStyleSheet("QPushButton {background-color: #ff0000; color: #ffffff; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none; min-width: 3em;}"); + } else { + if (SpecOp::FOX==m_specOp && !m_config.button_coloring_disabled()) { + ui->houndButton->setStyleSheet("QPushButton {background-color: #ffff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none; min-width: 3em;}"); + } else { + if (m_useDarkStyle) { + ui->houndButton->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none; min-width: 3em;}"); + } else { + ui->houndButton->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none; min-width: 3em;}"); + } + } + } + if (m_mode=="FT8") { + ui->ft8Button->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none; min-width: 3em;}"); + } else { + if (m_useDarkStyle) { + ui->ft8Button->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none; min-width: 3em;}"); + } else { + ui->ft8Button->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none; min-width: 3em;}"); + } + } + if (m_mode=="FT4") { + ui->ft4Button->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none; min-width: 3em;}"); + } else { + if (m_useDarkStyle) { + ui->ft4Button->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none; min-width: 3em;}"); + } else { + ui->ft4Button->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none; min-width: 3em;}"); + } + } + if (m_mode=="MSK144") { + ui->msk144Button->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none; min-width: 3em;}"); + } else { + if (m_useDarkStyle) { + ui->msk144Button->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none; min-width: 3em;}"); + } else { + ui->msk144Button->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none; min-width: 3em;}"); + } + } + if (m_mode=="Q65") { + ui->q65Button->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none; min-width: 3em;}"); + } else { + if (m_useDarkStyle) { + ui->q65Button->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none; min-width: 3em;}"); + } else { + ui->q65Button->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none; min-width: 3em;}"); + } + } + if (m_mode=="JT65") { + ui->jt65Button->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none; min-width: 3em;}"); + } else { + if (m_useDarkStyle) { + ui->jt65Button->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none; min-width: 3em;}"); + } else { + ui->jt65Button->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none; min-width: 3em;}"); + } + } + if (m_mode=="Echo" && ui->echoButton->isVisible()) { + ui->echoButton->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none; min-width: 3em;}"); + } else { + if (m_useDarkStyle) { + ui->echoButton->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none; min-width: 3em;}"); + } else { + ui->echoButton->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none; min-width: 3em;}"); + } + } + } + if (m_config.enable_VHF_features() && m_config.decode_at_52s()) { + ui->echoButton->setVisible (true); + } else { + ui->echoButton->setVisible (false); + } + if (m_mode=="JT65" && m_config.enable_VHF_features() && ui->cbShMsgs->isChecked()) { + ui->tx3->setStyleSheet("color: #000000; background-color: #66ffff"); + ui->tx4->setStyleSheet("color: #000000; background-color: #66ffff"); + if (!keepTx5) ui->tx5->setStyleSheet("color: #000000; background-color: #66ffff"); + } else { + ui->tx3->setStyleSheet(""); + ui->tx4->setStyleSheet(""); + if (!keepTx5) ui->tx5->setStyleSheet(""); + } + if (ui->actionBand_Buttons->isChecked()) { + QString band=m_config.bands()->find(m_freqNominal); + if (ui->actionVHF_UHF_Buttons->isChecked()) { + ui->pb160->setVisible(false); + ui->pb80->setVisible(false); + ui->pb60->setVisible(false); + ui->pb40->setVisible(false); + ui->pb30->setVisible(false); + ui->pb20->setVisible(false); + ui->pb17->setVisible(false); + ui->pb15->setVisible(false); + ui->pb12->setVisible(false); + ui->pb10->setVisible(false); + ui->pb8->setVisible(true); + ui->pb6->setVisible(false); + ui->pb2->setVisible(false); + ui->pb70->setVisible(false); + ui->pb50->setVisible(true); + ui->pb4->setVisible(true); + ui->pb144->setVisible(true); + ui->pb220->setVisible(true); + ui->pb432->setVisible(true); + ui->pb902->setVisible(true); + ui->pb23->setVisible(true); + ui->pb13->setVisible(true); + ui->pb9->setVisible(true); + ui->pb5G->setVisible(true); + ui->pb10G->setVisible(true); + ui->pb24G->setVisible(true); + if (band=="8m") { + ui->pb8->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}"); + } else { + if (m_useDarkStyle) { + ui->pb8->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}"); + } else { + ui->pb8->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}"); + } + } + if (band=="6m") { + ui->pb50->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}"); + } else { + if (m_useDarkStyle) { + ui->pb50->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}"); + } else { + ui->pb50->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}"); + } + } + if (band=="4m") { + ui->pb4->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}"); + } else { + if (m_useDarkStyle) { + ui->pb4->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}"); + } else { + ui->pb4->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}"); + } + } + if (band=="2m") { + ui->pb144->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}"); + } else { + if (m_useDarkStyle) { + ui->pb144->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}"); + } else { + ui->pb144->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}"); + } + } + if (band=="1.25m") { + ui->pb220->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}"); + } else { + if (m_useDarkStyle) { + ui->pb220->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}"); + } else { + ui->pb220->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}"); + } + } + if (band=="70cm") { + ui->pb432->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}"); + } else { + if (m_useDarkStyle) { + ui->pb432->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}"); + } else { + ui->pb432->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}"); + } + } + if (band=="33cm") { + ui->pb902->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}"); + } else { + if (m_useDarkStyle) { + ui->pb902->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}"); + } else { + ui->pb902->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}"); + } + } + if (band=="23cm") { + ui->pb23->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}"); + } else { + if (m_useDarkStyle) { + ui->pb23->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}"); + } else { + ui->pb23->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}"); + } + } + if (band=="13cm") { + ui->pb13->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}"); + } else { + if (m_useDarkStyle) { + ui->pb13->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}"); + } else { + ui->pb13->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}"); + } + } + if (band=="9cm") { + ui->pb9->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}"); + } else { + if (m_useDarkStyle) { + ui->pb9->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}"); + } else { + ui->pb9->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}"); + } + } + if (band=="6cm") { + ui->pb5G->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}"); + } else { + if (m_useDarkStyle) { + ui->pb5G->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}"); + } else { + ui->pb5G->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}"); + } + } + if (band=="3cm") { + ui->pb10G->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}"); + } else { + if (m_useDarkStyle) { + ui->pb10G->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}"); + } else { + ui->pb10G->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}"); + } + } + if (band=="1.25cm") { + ui->pb24G->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}"); + } else { + if (m_useDarkStyle) { + ui->pb24G->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}"); + } else { + ui->pb24G->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}"); + } + } + } else { + ui->pb160->setVisible(true); + ui->pb80->setVisible(true); + ui->pb60->setVisible(true); + ui->pb40->setVisible(true); + ui->pb30->setVisible(true); + ui->pb20->setVisible(true); + ui->pb17->setVisible(true); + ui->pb15->setVisible(true); + ui->pb12->setVisible(true); + ui->pb10->setVisible(true); + ui->pb8->setVisible(false); + ui->pb6->setVisible(true); + ui->pb2->setVisible(true); + ui->pb70->setVisible(true); + ui->pb50->setVisible(false); + ui->pb4->setVisible(false); + ui->pb144->setVisible(false); + ui->pb220->setVisible(false); + ui->pb432->setVisible(false); + ui->pb902->setVisible(false); + ui->pb23->setVisible(false); + ui->pb13->setVisible(false); + ui->pb9->setVisible(false); + ui->pb5G->setVisible(false); + ui->pb10G->setVisible(false); + ui->pb24G->setVisible(false); + if (band=="160m") { + ui->pb160->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}"); + } else { + if (m_useDarkStyle) { + ui->pb160->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}"); + } else { + ui->pb160->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}"); + } + } + if (band=="80m") { + ui->pb80->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}"); + } else { + if (m_useDarkStyle) { + ui->pb80->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}"); + } else { + ui->pb80->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}"); + } + } + if (band=="60m") { + ui->pb60->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}"); + } else { + if (m_useDarkStyle) { + ui->pb60->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}"); + } else { + ui->pb60->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}"); + } + } + if (band=="40m") { + ui->pb40->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}"); + } else { + if (m_useDarkStyle) { + ui->pb40->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}"); + } else { + ui->pb40->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}"); + } + } + if (band=="30m") { + ui->pb30->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}"); + } else { + if (m_useDarkStyle) { + ui->pb30->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}"); + } else { + ui->pb30->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}"); + } + } + if (band=="20m") { + ui->pb20->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}"); + } else { + if (m_useDarkStyle) { + ui->pb20->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}"); + } else { + ui->pb20->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}"); + } + } + if (band=="17m") { + ui->pb17->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}"); + } else { + if (m_useDarkStyle) { + ui->pb17->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}"); + } else { + ui->pb17->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}"); + } + } + if (band=="15m") { + ui->pb15->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}"); + } else { + if (m_useDarkStyle) { + ui->pb15->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}"); + } else { + ui->pb15->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}"); + } + } + if (band=="12m") { + ui->pb12->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}"); + } else { + if (m_useDarkStyle) { + ui->pb12->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}"); + } else { + ui->pb12->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}"); + } + } + if (band=="10m") { + ui->pb10->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}"); + } else { + if (m_useDarkStyle) { + ui->pb10->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}"); + } else { + ui->pb10->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}"); + } + } + if (band=="6m") { + ui->pb6->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}"); + } else { + if (m_useDarkStyle) { + ui->pb6->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}"); + } else { + ui->pb6->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}"); + } + } + if (band=="4m" or band=="1.25m" ) { + ui->pb2->setStyleSheet("QPushButton {background-color: #ffff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}"); + } else { + if (band=="2m") { + ui->pb2->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}"); + } else { + if (m_useDarkStyle) { + ui->pb2->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}"); + } else { + ui->pb2->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}"); + } + } + } + if (band=="23cm") { + ui->pb70->setStyleSheet("QPushButton {background-color: #ffff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}"); + } else { + if (band=="70cm") { + ui->pb70->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border: 1px solid #32414B; border-radius: 5px; padding: 3px; outline: none;}"); + } else { + if (m_useDarkStyle) { + ui->pb70->setStyleSheet("QPushButton {background-color: #505F69; border: 1px solid #32414B; color: #F0F0F0; border-radius: 4px; padding: 3px; outline: none;}"); + } else { + ui->pb70->setStyleSheet("QPushButton {background-color: #e1e1e1; border: 1px solid #adadad; border-radius: 0px; padding: 3px; outline: none;}"); + } + } + } + } + } else { + ui->pb160->setVisible(false); + ui->pb80->setVisible(false); + ui->pb60->setVisible(false); + ui->pb40->setVisible(false); + ui->pb30->setVisible(false); + ui->pb20->setVisible(false); + ui->pb17->setVisible(false); + ui->pb15->setVisible(false); + ui->pb12->setVisible(false); + ui->pb10->setVisible(false); + ui->pb8->setVisible(false); + ui->pb6->setVisible(false); + ui->pb2->setVisible(false); + ui->pb70->setVisible(false); + ui->pb50->setVisible(false); + ui->pb4->setVisible(false); + ui->pb144->setVisible(false); + ui->pb220->setVisible(false); + ui->pb432->setVisible(false); + ui->pb902->setVisible(false); + ui->pb23->setVisible(false); + ui->pb13->setVisible(false); + ui->pb9->setVisible(false); + ui->pb5G->setVisible(false); + ui->pb10G->setVisible(false); + ui->pb24G->setVisible(false); + } + if (ui->monitorButton->isChecked()) { + if (m_saveAll or m_saveDecoded) { + ui->monitorButton->setStyleSheet("QPushButton {background-color: #ffff00; color: #000000; border-style: outset; border-width: 1px; border-radius: 5px; border-color: black; min-width: 5em; padding: 3px;}"); + } else { + ui->monitorButton->setStyleSheet("QPushButton {background-color: #00ff00; color: #000000; border-style: outset; border-width: 1px; border-radius: 5px; border-color: black; min-width: 5em; padding: 3px;}"); + } + } else { + ui->monitorButton->setStyleSheet(""); + } + if (ui->pbBandHopping->isChecked()) { + keep_last_tx_label = false; + ui->pbBandHopping->setStyleSheet("QPushButton {background-color: #ff0000; color: #ffffff; border-style: outset; border-width: 1px; border-radius: 5px; border-color: black; min-width: 5em; padding: 3px;}"); + last_tx_label.setText(" Band Hopping On "); + last_tx_label.setStyleSheet ("QLabel{color: #ffffff; background-color: #ff0000}"); + ui->genStdMsgsPushButton->setStyleSheet("QPushButton {background-color: #ffff00; color: #000000; border-style: outset; border-width: 1px; border-radius: 5px; border-color: black; min-width: 5em; padding: 3px;}"); + } else { + ui->pbBandHopping->setStyleSheet (""); + if (!keep_last_tx_label) last_tx_label.setText (""); + last_tx_label.setStyleSheet (""); + ui->genStdMsgsPushButton->setStyleSheet (""); + } +} + +void MainWindow::on_pb160_clicked() +{ + if (m_mode=="MSK144") { + ui->sbTR->setValue (m_msk144_tr); + programStart = true; + QTimer::singleShot (250, [=] {programStart = false;}); + } + auto const& row = m_config.frequencies ()->best_working_frequency (1840000); + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0) { + on_bandComboBox_activated (row); + } else { + keep_frequency = true; + setRig(1837000); + QTimer::singleShot (250, [=] {keep_frequency = false;}); + } + setXIT (ui->TxFreqSpinBox->value ()); +} + +void MainWindow::on_pb80_clicked() +{ + if (m_mode=="MSK144") { + ui->sbTR->setValue (m_msk144_tr); + programStart = true; + QTimer::singleShot (250, [=] {programStart = false;}); + } + auto const& row = m_config.frequencies ()->best_working_frequency (3573000); + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0) { + on_bandComboBox_activated (row); + } else { + keep_frequency = true; + setRig(3576000); + QTimer::singleShot (250, [=] {keep_frequency = false;}); + } + setXIT (ui->TxFreqSpinBox->value ()); +} + +void MainWindow::on_pb60_clicked() +{ + if (m_mode=="MSK144") { + ui->sbTR->setValue (m_msk144_tr); + programStart = true; + QTimer::singleShot (250, [=] {programStart = false;}); + } + auto const& row = m_config.frequencies ()->best_working_frequency (5357000); + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0) { + on_bandComboBox_activated (row); + } else { + keep_frequency = true; + setRig(5357000); + QTimer::singleShot (250, [=] {keep_frequency = false;}); + } + setXIT (ui->TxFreqSpinBox->value ()); +} + +void MainWindow::on_pb40_clicked() +{ + if (m_mode=="MSK144") { + ui->sbTR->setValue (m_msk144_tr); + programStart = true; + QTimer::singleShot (250, [=] {programStart = false;}); + } + auto const& row = m_config.frequencies ()->best_working_frequency (7074000); + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0) { + on_bandComboBox_activated (row); + } else { + keep_frequency = true; + setRig(7077000); + QTimer::singleShot (250, [=] {keep_frequency = false;}); + } + setXIT (ui->TxFreqSpinBox->value ()); +} + +void MainWindow::on_pb30_clicked() +{ + if (m_mode=="MSK144") { + ui->sbTR->setValue (m_msk144_tr); + programStart = true; + QTimer::singleShot (250, [=] {programStart = false;}); + } + auto const& row = m_config.frequencies ()->best_working_frequency (10136000); + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0) { + on_bandComboBox_activated (row); + } else { + keep_frequency = true; + setRig(10139000); + QTimer::singleShot (250, [=] {keep_frequency = false;}); + } + setXIT (ui->TxFreqSpinBox->value ()); +} + +void MainWindow::on_pb20_clicked() +{ + if (m_mode=="MSK144") { + ui->sbTR->setValue (m_msk144_tr); + programStart = true; + QTimer::singleShot (250, [=] {programStart = false;}); + } + auto const& row = m_config.frequencies ()->best_working_frequency (14074000); + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0) { + on_bandComboBox_activated (row); + } else { + keep_frequency = true; + setRig(14077000); + QTimer::singleShot (250, [=] {keep_frequency = false;}); + } + setXIT (ui->TxFreqSpinBox->value ()); +} + +void MainWindow::on_pb17_clicked() +{ + if (m_mode=="MSK144") { + ui->sbTR->setValue (m_msk144_tr); + programStart = true; + QTimer::singleShot (250, [=] {programStart = false;}); + } + auto const& row = m_config.frequencies ()->best_working_frequency (18100000); + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0) { + on_bandComboBox_activated (row); + } else { + keep_frequency = true; + setRig(18103000); + QTimer::singleShot (250, [=] {keep_frequency = false;}); + } + setXIT (ui->TxFreqSpinBox->value ()); +} + +void MainWindow::on_pb15_clicked() +{ + if (m_mode=="MSK144") { + ui->sbTR->setValue (m_msk144_tr); + programStart = true; + QTimer::singleShot (250, [=] {programStart = false;}); + } + auto const& row = m_config.frequencies ()->best_working_frequency (21074000); + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0) { + on_bandComboBox_activated (row); + } else { + keep_frequency = true; + setRig(21077000); + QTimer::singleShot (250, [=] {keep_frequency = false;}); + } + setXIT (ui->TxFreqSpinBox->value ()); +} + +void MainWindow::on_pb12_clicked() +{ + if (m_mode=="MSK144") { + ui->sbTR->setValue (m_msk144_tr); + programStart = true; + QTimer::singleShot (250, [=] {programStart = false;}); + } + auto const& row = m_config.frequencies ()->best_working_frequency (24915000); + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0) { + on_bandComboBox_activated (row); + } else { + keep_frequency = true; + setRig(24918000); + QTimer::singleShot (250, [=] {keep_frequency = false;}); + } + setXIT (ui->TxFreqSpinBox->value ()); +} + +void MainWindow::on_pb10_clicked() +{ + if (m_mode=="MSK144") { + ui->sbTR->setValue (m_msk144_tr); + programStart = true; + QTimer::singleShot (250, [=] {programStart = false;}); + } + auto const& row = m_config.frequencies ()->best_working_frequency (28074000); + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0) { + on_bandComboBox_activated (row); + } else { + keep_frequency = true; + setRig(28077000); + QTimer::singleShot (250, [=] {keep_frequency = false;}); + } + setXIT (ui->TxFreqSpinBox->value ()); +} + +void MainWindow::on_pb6_clicked() +{ + if (m_mode=="MSK144") { + ui->sbTR->setValue (m_msk144_tr6); + programStart = true; + QTimer::singleShot (250, [=] {programStart = false;}); + } + auto const& row = m_config.frequencies ()->best_working_frequency (50313000); + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0) { + on_bandComboBox_activated (row); + } else { + keep_frequency = true; + setRig(50316000); + QTimer::singleShot (250, [=] {keep_frequency = false;}); + } + setXIT (ui->TxFreqSpinBox->value ()); +} + +void MainWindow::on_pb2_clicked() +{ + if (m_mode=="MSK144") { + ui->sbTR->setValue (m_msk144_tr2); + programStart = true; + QTimer::singleShot (250, [=] {programStart = false;}); + } + auto const& row = m_config.frequencies ()->best_working_frequency (144074000); + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0) { + on_bandComboBox_activated (row); + } else { + keep_frequency = true; + setRig(144077000); + QTimer::singleShot (250, [=] {keep_frequency = false;}); + } + setXIT (ui->TxFreqSpinBox->value ()); +} + +void MainWindow::on_pb70_clicked() +{ + if (m_mode=="MSK144") { + ui->sbTR->setValue (m_msk144_tr); + programStart = true; + QTimer::singleShot (250, [=] {programStart = false;}); + } + auto const& row = m_config.frequencies ()->best_working_frequency (432074000); + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0) { + on_bandComboBox_activated (row); + } else { + keep_frequency = true; + setRig(432077000); + QTimer::singleShot (250, [=] {keep_frequency = false;}); + } + setXIT (ui->TxFreqSpinBox->value ()); +} + +void MainWindow::on_pb8_clicked() +{ + if (m_mode=="MSK144") { + ui->sbTR->setValue (m_msk144_tr); + programStart = true; + QTimer::singleShot (250, [=] {programStart = false;}); + } + auto const& row = m_config.frequencies ()->best_working_frequency (40680000); + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0) { + on_bandComboBox_activated (row); + } else { + keep_frequency = true; + setRig(40680000); + QTimer::singleShot (250, [=] {keep_frequency = false;}); + } + setXIT (ui->TxFreqSpinBox->value ()); +} + +void MainWindow::on_pb50_clicked() +{ + if (m_mode=="MSK144") { + ui->sbTR->setValue (m_msk144_tr6); + programStart = true; + QTimer::singleShot (250, [=] {programStart = false;}); + } + auto const& row = m_config.frequencies ()->best_working_frequency (50313000); + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0) { + on_bandComboBox_activated (row); + } else { + keep_frequency = true; + setRig(50316000); + QTimer::singleShot (250, [=] {keep_frequency = false;}); + } + setXIT (ui->TxFreqSpinBox->value ()); +} + +void MainWindow::on_pb4_clicked() +{ + if (m_mode=="MSK144") { + ui->sbTR->setValue (m_msk144_tr6); + programStart = true; + QTimer::singleShot (250, [=] {programStart = false;}); + } + auto const& row = m_config.frequencies ()->best_working_frequency (70154000); + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0) { + on_bandComboBox_activated (row); + } else { + keep_frequency = true; + setRig(70154000); + QTimer::singleShot (250, [=] {keep_frequency = false;}); + } + setXIT (ui->TxFreqSpinBox->value ()); +} + +void MainWindow::on_pb144_clicked() +{ + if (m_mode=="MSK144") { + ui->sbTR->setValue (m_msk144_tr2); + programStart = true; + QTimer::singleShot (250, [=] {programStart = false;}); + } + auto const& row = m_config.frequencies ()->best_working_frequency (144074000); + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0) { + on_bandComboBox_activated (row); + } else { + keep_frequency = true; + setRig(144077000); + QTimer::singleShot (250, [=] {keep_frequency = false;}); + } + setXIT (ui->TxFreqSpinBox->value ()); +} + +void MainWindow::on_pb220_clicked() +{ + if (m_mode=="MSK144") { + ui->sbTR->setValue (m_msk144_tr); + programStart = true; + QTimer::singleShot (250, [=] {programStart = false;}); + } + auto const& row = m_config.frequencies ()->best_working_frequency (222174000); + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0) { + on_bandComboBox_activated (row); + } else { + keep_frequency = true; + setRig(222177000); + QTimer::singleShot (250, [=] {keep_frequency = false;}); + } + setXIT (ui->TxFreqSpinBox->value ()); +} + +void MainWindow::on_pb432_clicked() +{ + if (m_mode=="MSK144") { + ui->sbTR->setValue (m_msk144_tr); + programStart = true; + QTimer::singleShot (250, [=] {programStart = false;}); + } + auto const& row = m_config.frequencies ()->best_working_frequency (432174000); + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0) { + on_bandComboBox_activated (row); + } else { + keep_frequency = true; + setRig(432177000); + QTimer::singleShot (250, [=] {keep_frequency = false;}); + } + setXIT (ui->TxFreqSpinBox->value ()); +} + +void MainWindow::on_pb902_clicked() +{ + if (m_mode=="MSK144") { + ui->sbTR->setValue (m_msk144_tr); + programStart = true; + QTimer::singleShot (250, [=] {programStart = false;}); + } + auto const& row = m_config.frequencies ()->best_working_frequency (902174000); + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0) { + on_bandComboBox_activated (row); + } else { + keep_frequency = true; + setRig(902177000); + QTimer::singleShot (250, [=] {keep_frequency = false;}); + } + setXIT (ui->TxFreqSpinBox->value ()); +} + +void MainWindow::on_pb23_clicked() +{ + if (m_mode=="MSK144") { + ui->sbTR->setValue (m_msk144_tr); + programStart = true; + QTimer::singleShot (250, [=] {programStart = false;}); + } + auto const& row = m_config.frequencies ()->best_working_frequency (1296065000); + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0) { + on_bandComboBox_activated (row); + } else { + keep_frequency = true; + setRig(1296065000); + QTimer::singleShot (250, [=] {keep_frequency = false;}); + } + setXIT (ui->TxFreqSpinBox->value ()); +} + +void MainWindow::on_pb13_clicked() +{ + if (m_mode=="MSK144") { + ui->sbTR->setValue (m_msk144_tr); + programStart = true; + QTimer::singleShot (250, [=] {programStart = false;}); + } + auto const& row = m_config.frequencies ()->best_working_frequency (2304065000); + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0) { + on_bandComboBox_activated (row); + } else { + keep_frequency = true; + setRig(2304065000); + QTimer::singleShot (250, [=] {keep_frequency = false;}); + } + setXIT (ui->TxFreqSpinBox->value ()); +} + +void MainWindow::on_pb9_clicked() +{ + if (m_mode=="MSK144") { + ui->sbTR->setValue (m_msk144_tr); + programStart = true; + QTimer::singleShot (250, [=] {programStart = false;}); + } + auto const& row = m_config.frequencies ()->best_working_frequency (3400065000); + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0) { + on_bandComboBox_activated (row); + } else { + keep_frequency = true; + setRig(3400065000); + QTimer::singleShot (250, [=] {keep_frequency = false;}); + } + setXIT (ui->TxFreqSpinBox->value ()); +} + +void MainWindow::on_pb5G_clicked() +{ + if (m_mode=="MSK144") { + ui->sbTR->setValue (m_msk144_tr); + programStart = true; + QTimer::singleShot (250, [=] {programStart = false;}); + } + auto const& row = m_config.frequencies ()->best_working_frequency (5760200000); + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0) { + on_bandComboBox_activated (row); + } else { + keep_frequency = true; + setRig(5760200000); + QTimer::singleShot (250, [=] {keep_frequency = false;}); + } + setXIT (ui->TxFreqSpinBox->value ()); +} + +void MainWindow::on_pb10G_clicked() +{ + if (m_mode=="MSK144") { + ui->sbTR->setValue (m_msk144_tr); + programStart = true; + QTimer::singleShot (250, [=] {programStart = false;}); + } + auto const& row = m_config.frequencies ()->best_working_frequency (10368200000); + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0) { + on_bandComboBox_activated (row); + } else { + keep_frequency = true; + setRig(10368200000); + QTimer::singleShot (250, [=] {keep_frequency = false;}); + } + setXIT (ui->TxFreqSpinBox->value ()); +} + +void MainWindow::on_pb24G_clicked() +{ + if (m_mode=="MSK144") { + ui->sbTR->setValue (m_msk144_tr); + programStart = true; + QTimer::singleShot (250, [=] {programStart = false;}); + } + auto const& row = m_config.frequencies ()->best_working_frequency (24048200000); + ui->bandComboBox->setCurrentIndex (row); + if (row >= 0) { + on_bandComboBox_activated (row); + } else { + keep_frequency = true; + setRig(24048200000); + QTimer::singleShot (250, [=] {keep_frequency = false;}); + } + setXIT (ui->TxFreqSpinBox->value ()); +} + +void MainWindow::read_txLog() +{ + static QFile logfile {QDir {QStandardPaths::writableLocation (QStandardPaths::DataLocation)}.absoluteFilePath ("wsjtx.log")}; + QTextStream logstream(&logfile); + if(logfile.open(QIODevice::ReadOnly | QIODevice::Text)) { + while (!logstream.atEnd()) { + txLog = logstream.readAll(); + } + logstream.flush(); + logfile.close(); + } +} + +void MainWindow::on_actionErase_Tx_Log_triggered() +{ + int ret = MessageBox::query_message (this, tr ("Confirm Erase"), + tr ("Are you sure you want to erase the Tx Log?")); + if(ret==MessageBox::Yes) { + static QFile logFile {QDir {QStandardPaths::writableLocation (QStandardPaths::DataLocation)}.absoluteFilePath ("wsjtx.log")}; + logFile.remove(); + txLog = ""; + } +} + +void MainWindow::addCallsignToignoreList() +{ + if (m_hisCall!="") { + static QFile ignoreFile {QDir {QStandardPaths::writableLocation (QStandardPaths::DataLocation)}.absoluteFilePath ("ignore.list")}; + if(ignoreFile.open(QIODevice::Text | QIODevice::Append)) { + QString ignoreEntry= (m_hisCall + ","); + QTextStream out(&ignoreFile); + out << ignoreEntry << + #if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) + endl + #else + Qt::endl + #endif + ; + ignoreFile.close(); + QTimer::singleShot (2000, [=] {read_ignoreList();}); + QTimer::singleShot (7000, [=] {read_ignoreList();}); + MessageBox::information_message (this, tr ("\"%1\" added to Ignore List").arg (m_hisCall)); + } + } +} + +void MainWindow::read_ignoreList() +{ + static QFile ignoreFile {QDir {QStandardPaths::writableLocation (QStandardPaths::DataLocation)}.absoluteFilePath ("ignore.list")}; + QTextStream ignoreStream(&ignoreFile); + if(ignoreFile.open(QIODevice::ReadOnly | QIODevice::Text)) { + while (!ignoreStream.atEnd()) { + ignoreList = ignoreStream.readAll(); + } + ignoreStream.flush(); + ignoreFile.close(); + } +} + +void MainWindow::on_actionErase_Ignore_List_triggered() +{ + int ret = MessageBox::query_message (this, tr ("Confirm Erase"), + tr ("Are you sure you want to erase the Ignore List?")); + if(ret==MessageBox::Yes) { + static QFile ignoreFile {QDir {QStandardPaths::writableLocation (QStandardPaths::DataLocation)}.absoluteFilePath ("ignore.list")}; + ignoreFile.remove(); + ignoreList = ""; + } +} + +void MainWindow::read_ALLCALL7() +{ + static QFile AllCall7File {"ALLCALL7.TXT"}; + QTextStream AllCall7Stream(&AllCall7File); + if(AllCall7File.open(QIODevice::ReadOnly | QIODevice::Text)) { + while (!AllCall7Stream.atEnd()) { + ALLCALL7 = AllCall7Stream.readAll(); + } + AllCall7Stream.flush(); + AllCall7File.close(); + } +} + +void MainWindow::remove_old_files(const QString &directoryPath, int daysOld) +{ + QDir dir(directoryPath); + if (!dir.exists()) { + qWarning() << "Directory does not exist:" << directoryPath; + return; + } + dir.setFilter(QDir::Files); + QDateTime timeThreshold = QDateTime::currentDateTime().addDays(-daysOld); + QFileInfoList fileList = dir.entryInfoList(); + foreach(QFileInfo fileInfo, fileList) { + if(fileInfo.lastModified() < timeThreshold) { + if(!QFile::remove(fileInfo.absoluteFilePath())) { + qWarning() << "Could not delete file:" << fileInfo.absoluteFilePath(); + } else { + qDebug() << "Deleted old file:" << fileInfo.absoluteFilePath(); + } + } + } +} + +void MainWindow::alertQSYmessage () +{ +#ifdef WIN32 + QAudioOutput info(QAudioDeviceInfo::defaultOutputDevice()); + QString binPath = QCoreApplication::applicationDirPath(); + QAudioFormat format; + format.setCodec("audio/pcm"); + format.setSampleRate (48000); + format.setChannelCount (1); + format.setSampleSize (16); + format.setSampleType(QAudioFormat::SignedInt); + QAudioOutput* audio; + audio = new QAudioOutput(format, this); + connect(audio, SIGNAL(stateChanged(QAudio::State)), this, SLOT(handleStateChanged(QAudio::State))); + QFile *effect1 = new QFile(this); + effect1->setFileName(QString("%1/%2").arg(binPath, "/sounds/Message.wav")); + effect1->open(QIODevice::ReadOnly); + audio->start(effect1); +#else + QString binPath = QCoreApplication::applicationDirPath(); + QSound::play(binPath + "/sounds/Message.wav"); // for Linux and macOS +#endif +} diff --git a/widgets/mainwindow.h b/widgets/mainwindow.h index db2289d1..7aee7db6 100755..100644 --- a/widgets/mainwindow.h +++ b/widgets/mainwindow.h @@ -1,1083 +1,1086 @@ -// -*- Mode: C++ -*-
-#ifndef MAINWINDOW_H
-#define MAINWINDOW_H
-
-#include <QMainWindow>
-#include <QByteArray>
-#include <QString>
-#include <QStringList>
-#include <QLabel>
-#include <QThread>
-#include <QProcess>
-#include <QProgressBar>
-#include <QTimer>
-#include <QDateTime>
-#include <QList>
-#include <QAudioDeviceInfo>
-#include <QStringList>
-#include <QScopedPointer>
-#include <QDir>
-#include <QProgressDialog>
-#include <QAbstractSocket>
-#include <QHostAddress>
-#include <QPointer>
-#include <QSet>
-#include <QVector>
-#include <QScrollBar>
-#include <QQueue>
-#include <QFuture>
-#include <QFutureWatcher>
-#include <QDateTime>
-
-#include "MultiGeometryWidget.hpp"
-#include "NonInheritingProcess.hpp"
-#include "Audio/AudioDevice.hpp"
-#include "commons.h"
-#include "Radio.hpp"
-#include "models/Modes.hpp"
-#include "models/FrequencyList.hpp"
-#include "Configuration.hpp"
-#include "WSPR/WSPRBandHopping.hpp"
-#include "Transceiver/Transceiver.hpp"
-#include "DisplayManual.hpp"
-#include "Network/PSKReporter.hpp"
-#include "Network/Cloudlog.hpp"
-#include "logbook/logbook.h"
-#include "astro.h"
-#include "widgets/QSYMessageCreator.h"
-#include "widgets/QSYMessage.h"
-#include "widgets/qsymonitor.h"
-#include "MessageBox.hpp"
-#include "Network/NetworkAccessManager.hpp"
-
-#define NUM_JT4_SYMBOLS 206 //(72+31)*2, embedded sync
-#define NUM_JT65_SYMBOLS 126 //63 data + 63 sync
-#define NUM_JT9_SYMBOLS 85 //69 data + 16 sync
-#define NUM_WSPR_SYMBOLS 162 //(50+31)*2, embedded sync
-#define NUM_MSK144_SYMBOLS 144 //s8 + d48 + s8 + d80
-#define NUM_Q65_SYMBOLS 85 //63 data + 22 sync
-#define NUM_FT8_SYMBOLS 79
-#define NUM_SUPERFOX_SYMBOLS 153
-#define NUM_FT4_SYMBOLS 105
-#define NUM_FST4_SYMBOLS 160 //240/2 data + 5*8 sync
-#define NUM_CW_SYMBOLS 250
-#define MAX_NUM_SYMBOLS 250
-#define TX_SAMPLE_RATE 48000
-#define NRING 3456000
-#define MAX_HOUNDS_IN_QUEUE 10
-
-// extern int volatile itone[MAX_NUM_SYMBOLS]; //Audio tones for all Tx symbols
-// extern int volatile icw[NUM_CW_SYMBOLS]; //Dits for CW ID
-
-//--------------------------------------------------------------- MainWindow
-namespace Ui {
- class MainWindow;
-}
-
-class QProcessEnvironment;
-class QSharedMemory;
-class QSplashScreen;
-class QSettings;
-class QLineEdit;
-class QFont;
-class QHostInfo;
-class EchoGraph;
-class FastGraph;
-class WideGraph;
-class LogQSO;
-class Transceiver;
-class MessageAveraging;
-class ActiveStations;
-class FoxLogWindow;
-class CabrilloLogWindow;
-class ColorHighlighting;
-class MessageClient;
-class QTime;
-class WSPRBandHopping;
-class HelpTextWindow;
-class WSPRNet;
-class SoundOutput;
-class Modulator;
-class SoundInput;
-class Detector;
-class SampleDownloader;
-class MultiSettings;
-class EqualizationToolsDialog;
-class DecodedText;
-class Cloudlog;
-
-class MainWindow
- : public MultiGeometryWidget<3, QMainWindow>
-{
- Q_OBJECT;
-
-public:
- using Frequency = Radio::Frequency;
- using FrequencyDelta = Radio::FrequencyDelta;
- using Mode = Modes::Mode;
- using SpecOp = Configuration::SpecialOperatingActivity;
-
- explicit MainWindow(QDir const& temp_directory, bool multiple, MultiSettings *,
- QSharedMemory *shdmem, unsigned downSampleFactor,
- QSplashScreen *, QProcessEnvironment const&,
- QWidget *parent = nullptr);
- ~MainWindow();
-
- int decoderBusy () const {return m_decoderBusy;}
-
-public slots:
- void showSoundInError(const QString& errorMsg);
- void showSoundOutError(const QString& errorMsg);
- void showStatusMessage(const QString& statusMsg);
- void dataSink(qint64 frames);
- void fastSink(qint64 frames);
- void tci_mod_active(bool on) {m_tci_mod_active = on;}
- void diskDat();
- void freezeDecode(int n);
- void guiUpdate();
- void doubleClickOnCall (Qt::KeyboardModifiers);
- void doubleClickOnCall2(Qt::KeyboardModifiers);
- void doubleClickOnFoxQueue(Qt::KeyboardModifiers);
- void doubleClickOnFoxInProgress(Qt::KeyboardModifiers modifiers);
- void readFromStdout();
- void p1ReadFromStdout();
- void setXIT(int n, Frequency base = 0u);
- void setFreq4(int rxFreq, int txFreq);
- void msgAvgDecode2();
- void fastPick(int x0, int x1, int y);
-
-private:
- void change_layout (std::size_t) override;
- void keyPressEvent (QKeyEvent *) override;
- void closeEvent(QCloseEvent *) override;
- void childEvent(QChildEvent *) override;
- bool eventFilter(QObject *, QEvent *) override;
- void showQSYMessage(QString message);
-
-private slots:
- void initialize_fonts ();
- void ScrollBarPosition(int n);
- void on_actionUse_Dark_Style_triggered (bool checked);
- void on_actionBand_Buttons_triggered ();
- void on_actionVHF_UHF_Buttons_triggered ();
- void on_pb160_clicked();
- void on_pb80_clicked();
- void on_pb60_clicked();
- void on_pb40_clicked();
- void on_pb30_clicked();
- void on_pb20_clicked();
- void on_pb17_clicked();
- void on_pb15_clicked();
- void on_pb12_clicked();
- void on_pb10_clicked();
- void on_pb8_clicked();
- void on_pb6_clicked();
- void on_pb2_clicked();
- void on_pb70_clicked();
- void on_pb50_clicked();
- void on_pb4_clicked();
- void on_pb144_clicked();
- void on_pb220_clicked();
- void on_pb432_clicked();
- void on_pb902_clicked();
- void on_pb23_clicked();
- void on_pb13_clicked();
- void on_pb9_clicked();
- void on_pb5G_clicked();
- void on_pb10G_clicked();
- void on_pb24G_clicked();
- void check_button_color();
- void stopWRTimeout();
- void stopWCTimeout();
- void bandHoppingTimer();
- void bandHopping();
- void on_houndButton_clicked(bool checked);
- void on_cbHoldTxFreq_clicked (bool);
- void on_ft8Button_clicked();
- void on_ft4Button_clicked();
- void on_msk144Button_clicked();
- void on_q65Button_clicked();
- void on_jt65Button_clicked();
- void on_echoButton_clicked();
- void on_pb15A_clicked();
- void on_pb15C_clicked();
- void on_pb30B_clicked();
- void on_pb60C_clicked();
- void on_pb60D_clicked();
- void on_pb60E_clicked();
- void on_tx1_editingFinished();
- void on_tx2_editingFinished();
- void on_tx3_editingFinished();
- void on_tx4_editingFinished();
- void on_tx5_currentTextChanged (QString const&);
- void on_tx6_editingFinished();
- void on_actionSettings_triggered();
- void on_monitorButton_clicked (bool);
- void on_actionAbout_triggered();
- void on_autoButton_clicked (bool);
- void on_stopTxButton_clicked();
- void on_stopButton_clicked();
- void on_pbBandHopping_clicked();
- void on_actionRelease_Notes_triggered ();
- void on_actionFT8_DXpedition_Mode_User_Guide_triggered();
- void on_actionSuperFox_User_Guide_triggered();
- void on_actionQSG_FST4_triggered();
- void on_actionQSG_Q65_triggered();
- void on_actionQSG_X250_M3_triggered();
- void on_actionQuick_Start_Guide_to_WSJT_X_2_7_and_QMAP_triggered();
- void on_actionWSJT_X_improved_Home_Page_triggered();
- void on_actionThe_additional_features_of_wsjt_x_improved_triggered();
- void on_actionRecommended_Audio_Settings_triggered();
- void on_actionRig_Control_Errors_triggered();
- void on_actionOnline_User_Guide_triggered();
- void on_actionLocal_User_Guide_triggered();
- void on_actionWide_Waterfall_triggered();
- void on_actionOpen_triggered();
- void on_actionOpen_next_in_directory_triggered();
- void on_actionDecode_remaining_files_in_directory_triggered();
- void on_actionDelete_all_wav_files_in_SaveDir_triggered();
- void on_actionOpen_log_directory_triggered ();
- void on_actionNone_triggered();
- void on_actionSave_all_triggered();
- void on_actionDefault_event_logging_triggered();
- void on_actionDiagnostic_mode_triggered();
- void on_actionDisable_event_logging_triggered();
- void on_actionKeyboard_shortcuts_triggered();
- void on_actionSpecial_mouse_commands_triggered();
- void on_actionSolve_FreqCal_triggered();
- void on_actionCopyright_Notice_triggered();
- void on_actionSWL_Mode_triggered (bool checked);
- void on_DecodeButton_clicked (bool);
- void decode();
- void decodeBusy(bool b);
- void on_EraseButton_clicked();
- void band_activity_cleared ();
- void rx_frequency_activity_cleared ();
- void on_txFirstCheckBox_stateChanged(int arg1);
- void set_dateTimeQSO(int m_ntx);
- void set_ntx(int n);
- void on_txrb1_toggled(bool status);
- void on_txrb1_doubleClicked ();
- void on_txrb2_toggled(bool status);
- void on_txrb3_toggled(bool status);
- void on_txrb4_toggled(bool status);
- void on_txrb4_doubleClicked ();
- void on_txrb5_toggled(bool status);
- void on_txrb5_doubleClicked ();
- void on_txrb6_toggled(bool status);
- void on_txb1_clicked();
- void on_txb1_doubleClicked ();
- void on_txb2_clicked();
- void on_txb3_clicked();
- void on_txb4_clicked();
- void on_txb4_doubleClicked ();
- void on_txb5_clicked();
- void on_txb5_doubleClicked ();
- void on_txb6_clicked();
- void on_lookupButton_clicked();
- void on_addButton_clicked();
- void on_ignoreButton_clicked();
- void on_comboBoxCQ_activated ();
- void on_DX_Call_Button_clicked (bool checked);
- void wheelEvent(QWheelEvent *event) override;
- void mousePressEvent(QMouseEvent *event) override;
- void on_dxCallEntry_textChanged (QString const&);
- void on_dxGridEntry_textChanged (QString const&);
- void on_dxCallEntry_editingFinished();
- void on_dxCallEntry_returnPressed ();
- void on_genStdMsgsPushButton_clicked();
- void on_logQSOButton_clicked();
- void read_txLog();
- void on_actionErase_Tx_Log_triggered();
- void read_ignoreList();
- void addCallsignToignoreList();
- void on_actionErase_Ignore_List_triggered();
- void read_ALLCALL7();
- void remove_old_files(const QString &directoryPath, int daysOld);
- void on_actionJT9_triggered();
- void on_actionJT65_triggered();
- void on_actionJT4_triggered();
- void on_actionFT4_triggered();
- void on_actionFT8_triggered();
- void on_actionFST4_triggered();
- void on_actionFST4W_triggered();
- void on_TxFreqSpinBox_valueChanged(int arg1);
- void on_actionSave_decoded_triggered();
- void on_actionQuickDecode_toggled (bool);
- void on_actionMediumDecode_toggled (bool);
- void on_actionDeepestDecode_toggled (bool);
-
- //ft8md
- void on_actionDecFT8cycles1_triggered();
- void on_actionDecFT8cycles2_triggered();
- void on_actionDecFT8cycles3_triggered();
- void on_actionRXfLow_triggered();
- void on_actionRXfMedium_triggered();
- void on_actionRXfHigh_triggered();
- void on_actionMTAuto_triggered();
- void on_actionMT1_triggered();
- void on_actionMT2_triggered();
- void on_actionMT3_triggered();
- void on_actionMT4_triggered();
- void on_actionMT5_triggered();
- void on_actionMT6_triggered();
- void on_actionMT7_triggered();
- void on_actionMT8_triggered();
- void on_actionMT9_triggered();
- void on_actionMT10_triggered();
- void on_actionMT11_triggered();
- void on_actionMT12_triggered();
- void on_actionFT8SensMin_toggled(bool checked);
- void on_actionlowFT8thresholds_toggled(bool checked);
- void on_actionFT8subpass_toggled(bool checked);
- void on_actionStartTwoStage_toggled(bool checked);
- void on_actionStartThreeStage_toggled(bool checked);
- void on_actionStartEarly_toggled(bool checked);
- void on_actionStartNormal_toggled(bool checked);
- void on_actionStartLate_toggled(bool checked);
- void on_actionFT8WidebandDXCallSearch_toggled(bool checked);
- void on_actionUse_multithreaded_FT8_decoder_triggered(bool checked);
- //ft8md
-
- void bumpFqso(int n);
- void on_actionErase_ALL_TXT_triggered();
- void on_reset_cabrillo_log_action_triggered ();
- void on_actionErase_wsjtx_log_adi_triggered();
- void on_actionErase_WSPR_hashtable_triggered();
- void on_actionErase_list_of_Q65_callers_triggered();
- void on_actionExport_Cabrillo_log_triggered();
- void startTx2();
- void startP1();
- void stopTx();
- void stopTx2();
- void on_rptSpinBox_valueChanged(int n);
- void killFile();
- void on_tuneButton_clicked (bool);
- void on_pbR2T_clicked();
- void on_pbT2R_clicked();
- void acceptQSO (QDateTime const&, QString const& call, QString const& grid
- , Frequency dial_freq, QString const& mode
- , QString const& rpt_sent, QString const& rpt_received
- , QString const& tx_power, QString const& comments
- , QString const& name, QDateTime const& QSO_date_on, QString const& operator_call
- , QString const& my_call, QString const& my_grid
- , QString const& exchange_sent, QString const& exchange_rcvd
- , QString const& propmode, QString const& satellite
- , QString const& sat_mode
- , QString const& freqRx, QByteArray const& ADIF);
- void on_bandComboBox_currentIndexChanged (int index);
- void on_bandComboBox_editTextChanged (QString const& text);
- void on_bandComboBox_activated (int index);
- void on_readFreq_clicked();
- void on_RxFreqSpinBox_valueChanged(int n);
- void on_outAttenuation_valueChanged (int);
- void rigOpen ();
- void handle_transceiver_update (Transceiver::TransceiverState const&);
- void handle_transceiver_failure (QString const& reason);
- void handle_leavingSettings();
- void on_actionAstronomical_data_toggled (bool);
- void on_actionQSYMessage_Creator_triggered();
- void on_actionQSY_Monitor_triggered();
- void alertQSYmessage();
- void on_actionShort_list_of_add_on_prefixes_and_suffixes_triggered();
- void band_changed (Frequency);
- void monitor (bool);
- void end_tuning ();
- void stop_tuning ();
- void stopTuneATU();
- void auto_tx_mode(bool);
- void on_actionMessage_averaging_triggered();
- void on_actionActiveStations_triggered();
- void on_contest_log_action_triggered ();
- void on_fox_log_action_triggered ();
- void on_actionColors_triggered();
- void on_actionInclude_averaging_toggled (bool);
- void on_actionInclude_correlation_toggled (bool);
- void on_actionEnable_AP_DXcall_toggled (bool);
- void on_actionAuto_Clear_Avg_toggled (bool);
- void VHF_features_enabled(bool b);
- void on_sbSubmode_valueChanged(int n);
- void on_cbSendMsg_toggled(bool b);
- void on_cbShMsgs_toggled(bool b);
- void on_cbSWL_toggled(bool b);
- void on_cbTx6_toggled(bool b);
- void on_cbMenus_toggled(bool b);
- void on_cbCQonly_toggled(bool b);
- void on_cbAutoSeq_toggled(bool b);
- void networkError (QString const&);
- void on_ClrAvgButton_clicked();
- void on_actionWSPR_triggered();
- void on_syncSpinBox_valueChanged(int n);
- void on_TxPowerComboBox_currentIndexChanged(int);
- void on_sbTxPercent_valueChanged(int n);
- void on_cbUploadWSPR_Spots_toggled(bool b);
- void WSPR_config(bool b);
- void uploadWSPRSpots (bool direct_post = false, QString const& decode_text = QString {});
- void TxAgain();
- void uploadResponse(QString const& response);
- void on_WSPRfreqSpinBox_valueChanged(int n);
- void on_sbFST4W_RxFreq_valueChanged(int n);
- void on_sbFST4W_FTol_valueChanged(int n);
- void on_pbTxNext_clicked(bool b);
- void on_actionEcho_Graph_triggered();
- void on_actionEcho_triggered();
- void on_actionFast_Graph_triggered();
- void fast_decode_done();
- void on_actionMeasure_reference_spectrum_triggered();
- void on_actionErase_reference_spectrum_triggered();
- void on_actionMeasure_phase_response_triggered();
- void on_sbTR_valueChanged (int);
- void on_sbTR_FST4W_valueChanged (int);
- void on_sbFtol_valueChanged (int);
- void on_cbFast9_clicked(bool b);
- void on_sbCQTxFreq_valueChanged(int n);
- void on_cbCQTx_toggled(bool b);
- void on_actionMSK144_triggered();
- void on_actionQ65_triggered();
- void on_actionFreqCal_triggered();
- void splash_done ();
- void on_measure_check_box_stateChanged (int);
- void on_sbNlist_valueChanged(int n);
- void on_sbNslots_valueChanged(int n);
- void on_sbF_Low_valueChanged(int n);
- void on_sbF_High_valueChanged(int n);
- void chk_FST4_freq_range();
- void on_pbFoxReset_clicked();
- void on_pbFreeText_clicked();
- void FoxReset(QString reason);
- void on_comboBoxHoundSort_activated (int index);
- void not_GA_warning_message ();
- void checkMSK144ContestType();
- void on_pbBestSP_clicked();
- void on_RoundRobin_currentTextChanged(QString text);
- void setTxMsg(int n);
- bool stdCall(QString const& w);
- void remote_configure (QString const& mode, quint32 frequency_tolerance, QString const& submode
- , bool fast_mode, quint32 tr_period, quint32 rx_df, QString const& dx_call
- , QString const& dx_grid, bool generate_messages);
- void callSandP2(int nline);
- void refreshHoundQueueDisplay();
- void queueActiveWindowHound2(QString text);
- void update_tx5(const QString &qsy_text);
- void reply_tx5(const QString &qsy_text);
- void setQSYMessageCreatorStatus(const bool &QSYMessageCreatorValue);
- void on_rbFixedTone_toggled(bool b);
- void on_rbEchoMessage_toggled(bool b);
- void on_rbEchoCW_toggled(bool b);
- void on_leEchoMessage_textChanged();
-
-private:
- Q_SIGNAL void initializeAudioOutputStream (QAudioDeviceInfo,
- unsigned channels, unsigned msBuffered) const;
- Q_SIGNAL void stopAudioOutputStream () const;
- Q_SIGNAL void startAudioInputStream (QAudioDeviceInfo const&,
- int framesPerBuffer, AudioDevice * sink,
- unsigned downSampleFactor, AudioDevice::Channel) const;
- Q_SIGNAL void suspendAudioInputStream () const;
- Q_SIGNAL void resumeAudioInputStream () const;
- Q_SIGNAL void startDetector (AudioDevice::Channel) const;
- Q_SIGNAL void FFTSize (unsigned) const;
- Q_SIGNAL void detectorClose () const;
- Q_SIGNAL void finished () const;
- Q_SIGNAL void transmitFrequency (double) const;
- Q_SIGNAL void endTransmitMessage (bool quick = false) const;
- Q_SIGNAL void tune (bool = true) const;
- Q_SIGNAL void sendMessage (QString mode, unsigned symbolsLength,
- double framesPerSymbol, double frequency, double toneSpacing,
- SoundOutput *, AudioDevice::Channel = AudioDevice::Mono,
- bool synchronize = true, bool fastMode = false, double dBSNR = 99.,
- int TRperiod=60) const;
- Q_SIGNAL void outAttenuationChanged (qreal) const;
- Q_SIGNAL void toggleShorthand () const;
- Q_SIGNAL void reset_audio_input_stream (bool report_dropped_frames) const;
-
-private:
- void set_mode (QString const& mode);
- void astroUpdate ();
- void writeAllTxt(QString message);
- void auto_sequence (DecodedText const& message, unsigned start_tolerance, unsigned stop_tolerance);
- void trim_view (bool b);
- void foxTest();
- void setColorHighlighting();
- void chkFT4();
- bool elide_tx1_not_allowed () const;
- void readWidebandDecodes();
- void configActiveStations();
- void sfox_tx();
- bool play_DXcall = false;
- bool inSettings = false;
-
- QProcessEnvironment const& m_env;
- NetworkAccessManager m_network_manager;
- bool m_valid;
- QSplashScreen * m_splash;
- QString m_revision;
- bool m_multiple;
- MultiSettings * m_multi_settings;
- QPushButton * m_configurations_button;
- QSettings * m_settings;
- QScopedPointer<Ui::MainWindow> ui;
-
- Configuration m_config;
- LogBook m_logBook; // must be after Configuration construction
- Cloudlog m_cloudlog;
- WSPRBandHopping m_WSPR_band_hopping;
- bool m_WSPR_tx_next;
- MessageBox m_rigErrorMessageBox;
- QScopedPointer<SampleDownloader> m_sampleDownloader;
- QScopedPointer<EqualizationToolsDialog> m_equalizationToolsDialog;
-
- QScopedPointer<WideGraph> m_wideGraph;
- QScopedPointer<EchoGraph> m_echoGraph;
- QScopedPointer<FastGraph> m_fastGraph;
- QScopedPointer<LogQSO> m_logDlg;
- QScopedPointer<Astro> m_astroWidget;
- QScopedPointer<QSYMessageCreator> m_QSYMessageCreatorWidget;
- QScopedPointer<QSYMessage> m_QSYMessageWidget;
- QScopedPointer<QSYMonitor> m_qsymonitorWidget;
- QScopedPointer<HelpTextWindow> m_shortcuts;
- QScopedPointer<HelpTextWindow> m_prefixes;
- QScopedPointer<HelpTextWindow> m_mouseCmnds;
- QScopedPointer<MessageAveraging> m_msgAvgWidget;
- QScopedPointer<ActiveStations> m_ActiveStationsWidget;
- QScopedPointer<FoxLogWindow> m_foxLogWindow;
- QScopedPointer<CabrilloLogWindow> m_contestLogWindow;
- QScopedPointer<ColorHighlighting> m_colorHighlighting;
- Transceiver::TransceiverState m_rigState;
- Frequency m_lastDialFreq;
- QString m_lastBand;
- QString m_lastCallsign;
- Frequency m_dialFreqRxWSPR; // best guess at WSPR QRG
- bool m_QSYMessageCreatorValue = false;
- bool m_qsymonitorValue = false;
-
- Detector * m_detector;
- unsigned m_FFTSize;
- SoundInput * m_soundInput;
- Modulator * m_modulator;
- SoundOutput * m_soundOutput;
- int m_rx_audio_buffer_frames;
- int m_tx_audio_buffer_frames;
- QThread m_audioThread;
-
- qint64 m_msErase;
- qint64 m_secBandChanged;
- qint64 m_msDecStarted; //ft8md
- qint64 m_freqMoon;
- qint64 m_fullFoxCallTime;
- qint64 m_msEchoTxStart=0;
-
- Frequency m_freqNominal;
- Frequency m_freqNominalPeriod;
- Frequency m_freqTxNominal;
- quint64 m_msk144basefreq;
- quint64 m_msk144oldfreq;
- quint64 m_mslastTX; //ft8md
- qint32 m_nlasttx; //ft8md
- qint32 m_lapmyc; //ft8md
- Astro::Correction m_astroCorrection;
- bool m_reverse_Doppler;
-
- double m_tRemaining;
- double m_TRperiod;
- double m_fSpread;
- double m_s6;
- double m_fDither;
- double m_fAudioShift;
-
- float m_DTtol;
- float m_t0;
- float m_t1;
- float m_t0Pick;
- float m_t1Pick;
- float m_fCPUmskrtd;
- float m_tEcho=0;
-
- qint32 m_waterfallAvg;
- qint32 m_ntx;
- bool m_gen_message_is_cq;
- bool m_send_RR73;
- qint32 m_timeout;
- qint32 m_XIT;
- qint32 m_setftx;
- qint32 m_ndepth;
- qint32 m_ncandthin; //ft8md
-
- //ft8md
- qint32 m_nFT8Cycles;
- qint32 m_nFT8SWLCycles;
- qint32 m_nFT8RXfSens;
- qint32 m_ft8threads;
- qint32 m_ft8Sensitivity;
- qint32 m_ft8DecoderStart;
- qint32 m_nsecBandChanged;
- qint32 m_nFT4depth;
- //ft8md
-
- qint32 m_sec0;
- qint32 m_RxLog;
- qint32 m_nutc0;
- qint32 m_ntr;
- qint32 m_tx;
- quint64 m_mslastMon;
- int m_addtx;
- quint32 m_delay;
- qint32 m_hsym;
- qint32 m_nsps;
- qint32 m_hsymStop;
- qint32 m_inGain;
- qint32 m_ncw;
- qint32 m_secID;
- qint32 m_idleMinutes;
- qint32 m_nSubMode;
- qint32 m_nclearave;
- qint32 m_minSync;
- qint32 m_dBm;
- qint32 m_nWSPRdecodes;
- qint32 m_k0;
- qint32 m_kdone;
- qint32 m_nPick;
- FrequencyList_v2_101::const_iterator m_frequency_list_fcal_iter;
- qint32 m_nTx73;
- qint32 m_UTCdisk;
- QDateTime m_UTCdiskDateTime;
- qint32 m_wait;
- qint32 m_isort;
- qint32 m_max_dB;
- qint32 m_nDXped=0;
- qint32 m_nSortedHounds=0;
- qint32 m_nHoundsCalling=0;
- qint32 m_Nlist=12;
- qint32 m_Nslots=5;
- qint32 m_Nslots0=0;
- qint32 m_nFoxMsgTimes[5]={0,0,0,0,0};
- qint32 m_tAutoOn;
- qint32 m_tFoxTx=0;
- qint32 m_tFoxTx0=0;
- qint32 m_maxStrikes=3; //Max # of repeats: 3 strikes and you're out
- qint32 m_maxFoxWait=3; //Max wait time for expected Hound replies
- qint32 m_foxCQtime=10; //CQs at least every 5 minutes
- qint32 m_tFoxTxSinceCQ=999; //Fox Tx cycles since most recent CQ
- qint32 m_nFoxFreq; //Audio freq at which Hound received a call from Fox
- qint32 m_nSentFoxRrpt=0; //Serial number for next R+rpt Hound will send to Fox
- qint32 m_kin0=0;
- qint32 m_earlyDecode=41;
- qint32 m_earlyDecode2=47;
- qint32 m_nDecodes=0;
- qint32 m_maxPoints=-1;
- qint32 m_latestDecodeTime=-1;
- qint32 m_points=-99;
- qint32 m_score=0;
- qint32 m_fDop=0;
- qint32 m_echoSec0=0;
- qint32 m_fetched=0;
- qint32 m_position;
-
- bool m_btxok; //True if OK to transmit
- bool m_diskData;
- bool m_loopall;
- bool m_decoderBusy;
- bool m_txFirst;
- bool m_auto;
- bool m_restart;
- bool m_startAnother;
-
- // start ft8md
- bool m_FT8EarlyStart;
- bool m_FT8WideDxCallSearch;
- bool m_skipTx1;
- bool m_swl;
- bool m_filter;
- bool m_agcc;
- bool m_hint;
- bool m_multithreadFT8;
- bool m_houndMode;
- bool m_commonFT8b;
- bool m_manualDecode;
- bool m_modeChanged;
- bool m_bMyCallStd;
- bool m_bHisCallStd;
- bool m_multInst;
- bool m_bandChanged;
- bool m_lasthint;
- // end ft8md
-
- bool m_saveDecoded;
- bool m_saveAll;
- bool m_widebandDecode;
- bool m_call3Modified;
- bool m_dataAvailable;
- bool m_bDecoded;
- bool m_noSuffix;
- bool m_decodedText2;
- bool m_sentFirst73;
- bool m_tci_mod_active;
- bool m_tci;
- bool m_tci_audio;
- int m_currentMessageType;
- QString m_currentMessage;
- int m_lastMessageType;
- QString m_lastMessageSent;
- QString m_tBlankLine;
- bool m_bShMsgs;
- bool m_bSWL;
- bool m_uploadWSPRSpots;
- bool m_uploading;
- bool m_grid6;
- bool m_tuneup;
- bool m_bTxTime;
- bool m_rxDone;
- bool m_bSimplex; // not using split even if it is available
- bool m_bEchoTxOK;
- bool m_bTransmittedEcho;
- bool m_bEchoTxed;
- bool m_bFastMode;
- bool m_bFast9;
- bool m_bFastDecodeCalled;
- bool m_bDoubleClickAfterCQnnn;
- bool m_bRefSpec;
- bool m_bClearRefSpec;
- bool m_bTrain;
- bool m_bUseRef;
- bool m_bFastDone;
- bool m_bAltV;
- bool m_bNoMoreFiles;
- bool m_bDoubleClicked;
- bool m_bCallingCQ;
- bool m_bAutoReply;
- QString m_lastloggedcall; //ft8md
- bool m_bCheckedContest;
- bool m_bWarnedSplit=false;
- bool m_bTUmsg;
- bool m_bBestSPArmed=false;
- bool m_bOK_to_chk=false;
- bool m_bSentReport=false;
- bool m_discard_decoded_hounds_this_cycle=false; // if something changes, like frequency, discard decoded messages that may be in-flight.
-
- SpecOp m_specOp;
-
- enum
- {
- CALLING,
- REPLYING,
- REPORT,
- ROGER_REPORT,
- ROGERS,
- SIGNOFF
- }
- m_QSOProgress; //State machine counter
-
- enum {CALL, GRID, DXCC, MULT};
-
- int m_ihsym;
- int m_nzap;
- int m_npts8;
- float m_px;
- float m_pxmax;
- float m_df3;
- int m_iptt0;
- bool m_btxok0;
- int m_nsendingsh;
- double m_onAirFreq0;
- bool m_first_error;
-
- char m_msg[100][80];
-
- // labels in status bar
- QLabel tx_status_label;
- QLabel config_label;
- QLabel mode_label;
- QLabel last_tx_label;
- QLabel auto_tx_label;
- QLabel band_hopping_label;
- QLabel ndecodes_label;
- QProgressBar progressBar;
- QLabel watchdog_label;
-
- QFuture<void> m_wav_future;
- QFutureWatcher<void> m_wav_future_watcher;
- QFutureWatcher<void> watcher3;
- QFutureWatcher<QString> m_saveWAVWatcher;
-
- NonInheritingProcess proc_jt9;
- NonInheritingProcess p1;
- NonInheritingProcess p3;
-
- QProcess p2;
- QProcess p4;
-
- WSPRNet *wsprNet;
-
- QTimer m_guiTimer;
- QTimer stopWRTimer; //Wait & Reply
- QTimer stopWCTimer; //Wait & Call
- QTimer ptt1Timer; //StartTx delay
- QTimer ptt0Timer; //StopTx delay
- QTimer logQSOTimer;
- QTimer killFileTimer;
- QTimer tuneButtonTimer;
- QTimer uploadTimer;
- QTimer tuneATU_Timer;
- QTimer TxAgainTimer;
- QTimer minuteTimer;
- QTimer splashTimer;
- QTimer p1Timer;
-
- QString m_path;
- QString m_baseCall;
- QString m_hisCall;
- QString m_hisGrid;
- QString m_appDir;
- QString m_cqStr;
- QString m_palette;
- QString m_dateTime;
- QString m_mode;
- QString m_modeTx;//ft8md
- QString m_fnameWE; // save path without extension
- QString m_rpt;
- QString m_nextRpt;
- QString m_rptSent;
- QString m_rptRcvd;
- QString m_qsoStart;
- QString m_qsoStop;
- QStringList m_cmndP1;
- QString m_msgSent0;
- QString m_calls;
- QString m_CQtype;
- QString m_opCall;
- QString m_houndCallers; //Sorted list of Hound callers
- QString m_fm0;
- QString m_fm1;
- QString m_xSent; //Contest exchange sent
- QString m_xRcvd; //Contest exchange received
- QString m_currentBand;
- QString m_currentBandPeriod;
- QString m_nextCall;
- QString m_nextGrid;
- QString m_fileDateTime;
- QString m_inQSOwith;
- QString m_BestCQpriority;
- QString m_deCall;
- QString m_deGrid;
- QString m_freeTextMsg;
- QString m_freeTextMsg0;
- QString m_ready2call[50];
- QString m_callers[50];
-
- QSet<QString> m_pfx;
- QSet<QString> m_sfx;
-
- struct FoxQSO //Everything we need to know about QSOs in progress (or recently logged).
- {
- QString grid; //Hound's declared locator
- QString sent; //Report sent to Hound
- QString rcvd; //Report received from Hound
- qint32 ncall; //Number of times report sent to Hound
- qint32 nRR73; //Number of times RR73 sent to Hound
- qint32 tFoxRrpt; //m_tFoxTx (Fox Tx cycle counter) when R+rpt was received from Hound
- qint32 tFoxTxRR73; //m_tFoxTx when RR73 was sent to Hound
- };
-
- QMap<QString,FoxQSO> m_foxQSO; //Key = HoundCall, value = parameters for QSO in progress
- QMap<QString,QString> m_loggedByFox; //Key = HoundCall, value = logged band
- QMap<QString,qint32> m_annotated_callsigns; //Key = HoundCall, value = provided by api call
-
- struct FixupQSO //Info for fixing Fox's log from file "FoxQSO.txt"
- {
- QString grid; //Hound's declared locator
- QString sent; //Report sent to Hound
- QString rcvd; //Report received from Hound
- QDateTime QSO_time;
- };
- QMap<QString,FixupQSO> m_fixupQSO; //Key = HoundCall, value = info for QSO in progress
-
- struct ActiveCall
- {
- QString grid4;
- QString bands;
- qint32 az;
- qint32 points;
- };
- QMap<QString,ActiveCall> m_activeCall; //Key = callsign, value = grid4, az, points for ARRL_DIGI
-
- struct EMECall
- {
- QString grid4;
- double frx;
- double fsked;
- qint32 nsnr;
- qint32 t;
- bool worked;
- bool ready2call;
- QString submode;
- };
- QMap<QString,EMECall> m_EMECall;
-
- QMap<QString,bool> m_EMEworked;
-
- struct RecentCall
- {
- qint64 dialFreq;
- qint32 audioFreq;
- qint32 snr;
- qint32 decodeTime;
- bool txEven;
- bool ready2call;
- };
- QMap<QString,RecentCall> m_recentCall; //Key = callsign, value = snr, dialFreq, audioFreq, decodeTime
- struct ARRL_logged
- {
- QDateTime time;
- QString band;
- qint32 points;
- };
- QList<ARRL_logged> m_arrl_log;
-
- QQueue<QString> m_houndQueue; //Selected Hounds available for starting a QSO
- QQueue<QString> m_foxQSOinProgress; //QSOs in progress: Fox has sent a report
- QQueue<qint64> m_foxRateQueue;
-
- QDateTime m_dateTimeQSOOn;
- QDateTime m_dateTimeLastTX;
- QDateTime m_dateTimeSentTx3;
- QDateTime m_dateTimeRcvdRR73;
- QDateTime m_dateTimeBestSP;
- QDateTime m_dateTimeSeqStart; //Nominal start time of Rx sequence about to be decoded
-
- QSharedMemory *mem_jt9;
- QString m_QSOText;
- unsigned m_downSampleFactor;
- QThread::Priority m_audioThreadPriority;
- bool m_bandEdited;
- bool m_splitMode;
- bool m_monitoring=false;
- bool m_echoRunning=false;
- bool m_tx_when_ready;
- bool m_transmitting;
- bool m_tune;
- bool m_tx_watchdog; // true when watchdog triggered
- bool m_block_pwr_tooltip;
- bool m_PwrBandSetOK;
- bool m_bDisplayedOnce;
- Frequency m_lastMonitoredFrequency;
- double m_toneSpacing;
- int m_firstDecode;
- QProgressDialog m_optimizingProgress;
- QTimer m_heartbeat;
- MessageClient * m_messageClient;
- PSKReporter m_psk_Reporter;
- DisplayManual m_manual;
- QHash<QString, QVariant> m_pwrBandTxMemory; // Remembers power level by band
- QHash<QString, QVariant> m_pwrBandTuneMemory; // Remembers power level by band for tuning
- QByteArray m_geometryNoControls;
- QVector<double> m_phaseEqCoefficients;
- bool m_block_udp_status_updates;
- bool m_useDarkStyle;
-
- //---------------------------------------------------- private functions
- void readSettings();
- void set_application_font (QFont const&);
- void setDecodedTextFont (QFont const&);
- void writeSettings();
- void createStatusBar();
- void updateStatusBar();
- void genStdMsgs(QString rpt, bool unconditional = false);
- void genCQMsg();
- void clearDX ();
- void lookup();
- void ba2msg(QByteArray ba, char* message);
- void msgtype(QString t, QLineEdit* tx);
- void stub();
- void statusChanged();
- void fixStop();
- bool shortList(QString callsign) const;
- void transmit (double snr = 99.);
- void rigFailure (QString const& reason);
- void pskSetLocal ();
- void pskPost(DecodedText const& decodedtext);
- void displayDialFrequency ();
- void transmitDisplay (bool);
- void processMessage(DecodedText const& message, Qt::KeyboardModifiers = Qt::NoModifier);
- void replyToCQ (QTime, qint32 snr, float delta_time, quint32 delta_frequency, QString const& mode, QString const& message_text, bool low_confidence, quint8 modifiers);
- void locationChange(QString const& location);
- void replayDecodes ();
- void postDecode (bool is_new, QString const& message);
- void postWSPRDecode (bool is_new, QStringList message_parts);
- void enable_DXCC_entity (bool on);
- void switch_mode (Mode);
- void WSPR_scheduling ();
- void freqCalStep();
- void setRig (Frequency = 0); // zero frequency means no change
- void WSPR_history(Frequency dialFreq, int ndecodes);
- QString beacon_start_time (int n = 0);
- QString WSPR_message();
- void fast_config(bool b);
- void CQTxFreq();
- void useNextCall();
- void abortQSO();
- void updateRate();
- void write_all(QString txRx, QString message);
- bool isWorked(int itype, QString key, float fMHz=0, QString="");
-
- QString save_wave_file (QString const& name
- , short const * data
- , int samples
- , QString const& my_callsign
- , QString const& my_grid
- , QString const& mode
- , qint32 sub_mode
- , Frequency frequency
- , QString const& his_call
- , QString const& his_grid) const;
- void hound_reply ();
- QString sortHoundCalls(QString t, int isort, int max_dB);
- void rm_tb4(QString houndCall);
- void read_wav_file (QString const& fname);
- void decodeDone ();
- bool subProcessFailed (QProcess *, int exit_code, QProcess::ExitStatus);
- void subProcessError (QProcess *, QProcess::ProcessError);
- void statusUpdate () const;
- void update_watchdog_label ();
- void invalidate_frequencies_filter ();
- void on_the_minute ();
- void add_child_to_event_filter (QObject *);
- void remove_child_from_event_filter (QObject *);
- void setup_status_bar (bool vhf);
- void tx_watchdog (bool triggered);
- qint64 nWidgets(QString t);
- void displayWidgets(qint64 n);
- QChar current_submode () const; // returns QChar {0} if submode is not appropriate
- void write_transmit_entry (QString const& file_name);
- void selectHound(QString t, bool bTopQueue);
- void removeHoundFromCallingList(QString callsign);
- void houndCallers();
- void updateFoxQSOsInProgressDisplay();
- void foxQueueTopCallCommand();
- void foxRxSequencer(QString msg, QString houndCall, QString rptRcvd);
- void foxTxSequencer();
- void foxGenWaveform(int i,QString fm);
- void writeFoxQSO (QString const& msg);
- void update_foxLogWindow_rate();
- void to_jt9(qint32 n, qint32 istart, qint32 idone);
- bool is77BitMode () const;
- void cease_auto_Tx_after_QSO ();
- Q_SLOT void ARRL_Digi_Display();
- void ARRL_Digi_Update(DecodedText dt);
- void activeWorked(QString call, QString band);
- void read_log();
- void refreshPileupList();
- QString userAgent();
- void handleVerifyMsg(int status, QDateTime ts, QString callsign, QString code, unsigned int hz, QString const &response);
- void writeFoxTxMsgs();
-#ifdef FOX_OTP
- QString foxOTPcode();
-#endif
-};
-
-extern int killbyname(const char* progName);
-extern void getDev(int* numDevices,char hostAPI_DeviceName[][50],
- int minChan[], int maxChan[],
- int minSpeed[], int maxSpeed[]);
-extern int next_tx_state(int pctx);
-
-#endif // MAINWINDOW_H
+// -*- Mode: C++ -*- +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include <QMainWindow> +#include <QByteArray> +#include <QString> +#include <QStringList> +#include <QLabel> +#include <QThread> +#include <QProcess> +#include <QProgressBar> +#include <QTimer> +#include <QDateTime> +#include <QList> +#include <QAudioDeviceInfo> +#include <QStringList> +#include <QScopedPointer> +#include <QDir> +#include <QProgressDialog> +#include <QAbstractSocket> +#include <QHostAddress> +#include <QPointer> +#include <QSet> +#include <QVector> +#include <QScrollBar> +#include <QQueue> +#include <QFuture> +#include <QFutureWatcher> +#include <QDateTime> + +#include "MultiGeometryWidget.hpp" +#include "NonInheritingProcess.hpp" +#include "Audio/AudioDevice.hpp" +#include "commons.h" +#include "Radio.hpp" +#include "models/Modes.hpp" +#include "models/FrequencyList.hpp" +#include "Configuration.hpp" +#include "WSPR/WSPRBandHopping.hpp" +#include "Transceiver/Transceiver.hpp" +#include "DisplayManual.hpp" +#include "Network/PSKReporter.hpp" +#include "Network/Cloudlog.hpp" +#include "logbook/logbook.h" +#include "astro.h" +#include "widgets/QSYMessageCreator.h" +#include "widgets/QSYMessage.h" +#include "widgets/qsymonitor.h" +#include "MessageBox.hpp" +#include "Network/NetworkAccessManager.hpp" + +#define NUM_JT4_SYMBOLS 206 //(72+31)*2, embedded sync +#define NUM_JT65_SYMBOLS 126 //63 data + 63 sync +#define NUM_JT9_SYMBOLS 85 //69 data + 16 sync +#define NUM_WSPR_SYMBOLS 162 //(50+31)*2, embedded sync +#define NUM_MSK144_SYMBOLS 144 //s8 + d48 + s8 + d80 +#define NUM_Q65_SYMBOLS 85 //63 data + 22 sync +#define NUM_FT8_SYMBOLS 79 +#define NUM_SUPERFOX_SYMBOLS 153 +#define NUM_FT4_SYMBOLS 105 +#define NUM_FST4_SYMBOLS 160 //240/2 data + 5*8 sync +#define NUM_CW_SYMBOLS 250 +#define MAX_NUM_SYMBOLS 250 +#define TX_SAMPLE_RATE 48000 +#define NRING 3456000 +#define MAX_HOUNDS_IN_QUEUE 10 + +// extern int volatile itone[MAX_NUM_SYMBOLS]; //Audio tones for all Tx symbols +// extern int volatile icw[NUM_CW_SYMBOLS]; //Dits for CW ID + +//--------------------------------------------------------------- MainWindow +namespace Ui { + class MainWindow; +} + +class QProcessEnvironment; +class QSharedMemory; +class QSplashScreen; +class QSettings; +class QLineEdit; +class QFont; +class QHostInfo; +class EchoGraph; +class FastGraph; +class WideGraph; +class LogQSO; +class Transceiver; +class MessageAveraging; +class ActiveStations; +class FoxLogWindow; +class CabrilloLogWindow; +class ColorHighlighting; +class MessageClient; +class QTime; +class WSPRBandHopping; +class HelpTextWindow; +class EQSL; +class WSPRNet; +class SoundOutput; +class Modulator; +class SoundInput; +class Detector; +class SampleDownloader; +class MultiSettings; +class EqualizationToolsDialog; +class DecodedText; +class Cloudlog; + +class MainWindow + : public MultiGeometryWidget<3, QMainWindow> +{ + Q_OBJECT; + +public: + using Frequency = Radio::Frequency; + using FrequencyDelta = Radio::FrequencyDelta; + using Mode = Modes::Mode; + using SpecOp = Configuration::SpecialOperatingActivity; + + explicit MainWindow(QDir const& temp_directory, bool multiple, MultiSettings *, + QSharedMemory *shdmem, unsigned downSampleFactor, + QSplashScreen *, QProcessEnvironment const&, + QWidget *parent = nullptr); + ~MainWindow(); + + int decoderBusy () const {return m_decoderBusy;} + +public slots: + void showSoundInError(const QString& errorMsg); + void showSoundOutError(const QString& errorMsg); + void showStatusMessage(const QString& statusMsg); + void dataSink(qint64 frames); + void fastSink(qint64 frames); + void tci_mod_active(bool on) {m_tci_mod_active = on;} + void diskDat(); + void freezeDecode(int n); + void guiUpdate(); + void doubleClickOnCall (Qt::KeyboardModifiers); + void doubleClickOnCall2(Qt::KeyboardModifiers); + void doubleClickOnFoxQueue(Qt::KeyboardModifiers); + void doubleClickOnFoxInProgress(Qt::KeyboardModifiers modifiers); + void readFromStdout(); + void p1ReadFromStdout(); + void setXIT(int n, Frequency base = 0u); + void setFreq4(int rxFreq, int txFreq); + void msgAvgDecode2(); + void fastPick(int x0, int x1, int y); + void skedFreq(double sf); + +private: + void change_layout (std::size_t) override; + void keyPressEvent (QKeyEvent *) override; + void closeEvent(QCloseEvent *) override; + void childEvent(QChildEvent *) override; + bool eventFilter(QObject *, QEvent *) override; + void showQSYMessage(QString message); + +private slots: + void initialize_fonts (); + void ScrollBarPosition(int n); + void on_actionUse_Dark_Style_triggered (bool checked); + void on_actionBand_Buttons_triggered (); + void on_actionVHF_UHF_Buttons_triggered (); + void on_pb160_clicked(); + void on_pb80_clicked(); + void on_pb60_clicked(); + void on_pb40_clicked(); + void on_pb30_clicked(); + void on_pb20_clicked(); + void on_pb17_clicked(); + void on_pb15_clicked(); + void on_pb12_clicked(); + void on_pb10_clicked(); + void on_pb8_clicked(); + void on_pb6_clicked(); + void on_pb2_clicked(); + void on_pb70_clicked(); + void on_pb50_clicked(); + void on_pb4_clicked(); + void on_pb144_clicked(); + void on_pb220_clicked(); + void on_pb432_clicked(); + void on_pb902_clicked(); + void on_pb23_clicked(); + void on_pb13_clicked(); + void on_pb9_clicked(); + void on_pb5G_clicked(); + void on_pb10G_clicked(); + void on_pb24G_clicked(); + void check_button_color(); + void stopWRTimeout(); + void stopWCTimeout(); + void bandHoppingTimer(); + void bandHopping(); + void on_houndButton_clicked(bool checked); + void on_cbHoldTxFreq_clicked (bool); + void on_ft8Button_clicked(); + void on_ft4Button_clicked(); + void on_msk144Button_clicked(); + void on_q65Button_clicked(); + void on_jt65Button_clicked(); + void on_echoButton_clicked(); + void on_pb15A_clicked(); + void on_pb15C_clicked(); + void on_pb30B_clicked(); + void on_pb60C_clicked(); + void on_pb60D_clicked(); + void on_pb60E_clicked(); + void on_tx1_editingFinished(); + void on_tx2_editingFinished(); + void on_tx3_editingFinished(); + void on_tx4_editingFinished(); + void on_tx5_currentTextChanged (QString const&); + void on_tx6_editingFinished(); + void on_actionSettings_triggered(); + void on_monitorButton_clicked (bool); + void on_actionAbout_triggered(); + void on_autoButton_clicked (bool); + void on_stopTxButton_clicked(); + void on_stopButton_clicked(); + void on_pbBandHopping_clicked(); + void on_actionRelease_Notes_triggered (); + void on_actionFT8_DXpedition_Mode_User_Guide_triggered(); + void on_actionSuperFox_User_Guide_triggered(); + void on_actionQSG_FST4_triggered(); + void on_actionQSG_Q65_triggered(); + void on_actionQSG_X250_M3_triggered(); + void on_actionQuick_Start_Guide_to_WSJT_X_2_7_and_QMAP_triggered(); + void on_actionRecommended_Audio_Settings_triggered(); + void on_actionOnline_User_Guide_triggered(); + void on_actionLocal_User_Guide_triggered(); + void on_actionWide_Waterfall_triggered(); + void on_actionOpen_triggered(); + void on_actionOpen_next_in_directory_triggered(); + void on_actionDecode_remaining_files_in_directory_triggered(); + void on_actionDelete_all_wav_files_in_SaveDir_triggered(); + void on_actionOpen_log_directory_triggered (); + void on_actionNone_triggered(); + void on_actionSave_all_triggered(); + void on_actionDefault_event_logging_triggered(); + void on_actionDiagnostic_mode_triggered(); + void on_actionDisable_event_logging_triggered(); + void on_actionDownload_EME_Ephemeris_Chart_triggered(); + void on_actionKeyboard_shortcuts_triggered(); + void on_actionSpecial_mouse_commands_triggered(); + void on_actionSolve_FreqCal_triggered(); + void on_actionCopyright_Notice_triggered(); + void on_actionSWL_Mode_triggered (bool checked); + void on_DecodeButton_clicked (bool); + void decode(); + void decodeBusy(bool b); + void on_EraseButton_clicked(); + void band_activity_cleared (); + void rx_frequency_activity_cleared (); + void on_txFirstCheckBox_stateChanged(int arg1); + void set_dateTimeQSO(int m_ntx); + void set_ntx(int n); + void on_txrb1_toggled(bool status); + void on_txrb1_doubleClicked (); + void on_txrb2_toggled(bool status); + void on_txrb3_toggled(bool status); + void on_txrb4_toggled(bool status); + void on_txrb4_doubleClicked (); + void on_txrb5_toggled(bool status); + void on_txrb5_doubleClicked (); + void on_txrb6_toggled(bool status); + void on_txb1_clicked(); + void on_txb1_doubleClicked (); + void on_txb2_clicked(); + void on_txb3_clicked(); + void on_txb4_clicked(); + void on_txb4_doubleClicked (); + void on_txb5_clicked(); + void on_txb5_doubleClicked (); + void on_txb6_clicked(); + void on_lookupButton_clicked(); + void on_addButton_clicked(); + void on_ignoreButton_clicked(); + void on_comboBoxCQ_activated (); + void on_DX_Call_Button_clicked (bool checked); + void wheelEvent(QWheelEvent *event) override; + void mousePressEvent(QMouseEvent *event) override; + void on_dxCallEntry_textChanged (QString const&); + void on_dxGridEntry_textChanged (QString const&); + void on_dxCallEntry_editingFinished(); + void on_dxCallEntry_returnPressed (); + void on_genStdMsgsPushButton_clicked(); + void on_logQSOButton_clicked(); + void read_txLog(); + void on_actionErase_Tx_Log_triggered(); + void read_ignoreList(); + void addCallsignToignoreList(); + void on_actionErase_Ignore_List_triggered(); + void read_ALLCALL7(); + void remove_old_files(const QString &directoryPath, int daysOld); + void on_actionJT9_triggered(); + void on_actionJT65_triggered(); + void on_actionJT4_triggered(); + void on_actionFT4_triggered(); + void on_actionFT8_triggered(); + void on_actionFST4_triggered(); + void on_actionFST4W_triggered(); + void on_TxFreqSpinBox_valueChanged(int arg1); + void on_actionSave_decoded_triggered(); + void on_actionQuickDecode_toggled (bool); + void on_actionMediumDecode_toggled (bool); + void on_actionDeepestDecode_toggled (bool); + + //ft8md + void on_actionDecFT8cycles1_triggered(); + void on_actionDecFT8cycles2_triggered(); + void on_actionDecFT8cycles3_triggered(); + void on_actionRXfLow_triggered(); + void on_actionRXfMedium_triggered(); + void on_actionRXfHigh_triggered(); + void on_actionMTAuto_triggered(); + void on_actionMT1_triggered(); + void on_actionMT2_triggered(); + void on_actionMT3_triggered(); + void on_actionMT4_triggered(); + void on_actionMT5_triggered(); + void on_actionMT6_triggered(); + void on_actionMT7_triggered(); + void on_actionMT8_triggered(); + void on_actionMT9_triggered(); + void on_actionMT10_triggered(); + void on_actionMT11_triggered(); + void on_actionMT12_triggered(); + void on_actionFT8SensMin_toggled(bool checked); + void on_actionlowFT8thresholds_toggled(bool checked); + void on_actionFT8subpass_toggled(bool checked); + void on_actionStartTwoStage_toggled(bool checked); + void on_actionStartThreeStage_toggled(bool checked); + void on_actionStartEarly_toggled(bool checked); + void on_actionStartNormal_toggled(bool checked); + void on_actionStartLate_toggled(bool checked); + void on_actionFT8WidebandDXCallSearch_toggled(bool checked); + void on_actionUse_multithreaded_FT8_decoder_triggered(bool checked); + //ft8md + + void bumpFqso(int n); + void on_actionErase_ALL_TXT_triggered(); + void on_reset_cabrillo_log_action_triggered (); + void on_actionErase_wsjtx_log_adi_triggered(); + void on_actionErase_WSPR_hashtable_triggered(); + void on_actionErase_list_of_Q65_callers_triggered(); + void on_actionExport_Cabrillo_log_triggered(); + void startTx2(); + void startP1(); + void stopTx(); + void stopTx2(); + void on_rptSpinBox_valueChanged(int n); + void killFile(); + void on_tuneButton_clicked (bool); + void on_pbR2T_clicked(); + void on_pbT2R_clicked(); + void acceptQSO (QDateTime const&, QString const& call, QString const& grid + , Frequency dial_freq, QString const& mode + , QString const& rpt_sent, QString const& rpt_received + , QString const& tx_power, QString const& comments + , QString const& name, QDateTime const& QSO_date_on, QString const& operator_call + , QString const& my_call, QString const& my_grid + , QString const& exchange_sent, QString const& exchange_rcvd + , QString const& propmode, QString const& satellite + , QString const& sat_mode + , QString const& freqRx, QByteArray const& ADIF); + void on_bandComboBox_currentIndexChanged (int index); + void on_bandComboBox_editTextChanged (QString const& text); + void on_bandComboBox_activated (int index); + void on_readFreq_clicked(); + void on_RxFreqSpinBox_valueChanged(int n); + void on_outAttenuation_valueChanged (int); + void rigOpen (); + void handle_transceiver_update (Transceiver::TransceiverState const&); + void handle_transceiver_failure (QString const& reason); + void handle_leavingSettings(); + void on_actionAstronomical_data_toggled (bool); + void on_actionQSYMessage_Creator_triggered(); + void on_actionQSY_Monitor_triggered(); + void alertQSYmessage(); + void on_actionShort_list_of_add_on_prefixes_and_suffixes_triggered(); + void band_changed (Frequency); + void monitor (bool); + void end_tuning (); + void stop_tuning (); + void stopTuneATU(); + void auto_tx_mode(bool); + void on_actionMessage_averaging_triggered(); + void on_actionActiveStations_triggered(); + void on_contest_log_action_triggered (); + void on_fox_log_action_triggered (); + void on_actionColors_triggered(); + void on_actionInclude_averaging_toggled (bool); + void on_actionInclude_correlation_toggled (bool); + void on_actionEnable_AP_DXcall_toggled (bool); + void on_actionAuto_Clear_Avg_toggled (bool); + void VHF_features_enabled(bool b); + void on_sbSubmode_valueChanged(int n); + void on_cbSendMsg_toggled(bool b); + void on_cbShMsgs_toggled(bool b); + void on_cbSWL_toggled(bool b); + void on_cbTx6_toggled(bool b); + void on_cbMenus_toggled(bool b); + void on_cbCQonly_toggled(bool b); + void on_cbAutoSeq_toggled(bool b); + void networkError (QString const&); + void on_ClrAvgButton_clicked(); + void on_actionWSPR_triggered(); + void on_syncSpinBox_valueChanged(int n); + void on_TxPowerComboBox_currentIndexChanged(int); + void on_sbTxPercent_valueChanged(int n); + void on_cbUploadWSPR_Spots_toggled(bool b); + void WSPR_config(bool b); + void uploadWSPRSpots (bool direct_post = false, QString const& decode_text = QString {}); + void TxAgain(); + void uploadResponse(QString const& response); + void on_WSPRfreqSpinBox_valueChanged(int n); + void on_sbFST4W_RxFreq_valueChanged(int n); + void on_sbFST4W_FTol_valueChanged(int n); + void on_pbTxNext_clicked(bool b); + void on_actionEcho_Graph_triggered(); + void on_actionEcho_triggered(); + void on_actionFast_Graph_triggered(); + void fast_decode_done(); + void on_actionMeasure_reference_spectrum_triggered(); + void on_actionErase_reference_spectrum_triggered(); + void on_actionMeasure_phase_response_triggered(); + void on_sbTR_valueChanged (int); + void on_sbTR_FST4W_valueChanged (int); + void on_sbFtol_valueChanged (int); + void on_cbFast9_clicked(bool b); + void on_sbCQTxFreq_valueChanged(int n); + void on_cbCQTx_toggled(bool b); + void on_actionMSK144_triggered(); + void on_actionQ65_triggered(); + void on_actionFreqCal_triggered(); + void splash_done (); + void on_measure_check_box_stateChanged (int); + void on_sbNlist_valueChanged(int n); + void on_sbNslots_valueChanged(int n); + void on_sbF_Low_valueChanged(int n); + void on_sbF_High_valueChanged(int n); + void chk_FST4_freq_range(); + void on_pbFoxReset_clicked(); + void on_pbFreeText_clicked(); + void FoxReset(QString reason); + void on_comboBoxHoundSort_activated (int index); + void not_GA_warning_message (); + void checkMSK144ContestType(); + void on_pbBestSP_clicked(); + void on_RoundRobin_currentTextChanged(QString text); + void setTxMsg(int n); + bool stdCall(QString const& w); + void remote_configure (QString const& mode, quint32 frequency_tolerance, QString const& submode + , bool fast_mode, quint32 tr_period, quint32 rx_df, QString const& dx_call + , QString const& dx_grid, bool generate_messages); + void callSandP2(int nline); + void refreshHoundQueueDisplay(); + void queueActiveWindowHound2(QString text); + void update_tx5(const QString &qsy_text); + void reply_tx5(const QString &qsy_text); + void setQSYMessageCreatorStatus(const bool &QSYMessageCreatorValue); + void on_rbFixedTone_toggled(bool b); + void on_rbEchoMessage_toggled(bool b); + void on_rbEchoCW_toggled(bool b); + void on_leEchoMessage_textChanged(); + +private: + Q_SIGNAL void initializeAudioOutputStream (QAudioDeviceInfo, + unsigned channels, unsigned msBuffered) const; + Q_SIGNAL void stopAudioOutputStream () const; + Q_SIGNAL void startAudioInputStream (QAudioDeviceInfo const&, + int framesPerBuffer, AudioDevice * sink, + unsigned downSampleFactor, AudioDevice::Channel) const; + Q_SIGNAL void suspendAudioInputStream () const; + Q_SIGNAL void resumeAudioInputStream () const; + Q_SIGNAL void startDetector (AudioDevice::Channel) const; + Q_SIGNAL void FFTSize (unsigned) const; + Q_SIGNAL void detectorClose () const; + Q_SIGNAL void finished () const; + Q_SIGNAL void transmitFrequency (double) const; + Q_SIGNAL void endTransmitMessage (bool quick = false) const; + Q_SIGNAL void tune (bool = true) const; + Q_SIGNAL void sendMessage (QString mode, unsigned symbolsLength, + double framesPerSymbol, double frequency, double toneSpacing, + SoundOutput *, AudioDevice::Channel = AudioDevice::Mono, + bool synchronize = true, bool fastMode = false, double dBSNR = 99., + int TRperiod=60) const; + Q_SIGNAL void outAttenuationChanged (qreal) const; + Q_SIGNAL void toggleShorthand () const; + Q_SIGNAL void reset_audio_input_stream (bool report_dropped_frames) const; + +private: + void set_mode (QString const& mode); + void astroUpdate (); + void writeAllTxt(QString message); + void auto_sequence (DecodedText const& message, unsigned start_tolerance, unsigned stop_tolerance); + void trim_view (bool b); + void foxTest(); + void setColorHighlighting(); + void chkFT4(); + bool elide_tx1_not_allowed () const; + void readWidebandDecodes(); + void configActiveStations(); + void sfox_tx(); + bool play_DXcall = false; + bool play_Wanted = false; + bool inSettings = false; + + QProcessEnvironment const& m_env; + NetworkAccessManager m_network_manager; + bool m_valid; + QSplashScreen * m_splash; + QString m_revision; + bool m_multiple; + MultiSettings * m_multi_settings; + QPushButton * m_configurations_button; + QSettings * m_settings; + QScopedPointer<Ui::MainWindow> ui; + + Configuration m_config; + LogBook m_logBook; // must be after Configuration construction + Cloudlog m_cloudlog; + WSPRBandHopping m_WSPR_band_hopping; + bool m_WSPR_tx_next; + MessageBox m_rigErrorMessageBox; + QScopedPointer<SampleDownloader> m_sampleDownloader; + QScopedPointer<EqualizationToolsDialog> m_equalizationToolsDialog; + + QScopedPointer<WideGraph> m_wideGraph; + QScopedPointer<EchoGraph> m_echoGraph; + QScopedPointer<FastGraph> m_fastGraph; + QScopedPointer<LogQSO> m_logDlg; + QScopedPointer<Astro> m_astroWidget; + QScopedPointer<QSYMessageCreator> m_QSYMessageCreatorWidget; + QScopedPointer<QSYMessage> m_QSYMessageWidget; + QScopedPointer<QSYMonitor> m_qsymonitorWidget; + QScopedPointer<HelpTextWindow> m_shortcuts; + QScopedPointer<HelpTextWindow> m_prefixes; + QScopedPointer<HelpTextWindow> m_mouseCmnds; + QScopedPointer<MessageAveraging> m_msgAvgWidget; + QScopedPointer<ActiveStations> m_ActiveStationsWidget; + QScopedPointer<FoxLogWindow> m_foxLogWindow; + QScopedPointer<CabrilloLogWindow> m_contestLogWindow; + QScopedPointer<ColorHighlighting> m_colorHighlighting; + Transceiver::TransceiverState m_rigState; + Frequency m_lastDialFreq; + QString m_lastBand; + QString m_lastCallsign; + Frequency m_dialFreqRxWSPR; // best guess at WSPR QRG + bool m_QSYMessageCreatorValue = false; + bool m_qsymonitorValue = false; + + Detector * m_detector; + unsigned m_FFTSize; + SoundInput * m_soundInput; + Modulator * m_modulator; + SoundOutput * m_soundOutput; + int m_rx_audio_buffer_frames; + int m_tx_audio_buffer_frames; + QThread m_audioThread; + + qint64 m_msErase; + qint64 m_secBandChanged; + qint64 m_msDecStarted; //ft8md + qint64 m_freqMoon; + qint64 m_fullFoxCallTime; + qint64 m_msEchoTxStart=0; + + Frequency m_freqNominal; + Frequency m_freqNominalPeriod; + Frequency m_freqTxNominal; + quint64 m_msk144basefreq; + quint64 m_msk144oldfreq; + quint64 m_mslastTX; //ft8md + qint32 m_nlasttx; //ft8md + qint32 m_lapmyc; //ft8md + Astro::Correction m_astroCorrection; + bool m_reverse_Doppler; + + double m_tRemaining; + double m_TRperiod; + double m_fSpread; + double m_s6; + double m_fDither; + double m_fAudioShift; + double m_skedFreq; + + float m_DTtol; + float m_t0; + float m_t1; + float m_t0Pick; + float m_t1Pick; + float m_fCPUmskrtd; + float m_tEcho=0; + + qint32 m_waterfallAvg; + qint32 m_ntx; + bool m_gen_message_is_cq; + bool m_send_RR73; + qint32 m_timeout; + qint32 m_XIT; + qint32 m_setftx; + qint32 m_ndepth; + qint32 m_ncandthin; //ft8md + + //ft8md + qint32 m_nFT8Cycles; + qint32 m_nFT8SWLCycles; + qint32 m_nFT8RXfSens; + qint32 m_ft8threads; + qint32 m_ft8Sensitivity; + qint32 m_ft8DecoderStart; + qint32 m_nsecBandChanged; + qint32 m_nFT4depth; + //ft8md + + qint32 m_sec0; + qint32 m_RxLog; + qint32 m_nutc0; + qint32 m_ntr; + qint32 m_tx; + quint64 m_mslastMon; + int m_addtx; + quint32 m_delay; + qint32 m_hsym; + qint32 m_nsps; + qint32 m_hsymStop; + qint32 m_inGain; + qint32 m_ncw; + qint32 m_secID; + qint32 m_idleMinutes; + qint32 m_nSubMode; + qint32 m_nclearave; + qint32 m_minSync; + qint32 m_dBm; + qint32 m_nWSPRdecodes; + qint32 m_k0; + qint32 m_kdone; + qint32 m_nPick; + FrequencyList_v2_101::const_iterator m_frequency_list_fcal_iter; + qint32 m_nTx73; + qint32 m_UTCdisk; + QDateTime m_UTCdiskDateTime; + qint32 m_wait; + qint32 m_isort; + qint32 m_max_dB; + qint32 m_nDXped=0; + qint32 m_nSortedHounds=0; + qint32 m_nHoundsCalling=0; + qint32 m_Nlist=12; + qint32 m_Nslots=5; + qint32 m_Nslots0=0; + qint32 m_nFoxMsgTimes[5]={0,0,0,0,0}; + qint32 m_tAutoOn; + qint32 m_tFoxTx=0; + qint32 m_tFoxTx0=0; + qint32 m_maxStrikes=3; //Max # of repeats: 3 strikes and you're out + qint32 m_maxFoxWait=3; //Max wait time for expected Hound replies + qint32 m_foxCQtime=10; //CQs at least every 5 minutes + qint32 m_tFoxTxSinceCQ=999; //Fox Tx cycles since most recent CQ + qint32 m_nFoxFreq; //Audio freq at which Hound received a call from Fox + qint32 m_nSentFoxRrpt=0; //Serial number for next R+rpt Hound will send to Fox + qint32 m_kin0=0; + qint32 m_earlyDecode=41; + qint32 m_earlyDecode2=47; + qint32 m_nDecodes=0; + qint32 m_maxPoints=-1; + qint32 m_latestDecodeTime=-1; + qint32 m_points=-99; + qint32 m_score=0; + qint32 m_fDop=0; + qint32 m_echoSec0=0; + qint32 m_fetched=0; + qint32 m_position; + + bool m_btxok; //True if OK to transmit + bool m_diskData; + bool m_loopall; + bool m_decoderBusy; + bool m_txFirst; + bool m_auto; + bool m_restart; + bool m_startAnother; + + // start ft8md + bool m_FT8EarlyStart; + bool m_FT8WideDxCallSearch; + bool m_skipTx1; + bool m_swl; + bool m_filter; + bool m_agcc; + bool m_hint; + bool m_multithreadFT8; + bool m_houndMode; + bool m_commonFT8b; + bool m_manualDecode; + bool m_modeChanged; + bool m_bMyCallStd; + bool m_bHisCallStd; + bool m_multInst; + bool m_bandChanged; + bool m_lasthint; + // end ft8md + + bool m_saveDecoded; + bool m_saveAll; + bool m_widebandDecode; + bool m_call3Modified; + bool m_dataAvailable; + bool m_bDecoded; + bool m_noSuffix; + bool m_decodedText2; + bool m_sentFirst73; + bool m_tci_mod_active; + bool m_tci; + bool m_tci_audio; + int m_currentMessageType; + QString m_currentMessage; + int m_lastMessageType; + QString m_lastMessageSent; + QString m_tBlankLine; + bool m_bShMsgs; + bool m_bSWL; + bool m_uploadWSPRSpots; + bool m_uploading; + bool m_grid6; + bool m_tuneup; + bool m_bTxTime; + bool m_rxDone; + bool m_bSimplex; // not using split even if it is available + bool m_bEchoTxOK; + bool m_bTransmittedEcho; + bool m_bEchoTxed; + bool m_bFastMode; + bool m_bFast9; + bool m_bFastDecodeCalled; + bool m_bDoubleClickAfterCQnnn; + bool m_bRefSpec; + bool m_bClearRefSpec; + bool m_bTrain; + bool m_bUseRef; + bool m_bFastDone; + bool m_bAltV; + bool m_bNoMoreFiles; + bool m_bDoubleClicked; + bool m_bCallingCQ; + bool m_bAutoReply; + QString m_lastloggedcall; //ft8md + bool m_bCheckedContest; + bool m_bWarnedSplit=false; + bool m_bTUmsg; + bool m_bBestSPArmed=false; + bool m_bOK_to_chk=false; + bool m_bSentReport=false; + bool m_discard_decoded_hounds_this_cycle=false; // if something changes, like frequency, discard decoded messages that may be in-flight. + + SpecOp m_specOp; + + enum + { + CALLING, + REPLYING, + REPORT, + ROGER_REPORT, + ROGERS, + SIGNOFF + } + m_QSOProgress; //State machine counter + + enum {CALL, GRID, DXCC, MULT}; + + int m_ihsym; + int m_nzap; + int m_npts8; + float m_px; + float m_pxmax; + float m_df3; + int m_iptt0; + bool m_btxok0; + int m_nsendingsh; + double m_onAirFreq0; + bool m_first_error; + + char m_msg[100][80]; + + // labels in status bar + QLabel tx_status_label; + QLabel config_label; + QLabel mode_label; + QLabel last_tx_label; + QLabel auto_tx_label; + QLabel band_hopping_label; + QLabel ndecodes_label; + QProgressBar progressBar; + QLabel watchdog_label; + + QFuture<void> m_wav_future; + QFutureWatcher<void> m_wav_future_watcher; + QFutureWatcher<void> watcher3; + QFutureWatcher<QString> m_saveWAVWatcher; + + NonInheritingProcess proc_jt9; + NonInheritingProcess p1; + NonInheritingProcess p3; + + QProcess p2; + QProcess p4; + + WSPRNet *wsprNet; + EQSL *Eqsl; + + QTimer m_guiTimer; + QTimer stopWRTimer; //Wait & Reply + QTimer stopWCTimer; //Wait & Call + QTimer ptt1Timer; //StartTx delay + QTimer ptt0Timer; //StopTx delay + QTimer logQSOTimer; + QTimer killFileTimer; + QTimer tuneButtonTimer; + QTimer uploadTimer; + QTimer tuneATU_Timer; + QTimer TxAgainTimer; + QTimer minuteTimer; + QTimer splashTimer; + QTimer p1Timer; + + QString m_path; + QString m_baseCall; + QString m_hisCall; + QString m_hisGrid; + QString m_appDir; + QString m_cqStr; + QString m_palette; + QString m_dateTime; + QString m_mode; + QString m_modeTx;//ft8md + QString m_fnameWE; // save path without extension + QString m_rpt; + QString m_nextRpt; + QString m_rptSent; + QString m_rptRcvd; + QString m_qsoStart; + QString m_qsoStop; + QStringList m_cmndP1; + QString m_msgSent0; + QString m_calls; + QString m_CQtype; + QString m_opCall; + QString m_houndCallers; //Sorted list of Hound callers + QString m_fm0; + QString m_fm1; + QString m_xSent; //Contest exchange sent + QString m_xRcvd; //Contest exchange received + QString m_currentBand; + QString m_currentBandPeriod; + QString m_nextCall; + QString m_nextGrid; + QString m_fileDateTime; + QString m_inQSOwith; + QString m_BestCQpriority; + QString m_deCall; + QString m_deGrid; + QString m_freeTextMsg; + QString m_freeTextMsg0; + QString m_ready2call[50]; + QString m_callers[50]; + + QSet<QString> m_pfx; + QSet<QString> m_sfx; + + struct FoxQSO //Everything we need to know about QSOs in progress (or recently logged). + { + QString grid; //Hound's declared locator + QString sent; //Report sent to Hound + QString rcvd; //Report received from Hound + qint32 ncall; //Number of times report sent to Hound + qint32 nRR73; //Number of times RR73 sent to Hound + qint32 tFoxRrpt; //m_tFoxTx (Fox Tx cycle counter) when R+rpt was received from Hound + qint32 tFoxTxRR73; //m_tFoxTx when RR73 was sent to Hound + }; + + QMap<QString,FoxQSO> m_foxQSO; //Key = HoundCall, value = parameters for QSO in progress + QMap<QString,QString> m_loggedByFox; //Key = HoundCall, value = logged band + QMap<QString,qint32> m_annotated_callsigns; //Key = HoundCall, value = provided by api call + + struct FixupQSO //Info for fixing Fox's log from file "FoxQSO.txt" + { + QString grid; //Hound's declared locator + QString sent; //Report sent to Hound + QString rcvd; //Report received from Hound + QDateTime QSO_time; + }; + QMap<QString,FixupQSO> m_fixupQSO; //Key = HoundCall, value = info for QSO in progress + + struct ActiveCall + { + QString grid4; + QString bands; + qint32 az; + qint32 points; + }; + QMap<QString,ActiveCall> m_activeCall; //Key = callsign, value = grid4, az, points for ARRL_DIGI + + struct EMECall + { + QString grid4; + double frx; + double fsked; + qint32 nsnr; + qint32 t; + bool worked; + bool ready2call; + QString submode; + }; + QMap<QString,EMECall> m_EMECall; + + QMap<QString,bool> m_EMEworked; + + struct RecentCall + { + qint64 dialFreq; + qint32 audioFreq; + qint32 snr; + qint32 decodeTime; + bool txEven; + bool ready2call; + }; + QMap<QString,RecentCall> m_recentCall; //Key = callsign, value = snr, dialFreq, audioFreq, decodeTime + struct ARRL_logged + { + QDateTime time; + QString band; + qint32 points; + }; + QList<ARRL_logged> m_arrl_log; + + QQueue<QString> m_houndQueue; //Selected Hounds available for starting a QSO + QQueue<QString> m_foxQSOinProgress; //QSOs in progress: Fox has sent a report + QQueue<qint64> m_foxRateQueue; + + QDateTime m_dateTimeQSOOn; + QDateTime m_dateTimeLastTX; + QDateTime m_dateTimeSentTx3; + QDateTime m_dateTimeRcvdRR73; + QDateTime m_dateTimeBestSP; + QDateTime m_dateTimeSeqStart; //Nominal start time of Rx sequence about to be decoded + + QSharedMemory *mem_jt9; + QString m_QSOText; + unsigned m_downSampleFactor; + QThread::Priority m_audioThreadPriority; + bool m_bandEdited; + bool m_splitMode; + bool m_monitoring=false; + bool m_echoRunning=false; + bool m_tx_when_ready; + bool m_transmitting; + bool m_tune; + bool m_tx_watchdog; // true when watchdog triggered + bool m_block_pwr_tooltip; + bool m_PwrBandSetOK; + bool m_bDisplayedOnce; + Frequency m_lastMonitoredFrequency; + double m_toneSpacing; + int m_firstDecode; + QProgressDialog m_optimizingProgress; + QTimer m_heartbeat; + MessageClient * m_messageClient; + PSKReporter m_psk_Reporter; + DisplayManual m_manual; + QHash<QString, QVariant> m_pwrBandTxMemory; // Remembers power level by band + QHash<QString, QVariant> m_pwrBandTuneMemory; // Remembers power level by band for tuning + QByteArray m_geometryNoControls; + QVector<double> m_phaseEqCoefficients; + bool m_block_udp_status_updates; + bool m_useDarkStyle; + + //---------------------------------------------------- private functions + void readSettings(); + void set_application_font (QFont const&); + void setDecodedTextFont (QFont const&); + void writeSettings(); + void createStatusBar(); + void updateStatusBar(); + void genStdMsgs(QString rpt, bool unconditional = false); + void genCQMsg(); + void clearDX (); + void lookup(); + void ba2msg(QByteArray ba, char* message); + void msgtype(QString t, QLineEdit* tx); + void stub(); + void statusChanged(); + void fixStop(); + bool shortList(QString callsign) const; + void transmit (double snr = 99.); + void rigFailure (QString const& reason); + void pskSetLocal (); + void pskPost(DecodedText const& decodedtext); + void displayDialFrequency (); + void transmitDisplay (bool); + void processMessage(DecodedText const& message, Qt::KeyboardModifiers = Qt::NoModifier); + void replyToCQ (QTime, qint32 snr, float delta_time, quint32 delta_frequency, QString const& mode, QString const& message_text, bool low_confidence, quint8 modifiers); + void locationChange(QString const& location); + void replayDecodes (); + void postDecode (bool is_new, QString const& message); + void postWSPRDecode (bool is_new, QStringList message_parts); + void enable_DXCC_entity (bool on); + void switch_mode (Mode); + void WSPR_scheduling (); + void freqCalStep(); + void setRig (Frequency = 0); // zero frequency means no change + void WSPR_history(Frequency dialFreq, int ndecodes); + QString beacon_start_time (int n = 0); + QString WSPR_message(); + void fast_config(bool b); + void CQTxFreq(); + void useNextCall(); + void abortQSO(); + void updateRate(); + void write_all(QString txRx, QString message); + bool isWorked(int itype, QString key, float fMHz=0, QString=""); + + QString save_wave_file (QString const& name + , short const * data + , int samples + , QString const& my_callsign + , QString const& my_grid + , QString const& mode + , qint32 sub_mode + , Frequency frequency + , QString const& his_call + , QString const& his_grid) const; + void hound_reply (); + QString sortHoundCalls(QString t, int isort, int max_dB); + void rm_tb4(QString houndCall); + void read_wav_file (QString const& fname); + void decodeDone (); + bool subProcessFailed (QProcess *, int exit_code, QProcess::ExitStatus); + void subProcessError (QProcess *, QProcess::ProcessError); + void statusUpdate () const; + void update_watchdog_label (); + void invalidate_frequencies_filter (); + void on_the_minute (); + void add_child_to_event_filter (QObject *); + void remove_child_from_event_filter (QObject *); + void setup_status_bar (bool vhf); + void tx_watchdog (bool triggered); + qint64 nWidgets(QString t); + void displayWidgets(qint64 n); + QChar current_submode () const; // returns QChar {0} if submode is not appropriate + void write_transmit_entry (QString const& file_name); + void selectHound(QString t, bool bTopQueue); + void removeHoundFromCallingList(QString callsign); + void houndCallers(); + void updateFoxQSOsInProgressDisplay(); + void foxQueueTopCallCommand(); + void foxRxSequencer(QString msg, QString houndCall, QString rptRcvd); + void foxTxSequencer(); + void foxGenWaveform(int i,QString fm); + void writeFoxQSO (QString const& msg); + void update_foxLogWindow_rate(); + void to_jt9(qint32 n, qint32 istart, qint32 idone); + bool is77BitMode () const; + void cease_auto_Tx_after_QSO (); + Q_SLOT void ARRL_Digi_Display(); + void ARRL_Digi_Update(DecodedText dt); + void activeWorked(QString call, QString band); + void read_log(); + void refreshPileupList(); + QString userAgent(); + void handleVerifyMsg(int status, QDateTime ts, QString callsign, QString code, unsigned int hz, QString const &response); + void writeFoxTxMsgs(); +#ifdef FOX_OTP + QString foxOTPcode(); +#endif +}; + +extern int killbyname(const char* progName); +extern void getDev(int* numDevices,char hostAPI_DeviceName[][50], + int minChan[], int maxChan[], + int minSpeed[], int maxSpeed[]); +extern int next_tx_state(int pctx); + +#endif // MAINWINDOW_H diff --git a/widgets/mainwindow.ui b/widgets/mainwindow.ui index f7e87dc8..d9d83bac 100755..100644 --- a/widgets/mainwindow.ui +++ b/widgets/mainwindow.ui @@ -1,6238 +1,6251 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>MainWindow</class>
- <widget class="QMainWindow" name="MainWindow">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>880</width>
- <height>685</height>
- </rect>
- </property>
- <property name="minimumSize">
- <size>
- <width>750</width>
- <height>0</height>
- </size>
- </property>
- <property name="windowTitle">
- <string>WSJT-X by K1JT</string>
- </property>
- <property name="toolTip">
- <string/>
- </property>
- <property name="styleSheet">
- <string notr="true"/>
- </property>
- <widget class="QWidget" name="centralWidget">
- <layout class="QVBoxLayout" name="verticalLayout_6" stretch="0,0">
- <item>
- <widget class="QSplitter" name="decodes_splitter">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <widget class="QWidget" name="layoutWidget">
- <layout class="QVBoxLayout" name="verticalLayout_3">
- <item>
- <widget class="QLabel" name="lh_decodes_title_label">
- <property name="maximumSize">
- <size>
- <width>500</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="font">
- <font>
- <pointsize>10</pointsize>
- <bold>false</bold>
- </font>
- </property>
- <property name="text">
- <string>Band Activity</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="lh_decodes_headings_label">
- <property name="minimumSize">
- <size>
- <width>300</width>
- <height>20</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>20</height>
- </size>
- </property>
- <property name="palette">
- <palette>
- <active>
- <colorrole role="Base">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>252</red>
- <green>252</green>
- <blue>252</blue>
- </color>
- </brush>
- </colorrole>
- <colorrole role="Window">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>170</red>
- <green>170</green>
- <blue>170</blue>
- </color>
- </brush>
- </colorrole>
- </active>
- <inactive>
- <colorrole role="Base">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>252</red>
- <green>252</green>
- <blue>252</blue>
- </color>
- </brush>
- </colorrole>
- <colorrole role="Window">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>170</red>
- <green>170</green>
- <blue>170</blue>
- </color>
- </brush>
- </colorrole>
- </inactive>
- <disabled>
- <colorrole role="Base">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>170</red>
- <green>170</green>
- <blue>170</blue>
- </color>
- </brush>
- </colorrole>
- <colorrole role="Window">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>170</red>
- <green>170</green>
- <blue>170</blue>
- </color>
- </brush>
- </colorrole>
- </disabled>
- </palette>
- </property>
- <property name="autoFillBackground">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>UTC dB DT Freq Dr </string>
- </property>
- <property name="textFormat">
- <enum>Qt::PlainText</enum>
- </property>
- <property name="indent">
- <number>5</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="DisplayText" name="decodedTextBrowser">
- <property name="frameShape">
- <enum>QFrame::StyledPanel</enum>
- </property>
- <property name="verticalScrollBarPolicy">
- <enum>Qt::ScrollBarAlwaysOn</enum>
- </property>
- <property name="horizontalScrollBarPolicy">
- <enum>Qt::ScrollBarAsNeeded</enum>
- </property>
- <property name="cursorWidth">
- <number>0</number>
- </property>
- <property name="textInteractionFlags">
- <set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="rh_decodes_widget" native="true">
- <layout class="QVBoxLayout" name="verticalLayout_9">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
- <number>0</number>
- </property>
- <item>
- <widget class="QLabel" name="rh_decodes_title_label">
- <property name="font">
- <font>
- <pointsize>10</pointsize>
- <bold>false</bold>
- </font>
- </property>
- <property name="text">
- <string>Rx Frequency</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="rh_decodes_headings_label">
- <property name="minimumSize">
- <size>
- <width>300</width>
- <height>20</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>20</height>
- </size>
- </property>
- <property name="palette">
- <palette>
- <active>
- <colorrole role="Base">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>252</red>
- <green>252</green>
- <blue>252</blue>
- </color>
- </brush>
- </colorrole>
- <colorrole role="Window">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>170</red>
- <green>170</green>
- <blue>170</blue>
- </color>
- </brush>
- </colorrole>
- </active>
- <inactive>
- <colorrole role="Base">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>252</red>
- <green>252</green>
- <blue>252</blue>
- </color>
- </brush>
- </colorrole>
- <colorrole role="Window">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>170</red>
- <green>170</green>
- <blue>170</blue>
- </color>
- </brush>
- </colorrole>
- </inactive>
- <disabled>
- <colorrole role="Base">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>170</red>
- <green>170</green>
- <blue>170</blue>
- </color>
- </brush>
- </colorrole>
- <colorrole role="Window">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>170</red>
- <green>170</green>
- <blue>170</blue>
- </color>
- </brush>
- </colorrole>
- </disabled>
- </palette>
- </property>
- <property name="autoFillBackground">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>UTC dB DT Freq Dr </string>
- </property>
- <property name="textFormat">
- <enum>Qt::PlainText</enum>
- </property>
- <property name="indent">
- <number>5</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="DisplayText" name="decodedTextBrowser2">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="verticalScrollBarPolicy">
- <enum>Qt::ScrollBarAlwaysOn</enum>
- </property>
- <property name="cursorWidth">
- <number>0</number>
- </property>
- <property name="textInteractionFlags">
- <set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- <item>
- <widget class="QWidget" name="lower_panel_widget" native="true">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_4">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
- <number>0</number>
- </property>
- <item>
- <layout class="QGridLayout" name="Band_buttons_Layout">
- <property name="spacing">
- <number>3</number>
- </property>
- <item row="0" column="3">
- <widget class="QPushButton" name="pb40">
- <property name="minimumSize">
- <size>
- <width>20</width>
- <height>0</height>
- </size>
- </property>
- <property name="focusPolicy">
- <enum>Qt::StrongFocus</enum>
- </property>
- <property name="text">
- <string>40</string>
- </property>
- </widget>
- </item>
- <item row="0" column="9">
- <widget class="QPushButton" name="pb10">
- <property name="minimumSize">
- <size>
- <width>20</width>
- <height>0</height>
- </size>
- </property>
- <property name="focusPolicy">
- <enum>Qt::StrongFocus</enum>
- </property>
- <property name="text">
- <string>10</string>
- </property>
- </widget>
- </item>
- <item row="0" column="6">
- <widget class="QPushButton" name="pb17">
- <property name="minimumSize">
- <size>
- <width>20</width>
- <height>0</height>
- </size>
- </property>
- <property name="focusPolicy">
- <enum>Qt::StrongFocus</enum>
- </property>
- <property name="text">
- <string>17</string>
- </property>
- </widget>
- </item>
- <item row="0" column="2">
- <widget class="QPushButton" name="pb60">
- <property name="minimumSize">
- <size>
- <width>20</width>
- <height>0</height>
- </size>
- </property>
- <property name="text">
- <string>60</string>
- </property>
- </widget>
- </item>
- <item row="0" column="8">
- <widget class="QPushButton" name="pb12">
- <property name="minimumSize">
- <size>
- <width>20</width>
- <height>0</height>
- </size>
- </property>
- <property name="focusPolicy">
- <enum>Qt::StrongFocus</enum>
- </property>
- <property name="text">
- <string>12</string>
- </property>
- </widget>
- </item>
- <item row="0" column="0">
- <widget class="QPushButton" name="pb160">
- <property name="minimumSize">
- <size>
- <width>25</width>
- <height>0</height>
- </size>
- </property>
- <property name="text">
- <string>160</string>
- </property>
- </widget>
- </item>
- <item row="0" column="5">
- <widget class="QPushButton" name="pb20">
- <property name="minimumSize">
- <size>
- <width>20</width>
- <height>0</height>
- </size>
- </property>
- <property name="focusPolicy">
- <enum>Qt::StrongFocus</enum>
- </property>
- <property name="text">
- <string>20</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QPushButton" name="pb80">
- <property name="minimumSize">
- <size>
- <width>20</width>
- <height>0</height>
- </size>
- </property>
- <property name="focusPolicy">
- <enum>Qt::StrongFocus</enum>
- </property>
- <property name="text">
- <string>80</string>
- </property>
- </widget>
- </item>
- <item row="0" column="13">
- <widget class="QPushButton" name="pb70">
- <property name="minimumSize">
- <size>
- <width>20</width>
- <height>0</height>
- </size>
- </property>
- <property name="focusPolicy">
- <enum>Qt::StrongFocus</enum>
- </property>
- <property name="text">
- <string>70</string>
- </property>
- </widget>
- </item>
- <item row="0" column="7">
- <widget class="QPushButton" name="pb15">
- <property name="minimumSize">
- <size>
- <width>20</width>
- <height>0</height>
- </size>
- </property>
- <property name="focusPolicy">
- <enum>Qt::StrongFocus</enum>
- </property>
- <property name="text">
- <string>15</string>
- </property>
- </widget>
- </item>
- <item row="0" column="11">
- <widget class="QPushButton" name="pb2">
- <property name="minimumSize">
- <size>
- <width>15</width>
- <height>0</height>
- </size>
- </property>
- <property name="focusPolicy">
- <enum>Qt::StrongFocus</enum>
- </property>
- <property name="text">
- <string>2</string>
- </property>
- </widget>
- </item>
- <item row="0" column="4">
- <widget class="QPushButton" name="pb30">
- <property name="minimumSize">
- <size>
- <width>20</width>
- <height>0</height>
- </size>
- </property>
- <property name="focusPolicy">
- <enum>Qt::StrongFocus</enum>
- </property>
- <property name="text">
- <string>30</string>
- </property>
- </widget>
- </item>
- <item row="0" column="10">
- <widget class="QPushButton" name="pb6">
- <property name="minimumSize">
- <size>
- <width>15</width>
- <height>0</height>
- </size>
- </property>
- <property name="focusPolicy">
- <enum>Qt::StrongFocus</enum>
- </property>
- <property name="text">
- <string>6</string>
- </property>
- </widget>
- </item>
- <item row="1" column="13">
- <widget class="QPushButton" name="pb24G">
- <property name="minimumSize">
- <size>
- <width>25</width>
- <height>0</height>
- </size>
- </property>
- <property name="text">
- <string>24G</string>
- </property>
- </widget>
- </item>
- <item row="1" column="11">
- <widget class="QPushButton" name="pb10G">
- <property name="minimumSize">
- <size>
- <width>25</width>
- <height>0</height>
- </size>
- </property>
- <property name="text">
- <string>10G</string>
- </property>
- </widget>
- </item>
- <item row="1" column="10">
- <widget class="QPushButton" name="pb5G">
- <property name="minimumSize">
- <size>
- <width>25</width>
- <height>0</height>
- </size>
- </property>
- <property name="text">
- <string>5G</string>
- </property>
- </widget>
- </item>
- <item row="1" column="9">
- <widget class="QPushButton" name="pb9">
- <property name="minimumSize">
- <size>
- <width>25</width>
- <height>0</height>
- </size>
- </property>
- <property name="text">
- <string>9</string>
- </property>
- </widget>
- </item>
- <item row="1" column="8">
- <widget class="QPushButton" name="pb13">
- <property name="minimumSize">
- <size>
- <width>25</width>
- <height>0</height>
- </size>
- </property>
- <property name="text">
- <string>13</string>
- </property>
- </widget>
- </item>
- <item row="1" column="7">
- <widget class="QPushButton" name="pb23">
- <property name="minimumSize">
- <size>
- <width>25</width>
- <height>0</height>
- </size>
- </property>
- <property name="text">
- <string>23</string>
- </property>
- </widget>
- </item>
- <item row="1" column="6">
- <widget class="QPushButton" name="pb902">
- <property name="minimumSize">
- <size>
- <width>25</width>
- <height>0</height>
- </size>
- </property>
- <property name="text">
- <string>33</string>
- </property>
- </widget>
- </item>
- <item row="1" column="5">
- <widget class="QPushButton" name="pb432">
- <property name="minimumSize">
- <size>
- <width>25</width>
- <height>0</height>
- </size>
- </property>
- <property name="text">
- <string>70</string>
- </property>
- </widget>
- </item>
- <item row="1" column="4">
- <widget class="QPushButton" name="pb220">
- <property name="minimumSize">
- <size>
- <width>25</width>
- <height>0</height>
- </size>
- </property>
- <property name="text">
- <string>1.25</string>
- </property>
- </widget>
- </item>
- <item row="1" column="3">
- <widget class="QPushButton" name="pb144">
- <property name="minimumSize">
- <size>
- <width>25</width>
- <height>0</height>
- </size>
- </property>
- <property name="text">
- <string>2</string>
- </property>
- </widget>
- </item>
- <item row="1" column="2">
- <widget class="QPushButton" name="pb4">
- <property name="minimumSize">
- <size>
- <width>25</width>
- <height>0</height>
- </size>
- </property>
- <property name="text">
- <string>4</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QPushButton" name="pb50">
- <property name="minimumSize">
- <size>
- <width>25</width>
- <height>0</height>
- </size>
- </property>
- <property name="text">
- <string>6</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QPushButton" name="pb8">
- <property name="minimumSize">
- <size>
- <width>25</width>
- <height>0</height>
- </size>
- </property>
- <property name="text">
- <string>8</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,0,2,2,2,2,2,0,2,2,2,2,1">
- <item>
- <widget class="QCheckBox" name="cbCQonly">
- <property name="toolTip">
- <string>CQ messages only.</string>
- </property>
- <property name="text">
- <string>CQ only</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="cbBypass">
- <property name="toolTip">
- <string>Bypass Filters toggled via Settings or the Filters menu.</string>
- </property>
- <property name="text">
- <string>BP</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="logQSOButton">
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>0</height>
- </size>
- </property>
- <property name="toolTip">
- <string>Enter this QSO in log</string>
- </property>
- <property name="text">
- <string>Log &QSO</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="stopButton">
- <property name="minimumSize">
- <size>
- <width>50</width>
- <height>0</height>
- </size>
- </property>
- <property name="toolTip">
- <string>Stop monitoring</string>
- </property>
- <property name="text">
- <string>&Stop</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="monitorButton">
- <property name="minimumSize">
- <size>
- <width>50</width>
- <height>0</height>
- </size>
- </property>
- <property name="toolTip">
- <string><html><head/><body><p>Toggle monitoring On/Off. <br>Yellow when saving .wav files.</p></body></html></string>
- </property>
- <property name="styleSheet">
- <string notr="true">QPushButton:checked {
- color: #000000;
- background-color: #00ff00;
- border-style: outset;
- border-width: 1px;
- border-radius: 5px;
- border-color: black;
- min-width: 5em;
- padding: 3px;
-}</string>
- </property>
- <property name="text">
- <string>&Monitor</string>
- </property>
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="checked">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="EraseButton">
- <property name="minimumSize">
- <size>
- <width>50</width>
- <height>0</height>
- </size>
- </property>
- <property name="toolTip">
- <string><html><head/><body><p>Erase right window. Double-click to erase both windows.</p></body></html></string>
- </property>
- <property name="accessibleDescription">
- <string>Erase right window. Double-click to erase both windows.</string>
- </property>
- <property name="text">
- <string>&Erase</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="ClrAvgButton">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>0</height>
- </size>
- </property>
- <property name="toolTip">
- <string><html><head/><body><p>Clear the accumulating message average.</p></body></html></string>
- </property>
- <property name="accessibleDescription">
- <string>Clear the accumulating message average.</string>
- </property>
- <property name="text">
- <string>Clear Avg</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="HintedSpinBox" name="sbEchoAvg">
- <property name="prefix">
- <string>Avg </string>
- </property>
- <property name="minimum">
- <number>1</number>
- </property>
- <property name="maximum">
- <number>100</number>
- </property>
- <property name="value">
- <number>10</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="DecodeButton">
- <property name="minimumSize">
- <size>
- <width>50</width>
- <height>0</height>
- </size>
- </property>
- <property name="focusPolicy">
- <enum>Qt::StrongFocus</enum>
- </property>
- <property name="toolTip">
- <string><html><head/><body><p>Decode most recent Rx period at QSO Frequency</p></body></html></string>
- </property>
- <property name="accessibleDescription">
- <string>Decode most recent Rx period at QSO Frequency</string>
- </property>
- <property name="styleSheet">
- <string notr="true">QPushButton:checked {
- color: rgb(0, 0, 0);
- background-color: cyan;
- border-style: outset;
- border-width: 1px;
- border-radius: 5px;
- border-color: black;
- min-width: 5em;
- padding: 3px;
-}</string>
- </property>
- <property name="text">
- <string>&Decode</string>
- </property>
- <property name="checkable">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="autoButton">
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>0</height>
- </size>
- </property>
- <property name="focusPolicy">
- <enum>Qt::StrongFocus</enum>
- </property>
- <property name="toolTip">
- <string><html><head/><body><p>Toggle Auto-Tx On/Off</p></body></html></string>
- </property>
- <property name="accessibleDescription">
- <string>Toggle Auto-Tx On/Off</string>
- </property>
- <property name="styleSheet">
- <string notr="true">QPushButton:checked {
- color: white;
- background-color: red;
- border-style: outset;
- border-width: 1px;
- border-radius: 5px;
- border-color: black;
- min-width: 5em;
- padding: 3px;
-}</string>
- </property>
- <property name="text">
- <string>E&nable Tx</string>
- </property>
- <property name="checkable">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="stopTxButton">
- <property name="minimumSize">
- <size>
- <width>50</width>
- <height>0</height>
- </size>
- </property>
- <property name="toolTip">
- <string>Stop transmitting immediately</string>
- </property>
- <property name="text">
- <string>&Halt Tx</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="tuneButton">
- <property name="minimumSize">
- <size>
- <width>50</width>
- <height>0</height>
- </size>
- </property>
- <property name="focusPolicy">
- <enum>Qt::StrongFocus</enum>
- </property>
- <property name="toolTip">
- <string><html><head/><body><p>Toggle a pure Tx tone On/Off <br>Right-click to tune rig</p></body></html></string>
- </property>
- <property name="accessibleDescription">
- <string>Toggle a pure Tx tone On/Off</string>
- </property>
- <property name="styleSheet">
- <string notr="true">QPushButton:checked {
- color: white;
- background-color: red;
- border-style: outset;
- border-width: 1px;
- border-radius: 5px;
- border-color: black;
- min-width: 5em;
- padding: 3px;
-}</string>
- </property>
- <property name="text">
- <string>&Tune</string>
- </property>
- <property name="checkable">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="cbMenus">
- <property name="text">
- <string>Menus</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QGridLayout" name="gridLayout_5" rowstretch="1,0,0" columnstretch="0,0,0,0,1,1,5,0">
- <item row="1" column="4" colspan="2">
- <widget class="QWidget" name="DX_controls_widget" native="true">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>114</width>
- <height>0</height>
- </size>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_110">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
- <number>1</number>
- </property>
- <item>
- <layout class="QGridLayout" name="DXCall_gridLayout" columnstretch="3,2">
- <item row="0" column="0">
- <widget class="QPushButton" name="DX_Call_Button">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>0</height>
- </size>
- </property>
- <property name="focusPolicy">
- <enum>Qt::StrongFocus</enum>
- </property>
- <property name="toolTip">
- <string><html><head/><body><p>Toggle Wait &amp; Call On/Off. Right-click to clear the DX Call box.</p></body></html></string>
- </property>
- <property name="styleSheet">
- <string notr="true">QPushButton {
- background-color: #9fafd5;
- border: none;
-}</string>
- </property>
- <property name="text">
- <string>DX Call</string>
- </property>
- <property name="checkable">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLineEdit" name="dxCallEntry">
- <property name="toolTip">
- <string>Callsign of station to be worked</string>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QLabel" name="label_4">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="palette">
- <palette>
- <active>
- <colorrole role="Base">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>252</red>
- <green>252</green>
- <blue>252</blue>
- </color>
- </brush>
- </colorrole>
- <colorrole role="Window">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>159</red>
- <green>175</green>
- <blue>213</blue>
- </color>
- </brush>
- </colorrole>
- </active>
- <inactive>
- <colorrole role="Base">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>252</red>
- <green>252</green>
- <blue>252</blue>
- </color>
- </brush>
- </colorrole>
- <colorrole role="Window">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>159</red>
- <green>175</green>
- <blue>213</blue>
- </color>
- </brush>
- </colorrole>
- </inactive>
- <disabled>
- <colorrole role="Base">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>159</red>
- <green>175</green>
- <blue>213</blue>
- </color>
- </brush>
- </colorrole>
- <colorrole role="Window">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>159</red>
- <green>175</green>
- <blue>213</blue>
- </color>
- </brush>
- </colorrole>
- </disabled>
- </palette>
- </property>
- <property name="autoFillBackground">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>DX Grid</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <property name="margin">
- <number>5</number>
- </property>
- <property name="indent">
- <number>2</number>
- </property>
- <property name="buddy">
- <cstring>dxGridEntry</cstring>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QLineEdit" name="dxGridEntry">
- <property name="toolTip">
- <string>Locator of station to be worked</string>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QLabel" name="labAz">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="autoFillBackground">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Az: 251 16553 km</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <property name="indent">
- <number>4</number>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" name="lookup_control_layout">
- <property name="spacing">
- <number>3</number>
- </property>
- <item>
- <widget class="QPushButton" name="lookupButton">
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>0</height>
- </size>
- </property>
- <property name="focusPolicy">
- <enum>Qt::StrongFocus</enum>
- </property>
- <property name="toolTip">
- <string><html><head/><body><p>Search for callsign in database. <br>Right-click searches for callsign on QRZ.com.</p></body></html></string>
- </property>
- <property name="text">
- <string>&Lookup</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="addButton">
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>0</height>
- </size>
- </property>
- <property name="focusPolicy">
- <enum>Qt::StrongFocus</enum>
- </property>
- <property name="toolTip">
- <string><html><head/><body><p>Add callsign and locator to database. <br>Right-click searches for callsign on hamqth.com.</p></body></html></string>
- </property>
- <property name="text">
- <string>Add</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="ignoreButton">
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>0</height>
- </size>
- </property>
- <property name="focusPolicy">
- <enum>Qt::StrongFocus</enum>
- </property>
- <property name="toolTip">
- <string><html><head/><body><p>Put callsign on the Ignore List.<br>Right-click searches for callsign on qrzcq.com.</p></body></html></string>
- </property>
- <property name="text">
- <string>Ignore</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </item>
- <item row="1" column="7" rowspan="2">
- <widget class="QSlider" name="outAttenuation">
- <property name="toolTip">
- <string>Adjust Tx audio level</string>
- </property>
- <property name="maximum">
- <number>450</number>
- </property>
- <property name="value">
- <number>0</number>
- </property>
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="invertedAppearance">
- <bool>true</bool>
- </property>
- <property name="invertedControls">
- <bool>true</bool>
- </property>
- <property name="tickPosition">
- <enum>QSlider::TicksBelow</enum>
- </property>
- <property name="tickInterval">
- <number>50</number>
- </property>
- </widget>
- </item>
- <item row="0" column="7">
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Pwr</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="1" column="2" rowspan="2">
- <layout class="QVBoxLayout" name="verticalLayout_11">
- <property name="spacing">
- <number>6</number>
- </property>
- <item>
- <widget class="QSpinBox" name="sbNB">
- <property name="sizePolicy">
- <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="maximumSize">
- <size>
- <width>100</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <property name="suffix">
- <string> %</string>
- </property>
- <property name="prefix">
- <string>NB </string>
- </property>
- <property name="minimum">
- <number>-2</number>
- </property>
- <property name="maximum">
- <number>25</number>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_3">
- <property name="spacing">
- <number>0</number>
- </property>
- <item>
- <widget class="SignalMeter" name="signal_meter_widget">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>100</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string><html><head/><body><p>30dB recommended when only noise present<br/>Green when good<br/>Red when clipping may occur<br/>Yellow when too low</p></body></html></string>
- </property>
- <property name="accessibleName">
- <string>Rx Signal</string>
- </property>
- <property name="accessibleDescription">
- <string>30dB recommended when only noise present
-Green when good
-Red when clipping may occur
-Yellow when too low</string>
- </property>
- <property name="frameShape">
- <enum>QFrame::Panel</enum>
- </property>
- <property name="frameShadow">
- <enum>QFrame::Sunken</enum>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>0</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- </layout>
- </item>
- <item row="0" column="6" rowspan="3">
- <widget class="QStackedWidget" name="controls_stack_widget">
- <property name="sizePolicy">
- <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="currentIndex">
- <number>0</number>
- </property>
- <widget class="QWidget" name="page">
- <layout class="QHBoxLayout" name="horizontalLayout_8">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
- <number>0</number>
- </property>
- <item>
- <widget class="QWidget" name="QSO_controls_widget" native="true">
- <property name="sizePolicy">
- <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout_6" stretch="1,2">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
- <number>0</number>
- </property>
- <item>
- <layout class="QGridLayout" name="gridLayout_3" columnstretch="0,0">
- <item row="1" column="0" colspan="2">
- <layout class="QHBoxLayout" name="horizontalLayout_11">
- <item>
- <widget class="QSpinBox" name="sbCQTxFreq">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="toolTip">
- <string><html><head/><body><p>Frequency to call CQ on in kHz above the current MHz</p></body></html></string>
- </property>
- <property name="accessibleDescription">
- <string>Frequency to call CQ on in kHz above the current MHz</string>
- </property>
- <property name="prefix">
- <string>Tx CQ </string>
- </property>
- <property name="minimum">
- <number>1</number>
- </property>
- <property name="maximum">
- <number>999</number>
- </property>
- <property name="value">
- <number>260</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="cbCQTx">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="toolTip">
- <string><html><head/><body><p>Check this to call CQ on the &quot;Tx CQ&quot; frequency. Rx will be on the current frequency and the CQ message wiill include the current Rx frequency so callers know which frequency to reply on.</p><p>Not available to nonstandard callsign holders.</p></body></html></string>
- </property>
- <property name="accessibleDescription">
- <string>Check this to call CQ on the "Tx CQ" frequency. Rx will be on the current frequency and the CQ message wiill include the current Rx frequency so callers know which frequency to reply on.
-Not available to nonstandard callsign holders.</string>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="cbRxAll">
- <property name="toolTip">
- <string>Decode other Hounds calling above 1000 Hz audio offset</string>
- </property>
- <property name="text">
- <string>Rx All Freqs</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="3" column="0" colspan="2">
- <layout class="QHBoxLayout" name="horizontalLayout_15">
- <item>
- <widget class="QLabel" name="labDXped">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="maximumSize">
- <size>
- <width>100</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="text">
- <string>Fox</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="cbSWL">
- <property name="toolTip">
- <string><html><head/><body><p>Check to monitor Sh messages.</p></body></html></string>
- </property>
- <property name="accessibleDescription">
- <string>Check to monitor Sh messages.</string>
- </property>
- <property name="text">
- <string>SWL</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="pbBestSP">
- <property name="toolTip">
- <string>Enable auto response to the first decode from a new DXCC or new call on the current band.</string>
- </property>
- <property name="styleSheet">
- <string notr="true">QPushButton:checked {
- color: rgb(0, 0, 0);
- background-color: red;
- border-style: outset;
- border-width: 1px;
- border-radius: 5px;
- border-color: black;
- min-width: 5em;
- padding: 3px;
-}</string>
- </property>
- <property name="text">
- <string>Best S+P</string>
- </property>
- <property name="checkable">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="measure_check_box">
- <property name="toolTip">
- <string><html><head/><body><p>Check this to start recording calibration data.<br/>While measuring calibration correction is disabled.<br/>When not checked you can view the calibration results.</p></body></html></string>
- </property>
- <property name="accessibleDescription">
- <string>Check this to start recording calibration data.
-While measuring calibration correction is disabled.
-When not checked you can view the calibration results.</string>
- </property>
- <property name="text">
- <string>Measure</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="2" column="0" colspan="2">
- <layout class="QHBoxLayout" name="horizontalLayout_5">
- <item>
- <widget class="QCheckBox" name="cbShMsgs">
- <property name="toolTip">
- <string><html><head/><body><p>Check to use short-format messages.</p></body></html></string>
- </property>
- <property name="accessibleDescription">
- <string>Check to use short-format messages.</string>
- </property>
- <property name="text">
- <string>Sh</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="cbFast9">
- <property name="toolTip">
- <string><html><head/><body><p>Check to enable JT9 fast modes</p></body></html></string>
- </property>
- <property name="accessibleDescription">
- <string>Check to enable JT9 fast modes</string>
- </property>
- <property name="text">
- <string>Fast</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="cbAutoSeq">
- <property name="toolTip">
- <string><html><head/><body><p>Check to enable automatic sequencing of Tx messages based on received messages.</p></body></html></string>
- </property>
- <property name="accessibleDescription">
- <string>Check to enable automatic sequencing of Tx messages based on received messages.</string>
- </property>
- <property name="text">
- <string>Auto Seq</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QComboBox" name="respondComboBox">
- <property name="toolTip">
- <string><html><head/><body><p>Select <span style=" font-weight:600;">CQ: None</span> to choose callers manually.</p><p>Select <span style=" font-weight:600;">CQ: First</span> to respond automatically to the first decoded reply to your CQ. </p><p>Select <span style=" font-weight:600;">CQ: Max Dist</span> to respond automatically to the reply yielding most points in the ARRL International Digital Contest, or in general to the most distant station, if its message has a valid grid.</p><p>Select <span style=" font-weight:600;">CQ: Max dB</span> to respond automatically to the the strongest station's reply to your CQ. </p><p>Select <span style=" font-weight:600;">CQ: Min dB</span> to respond automatically to the the weakest station's reply to your CQ. </p></body></html></string>
- </property>
- <property name="currentText">
- <string/>
- </property>
- <property name="currentIndex">
- <number>-1</number>
- </property>
- <property name="maxVisibleItems">
- <number>5</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="cbTx6">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="toolTip">
- <string>Check to generate "@1250 (SEND MSGS)" in Tx6.</string>
- </property>
- <property name="text">
- <string>Tx6</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="0" column="0">
- <layout class="QVBoxLayout" name="verticalLayout_14">
- <item>
- <widget class="QCheckBox" name="txFirstCheckBox">
- <property name="focusPolicy">
- <enum>Qt::StrongFocus</enum>
- </property>
- <property name="toolTip">
- <string><html><head/><body><p>Check to Tx in even-numbered minutes or sequences, starting at 0; uncheck for odd sequences. Right-click to freeze the state of the checkbox. Right-click either the FT8 or MSK button to unfreeze.</p></body></html></string>
- </property>
- <property name="accessibleDescription">
- <string><html><head/><body><p>Check to Tx in even-numbered minutes or sequences, starting at 0; uncheck for odd sequences. Right-click to freeze the state of the checkbox. Right-click either the FT8 or MSK button to unfreeze.</p></body></html></string>
- </property>
- <property name="text">
- <string>Tx even/1st</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QSpinBox" name="TxFreqSpinBox">
- <property name="toolTip">
- <string>Audio Tx frequency</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <property name="suffix">
- <string> Hz</string>
- </property>
- <property name="prefix">
- <string>Tx </string>
- </property>
- <property name="minimum">
- <number>200</number>
- </property>
- <property name="maximum">
- <number>5000</number>
- </property>
- <property name="value">
- <number>1500</number>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_4" stretch="0,6,0">
- <item>
- <widget class="QPushButton" name="pbR2T">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>15</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>35</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string>Set Tx frequency to Rx Frequency</string>
- </property>
- <property name="accessibleName">
- <string>Set Tx frequency to Rx Frequency</string>
- </property>
- <property name="text">
- <string>â–²</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="HintedSpinBox" name="sbFtol">
- <property name="sizePolicy">
- <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="toolTip">
- <string>Frequency tolerance (Hz)</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <property name="prefix">
- <string>F Tol </string>
- </property>
- <property name="minimum">
- <number>1</number>
- </property>
- <property name="maximum">
- <number>1000</number>
- </property>
- <property name="value">
- <number>10</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="pbT2R">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>15</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>35</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string>Set Rx frequency to Tx Frequency</string>
- </property>
- <property name="accessibleName">
- <string>Set Rx frequency to Tx Frequency</string>
- </property>
- <property name="text">
- <string>â–¼</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QSpinBox" name="RxFreqSpinBox">
- <property name="toolTip">
- <string>Audio Rx frequency</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <property name="suffix">
- <string> Hz</string>
- </property>
- <property name="prefix">
- <string>Rx </string>
- </property>
- <property name="minimum">
- <number>200</number>
- </property>
- <property name="maximum">
- <number>5000</number>
- </property>
- <property name="value">
- <number>1500</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QSpinBox" name="rptSpinBox">
- <property name="toolTip">
- <string><html><head/><body><p>Signal report: Signal-to-noise ratio in 2500 Hz reference bandwidth (dB).</p></body></html></string>
- </property>
- <property name="accessibleDescription">
- <string>Signal report: Signal-to-noise ratio in 2500 Hz reference bandwidth (dB).</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <property name="prefix">
- <string> Report </string>
- </property>
- <property name="minimum">
- <number>-50</number>
- </property>
- <property name="maximum">
- <number>49</number>
- </property>
- <property name="value">
- <number>-15</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="RestrictedSpinBox" name="sbTR">
- <property name="toolTip">
- <string><html><head/><body><p>Tx/Rx or Frequency calibration sequence length</p></body></html></string>
- </property>
- <property name="accessibleDescription">
- <string>Tx/Rx or Frequency calibration sequence length</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <property name="suffix">
- <string> s</string>
- </property>
- <property name="prefix">
- <string>T/R </string>
- </property>
- <property name="minimum">
- <number>5</number>
- </property>
- <property name="maximum">
- <number>1800</number>
- </property>
- <property name="value">
- <number>30</number>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="4" column="0">
- <spacer name="verticalSpacer_4">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="0" column="1">
- <layout class="QVBoxLayout" name="verticalLayout_13">
- <item>
- <layout class="QGridLayout" name="submode_gridLayout">
- <property name="horizontalSpacing">
- <number>4</number>
- </property>
- <item row="0" column="1">
- <widget class="QPushButton" name="pb15C">
- <property name="minimumSize">
- <size>
- <width>30</width>
- <height>0</height>
- </size>
- </property>
- <property name="toolTip">
- <string><html><head/><body><p>Switch to T/R 15 s and Submode C.</p></body></html></string>
- </property>
- <property name="text">
- <string>15C</string>
- </property>
- </widget>
- </item>
- <item row="0" column="0">
- <widget class="QPushButton" name="pb15A">
- <property name="minimumSize">
- <size>
- <width>32</width>
- <height>0</height>
- </size>
- </property>
- <property name="toolTip">
- <string><html><head/><body><p>Switch to T/R 15 s and Submode A.</p></body></html></string>
- </property>
- <property name="text">
- <string>15A</string>
- </property>
- </widget>
- </item>
- <item row="0" column="2">
- <widget class="QPushButton" name="pb30B">
- <property name="minimumSize">
- <size>
- <width>32</width>
- <height>0</height>
- </size>
- </property>
- <property name="toolTip">
- <string><html><head/><body><p>Switch to T/R 30 s and Submode B.</p></body></html></string>
- </property>
- <property name="text">
- <string>30B</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QPushButton" name="pb60C">
- <property name="minimumSize">
- <size>
- <width>30</width>
- <height>0</height>
- </size>
- </property>
- <property name="toolTip">
- <string><html><head/><body><p>Switch to T/R 60 s and Submode C.</p></body></html></string>
- </property>
- <property name="text">
- <string>60C</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QPushButton" name="pb60D">
- <property name="minimumSize">
- <size>
- <width>30</width>
- <height>0</height>
- </size>
- </property>
- <property name="toolTip">
- <string><html><head/><body><p>Switch to T/R 60 s and Submode D.</p></body></html></string>
- </property>
- <property name="text">
- <string>60D</string>
- </property>
- </widget>
- </item>
- <item row="1" column="2">
- <widget class="QPushButton" name="pb60E">
- <property name="minimumSize">
- <size>
- <width>30</width>
- <height>0</height>
- </size>
- </property>
- <property name="toolTip">
- <string><html><head/><body><p>Switch to T/R 60 s and Submode E.</p></body></html></string>
- </property>
- <property name="text">
- <string>60E</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QCheckBox" name="cbHoldTxFreq">
- <property name="toolTip">
- <string><html><head/><body><p>Check to keep Tx frequency fixed when double-clicking on decoded text.</p></body></html></string>
- </property>
- <property name="accessibleDescription">
- <string>Check to keep Tx frequency fixed when double-clicking on decoded text.</string>
- </property>
- <property name="text">
- <string>Hold Tx Freq</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QStackedWidget" name="opt_controls_stack">
- <property name="currentIndex">
- <number>1</number>
- </property>
- <widget class="QWidget" name="page_0">
- <layout class="QVBoxLayout" name="verticalLayout">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
- <number>0</number>
- </property>
- <item>
- <widget class="QSpinBox" name="sbSerialNumber">
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- <property name="prefix">
- <string>Tx# </string>
- </property>
- <property name="minimum">
- <number>1</number>
- </property>
- <property name="maximum">
- <number>4095</number>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="page_1">
- <layout class="QVBoxLayout" name="verticalLayout_10">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
- <number>0</number>
- </property>
- <item>
- <widget class="QSpinBox" name="sbF_Low">
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <property name="prefix">
- <string>F Low </string>
- </property>
- <property name="minimum">
- <number>100</number>
- </property>
- <property name="maximum">
- <number>5000</number>
- </property>
- <property name="singleStep">
- <number>50</number>
- </property>
- <property name="value">
- <number>600</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QSpinBox" name="sbF_High">
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <property name="suffix">
- <string/>
- </property>
- <property name="prefix">
- <string>F High </string>
- </property>
- <property name="minimum">
- <number>100</number>
- </property>
- <property name="maximum">
- <number>5000</number>
- </property>
- <property name="singleStep">
- <number>50</number>
- </property>
- <property name="value">
- <number>1400</number>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- <item>
- <widget class="LettersSpinBox" name="sbSubmode">
- <property name="toolTip">
- <string><html><head/><body><p>Submode determines tone spacing; A is narrowest.</p></body></html></string>
- </property>
- <property name="accessibleDescription">
- <string>Submode determines tone spacing; A is narrowest.</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <property name="prefix">
- <string>Submode </string>
- </property>
- <property name="minimum">
- <number>0</number>
- </property>
- <property name="maximum">
- <number>7</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QSpinBox" name="syncSpinBox">
- <property name="toolTip">
- <string><html><head/><body><p>Synchronizing threshold. Lower numbers accept weaker sync signals.</p></body></html></string>
- </property>
- <property name="accessibleDescription">
- <string>Synchronizing threshold. Lower numbers accept weaker sync signals.</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <property name="prefix">
- <string>Sync </string>
- </property>
- <property name="minimum">
- <number>-1</number>
- </property>
- <property name="maximum">
- <number>10</number>
- </property>
- <property name="value">
- <number>1</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QSpinBox" name="sbMaxDrift">
- <property name="toolTip">
- <string>Maximum drift rate in units of symbol rate per transmission.</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <property name="prefix">
- <string>Max Drift </string>
- </property>
- <property name="maximum">
- <number>50</number>
- </property>
- <property name="singleStep">
- <number>5</number>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer_6">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QTabWidget" name="tabWidget">
- <property name="sizePolicy">
- <sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="tabPosition">
- <enum>QTabWidget::West</enum>
- </property>
- <property name="tabShape">
- <enum>QTabWidget::Triangular</enum>
- </property>
- <property name="currentIndex">
- <number>0</number>
- </property>
- <widget class="QWidget" name="tab">
- <attribute name="title">
- <string>1</string>
- </attribute>
- <layout class="QGridLayout" name="gridLayout_7">
- <item row="0" column="0">
- <layout class="QGridLayout" name="gridLayout_6" columnstretch="1,0,0">
- <item row="6" column="1">
- <widget class="QRadioButton" name="txrb6">
- <property name="toolTip">
- <string>Send this message in next Tx interval</string>
- </property>
- <property name="styleSheet">
- <string notr="true">margin-left: 10%; margin-right: 0%</string>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="shortcut">
- <string>Ctrl+6</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QLabel" name="label_5">
- <property name="toolTip">
- <string>Queue up the next Tx message</string>
- </property>
- <property name="text">
- <string>Next</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLineEdit" name="tx1">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </item>
- <item row="4" column="1">
- <widget class="DoubleClickableRadioButton" name="txrb4">
- <property name="toolTip">
- <string><html><head/><body><p>Send this message in next Tx interval</p><p>Double-click to toggle between RRR and RR73 messages in Tx4 (not allowed for type 2 compound call holders)</p><p>RR73 messages should only be used when you are reasonably confident that no message repetitions will be required</p></body></html></string>
- </property>
- <property name="accessibleDescription">
- <string>Send this message in next Tx interval
-Double-click to toggle between RRR and RR73 messages in Tx4 (not allowed for type 2 compound call holders)
-RR73 messages should only be used when you are reasonably confident that no message repetitions will be required</string>
- </property>
- <property name="styleSheet">
- <string notr="true">margin-left: 10%; margin-right: 0%</string>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="shortcut">
- <string>Ctrl+4</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="DoubleClickableRadioButton" name="txrb1">
- <property name="toolTip">
- <string><html><head/><body><p>Send this message in next Tx interval</p><p>Double click to toggle the use of the Tx1 message to start a QSO with a station (not allowed for type 1 compound call holders)</p></body></html></string>
- </property>
- <property name="accessibleDescription">
- <string>Send this message in next Tx interval
-Double click to toggle the use of the Tx1 message to start a QSO with a station (not allowed for type 1 compound call holders)</string>
- </property>
- <property name="styleSheet">
- <string notr="true">margin-left: 10%; margin-right: 0%</string>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="shortcut">
- <string>Ctrl+1</string>
- </property>
- </widget>
- </item>
- <item row="6" column="0">
- <widget class="QLineEdit" name="tx6">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </item>
- <item row="5" column="2">
- <widget class="DoubleClickablePushButton" name="txb5">
- <property name="focusPolicy">
- <enum>Qt::StrongFocus</enum>
- </property>
- <property name="toolTip">
- <string><html><head/><body><p>Switch to this Tx message NOW</p><p>Double-click to reset to the standard 73 message</p><p>Right-click to retain Tx5 free text</p></body></html></string>
- </property>
- <property name="accessibleDescription">
- <string><html><head/><body><p>Switch to this Tx message NOW</p><p>Double-click to reset to the standard 73 message</p><p>Right-click to retain Tx5 free text</p></body></html></string>
- </property>
- <property name="styleSheet">
- <string notr="true">padding-left: 15%; padding-right: 15%; padding-top: 3%; padding-bottom: 3%</string>
- </property>
- <property name="text">
- <string>Tx &5</string>
- </property>
- <property name="shortcut">
- <string>Alt+5</string>
- </property>
- </widget>
- </item>
- <item row="2" column="2">
- <widget class="QPushButton" name="txb2">
- <property name="toolTip">
- <string>Switch to this Tx message NOW</string>
- </property>
- <property name="styleSheet">
- <string notr="true">padding-left: 15%; padding-right: 15%; padding-top: 3%; padding-bottom: 3%</string>
- </property>
- <property name="text">
- <string>Tx &2</string>
- </property>
- <property name="shortcut">
- <string>Alt+2</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLineEdit" name="tx2">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </item>
- <item row="0" column="2">
- <widget class="QLabel" name="label_2">
- <property name="toolTip">
- <string>Switch to this Tx message NOW</string>
- </property>
- <property name="text">
- <string>Now</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QRadioButton" name="txrb2">
- <property name="toolTip">
- <string>Send this message in next Tx interval</string>
- </property>
- <property name="styleSheet">
- <string notr="true">margin-left: 10%; margin-right: 0%</string>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="shortcut">
- <string>Ctrl+2</string>
- </property>
- </widget>
- </item>
- <item row="4" column="0">
- <widget class="QLineEdit" name="tx4">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </item>
- <item row="3" column="0">
- <widget class="QLineEdit" name="tx3">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </item>
- <item row="0" column="0">
- <widget class="QPushButton" name="genStdMsgsPushButton">
- <property name="toolTip">
- <string>Generate standard messages for minimal QSO</string>
- </property>
- <property name="text">
- <string>Generate Std Msgs</string>
- </property>
- </widget>
- </item>
- <item row="3" column="2">
- <widget class="QPushButton" name="txb3">
- <property name="toolTip">
- <string>Switch to this Tx message NOW</string>
- </property>
- <property name="styleSheet">
- <string notr="true">padding-left: 15%; padding-right: 15%; padding-top: 3%; padding-bottom: 3%</string>
- </property>
- <property name="text">
- <string>Tx &3</string>
- </property>
- <property name="shortcut">
- <string>Alt+3</string>
- </property>
- </widget>
- </item>
- <item row="4" column="2">
- <widget class="DoubleClickablePushButton" name="txb4">
- <property name="toolTip">
- <string><html><head/><body><p>Switch to this Tx message NOW</p><p>Double-click to toggle between RRR and RR73 messages in Tx4 (not allowed for type2 compound call holders)</p><p>RR73 messages should only be used when you are reasonably confident that no message repetitions will be required</p></body></html></string>
- </property>
- <property name="accessibleDescription">
- <string>Switch to this Tx message NOW
-Double-click to toggle between RRR and RR73 messages in Tx4 (not allowed for type2 compound call holders)
-RR73 messages should only be used when you are reasonably confident that no message repetitions will be required</string>
- </property>
- <property name="styleSheet">
- <string notr="true">padding-left: 15%; padding-right: 15%; padding-top: 3%; padding-bottom: 3%</string>
- </property>
- <property name="text">
- <string>Tx &4</string>
- </property>
- <property name="shortcut">
- <string>Alt+4</string>
- </property>
- </widget>
- </item>
- <item row="1" column="2">
- <widget class="DoubleClickablePushButton" name="txb1">
- <property name="toolTip">
- <string><html><head/><body><p>Switch to this Tx message NOW</p><p>Double click to toggle the use of the Tx1 message to start a QSO with a station (not allowed for type 1 compound call holders)</p></body></html></string>
- </property>
- <property name="accessibleDescription">
- <string>Switch to this Tx message NOW
-Double click to toggle the use of the Tx1 message to start a QSO with a station (not allowed for type 1 compound call holders)</string>
- </property>
- <property name="layoutDirection">
- <enum>Qt::LeftToRight</enum>
- </property>
- <property name="styleSheet">
- <string notr="true">padding-left: 15%; padding-right: 15%; padding-top: 3%; padding-bottom: 3%</string>
- </property>
- <property name="text">
- <string>Tx &1</string>
- </property>
- <property name="shortcut">
- <string>Alt+1</string>
- </property>
- </widget>
- </item>
- <item row="6" column="2">
- <widget class="QPushButton" name="txb6">
- <property name="toolTip">
- <string>Switch to this Tx message NOW</string>
- </property>
- <property name="styleSheet">
- <string notr="true">padding-left: 15%; padding-right: 15%; padding-top: 3%; padding-bottom: 3%</string>
- </property>
- <property name="text">
- <string>Tx &6</string>
- </property>
- <property name="shortcut">
- <string>Alt+6</string>
- </property>
- </widget>
- </item>
- <item row="3" column="1">
- <widget class="QRadioButton" name="txrb3">
- <property name="toolTip">
- <string>Send this message in next Tx interval</string>
- </property>
- <property name="styleSheet">
- <string notr="true">margin-left: 10%; margin-right: 0%</string>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="shortcut">
- <string>Ctrl+3</string>
- </property>
- </widget>
- </item>
- <item row="5" column="0">
- <widget class="QComboBox" name="tx5">
- <property name="toolTip">
- <string>Enter a free text message (maximum 13 characters)
-or select a predefined macro from the dropdown list.
-Press ENTER to add the current text to the predefined
-list. The list can be maintained in Settings (F2).</string>
- </property>
- <property name="editable">
- <bool>true</bool>
- </property>
- <property name="insertPolicy">
- <enum>QComboBox::InsertAtBottom</enum>
- </property>
- </widget>
- </item>
- <item row="5" column="1">
- <widget class="DoubleClickableRadioButton" name="txrb5">
- <property name="toolTip">
- <string><html><head/><body><p>Send this message in next Tx interval</p><p>Double-click to reset to the standard 73 message</p></body></html></string>
- </property>
- <property name="accessibleDescription">
- <string>Send this message in next Tx interval
-Double-click to reset to the standard 73 message</string>
- </property>
- <property name="styleSheet">
- <string notr="true">margin-left: 10%; margin-right: 0%</string>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="shortcut">
- <string>Ctrl+5</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="tab_3">
- <attribute name="title">
- <string>2</string>
- </attribute>
- <layout class="QGridLayout" name="gridLayout_11" columnstretch="1">
- <property name="leftMargin">
- <number>4</number>
- </property>
- <property name="topMargin">
- <number>4</number>
- </property>
- <property name="rightMargin">
- <number>4</number>
- </property>
- <property name="bottomMargin">
- <number>4</number>
- </property>
- <property name="horizontalSpacing">
- <number>4</number>
- </property>
- <item row="0" column="0" rowspan="2">
- <layout class="QGridLayout" name="gridLayout" columnstretch="2,2,1">
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="horizontalSpacing">
- <number>6</number>
- </property>
- <item row="8" column="2">
- <widget class="QCheckBox" name="cbSendMsg">
- <property name="toolTip">
- <string><html><head/><body><p>Transmit free text message at the next opportunity.</p></body></html></string>
- </property>
- <property name="text">
- <string>Send msg</string>
- </property>
- </widget>
- </item>
- <item row="7" column="2">
- <widget class="QPushButton" name="pbFreeText">
- <property name="toolTip">
- <string><html><head/><body><p>Enter a free text message.</p></body></html></string>
- </property>
- <property name="text">
- <string>Free Text</string>
- </property>
- </widget>
- </item>
- <item row="4" column="2">
- <widget class="QComboBox" name="comboBoxCQ">
- <property name="toolTip">
- <string><html><head/><body><p>Select a specific CQ message.</p></body></html></string>
- </property>
- <property name="currentText">
- <string>CQ</string>
- </property>
- <item>
- <property name="text">
- <string>CQ</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>CQ AF</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>CQ AN</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>CQ AS</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>CQ EU</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>CQ NA</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>CQ OC</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>CQ SA</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>CQ 0</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>CQ 1</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>CQ 2</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>CQ 3</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>CQ 4</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>CQ 5</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>CQ 6</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>CQ 7</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>CQ 8</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>CQ 9</string>
- </property>
- </item>
- </widget>
- </item>
- <item row="0" column="0">
- <widget class="QLabel" name="label_queue">
- <property name="font">
- <font>
- <pointsize>9</pointsize>
- </font>
- </property>
- <property name="text">
- <string>Queue</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="0" column="2">
- <widget class="QCheckBox" name="cbWorkDupes">
- <property name="text">
- <string>Allow Dupes</string>
- </property>
- </widget>
- </item>
- <item row="6" column="2">
- <widget class="QPushButton" name="pbFoxReset">
- <property name="toolTip">
- <string><html><head/><body><p>Clear all queues.</p></body></html></string>
- </property>
- <property name="text">
- <string>Reset</string>
- </property>
- </widget>
- </item>
- <item row="2" column="2">
- <widget class="QSpinBox" name="sbNlist">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string><html><head/><body><p>Maximum number of callsigns to be displayed in the queue.</p></body></html></string>
- </property>
- <property name="prefix">
- <string>N List </string>
- </property>
- <property name="minimum">
- <number>5</number>
- </property>
- <property name="maximum">
- <number>100</number>
- </property>
- <property name="value">
- <number>12</number>
- </property>
- </widget>
- </item>
- <item row="1" column="2">
- <widget class="QComboBox" name="comboBoxHoundSort">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string><html><head/><body><p>Select a desired sort order for callsigns in the queue.</p></body></html></string>
- </property>
- <property name="currentText">
- <string>Random</string>
- </property>
- <property name="maxVisibleItems">
- <number>8</number>
- </property>
- <item>
- <property name="text">
- <string>Random</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Call</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Grid</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>S/N (dB)</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Distance</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Age</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Continent</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Score</string>
- </property>
- </item>
- </widget>
- </item>
- <item row="5" column="2">
- <widget class="QCheckBox" name="cbMoreCQs">
- <property name="toolTip">
- <string><html><head/><body><p>Include a CQ message along with other messages.</p></body></html></string>
- </property>
- <property name="text">
- <string>More CQs</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QLabel" name="label_inProcess">
- <property name="text">
- <string>In Progress</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="3" column="2">
- <widget class="QSpinBox" name="sbNslots">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string><html><head/><body><p>Maximum number of concurrent streams for Fox transmissions.</p></body></html></string>
- </property>
- <property name="suffix">
- <string/>
- </property>
- <property name="prefix">
- <string>N Slots </string>
- </property>
- <property name="minimum">
- <number>1</number>
- </property>
- <property name="maximum">
- <number>5</number>
- </property>
- <property name="value">
- <number>1</number>
- </property>
- <property name="displayIntegerBase">
- <number>10</number>
- </property>
- </widget>
- </item>
- <item row="9" column="2">
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="1" column="1" rowspan="9">
- <widget class="DisplayText" name="foxTxListTextBrowser">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="sizeAdjustPolicy">
- <enum>QAbstractScrollArea::AdjustToContentsOnFirstShow</enum>
- </property>
- </widget>
- </item>
- <item row="1" column="0" rowspan="9">
- <widget class="DisplayText" name="houndQueueTextBrowser">
- <property name="sizePolicy">
- <sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="sizeAdjustPolicy">
- <enum>QAbstractScrollArea::AdjustToContentsOnFirstShow</enum>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="tab_4">
- <attribute name="title">
- <string>3</string>
- </attribute>
- <layout class="QGridLayout" name="gridLayout_13">
- <property name="leftMargin">
- <number>2</number>
- </property>
- <property name="topMargin">
- <number>3</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
- <number>1</number>
- </property>
- <item row="0" column="0">
- <layout class="QHBoxLayout" name="horizontalLayout_30">
- <property name="spacing">
- <number>0</number>
- </property>
- <item>
- <widget class="QWidget" name="widget_3" native="true">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <layout class="QGridLayout" name="gridLayout_8" columnstretch="1,1,1">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>1</number>
- </property>
- <property name="bottomMargin">
- <number>0</number>
- </property>
- <property name="horizontalSpacing">
- <number>1</number>
- </property>
- <property name="verticalSpacing">
- <number>6</number>
- </property>
- <item row="7" column="1">
- <widget class="QCheckBox" name="cb70cm">
- <property name="toolTip">
- <string>70cm FT8</string>
- </property>
- <property name="text">
- <string>70cm</string>
- </property>
- </widget>
- </item>
- <item row="5" column="0">
- <widget class="QCheckBox" name="cb30m">
- <property name="toolTip">
- <string>30m FT8</string>
- </property>
- <property name="text">
- <string>30m</string>
- </property>
- </widget>
- </item>
- <item row="8" column="0" rowspan="2" colspan="2">
- <widget class="QPushButton" name="pbBandHopping">
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>34</height>
- </size>
- </property>
- <property name="focusPolicy">
- <enum>Qt::StrongFocus</enum>
- </property>
- <property name="toolTip">
- <string><html><head/><body><p>Toggle band hopping On/Off. Band hopping occurs every other full minute. Changes to the checkboxes take effect immediately.<br/>Right-click to switch to the next selected band hopping frequency, or to test the default audio device, when band hopping is disabled.</p></body></html></string>
- </property>
- <property name="styleSheet">
- <string notr="true">QPushButton:checked {
- background-color: red;
- border-style: outset;
- border-width: 1px;
- border-radius: 5px;
- border-color: black;
- min-width: 5em;
- padding: 3px;
-}</string>
- </property>
- <property name="text">
- <string> Band Hopping </string>
- </property>
- <property name="checkable">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QCheckBox" name="cb12m">
- <property name="toolTip">
- <string>12m FT8</string>
- </property>
- <property name="text">
- <string>12m</string>
- </property>
- </widget>
- </item>
- <item row="4" column="0">
- <widget class="QCheckBox" name="cb40m">
- <property name="toolTip">
- <string>40m FT8</string>
- </property>
- <property name="text">
- <string>40m</string>
- </property>
- </widget>
- </item>
- <item row="9" column="2">
- <widget class="QCheckBox" name="cb2mMSK">
- <property name="toolTip">
- <string>2m MSK144</string>
- </property>
- <property name="whatsThis">
- <string/>
- </property>
- <property name="text">
- <string>2m MSK</string>
- </property>
- </widget>
- </item>
- <item row="3" column="1">
- <widget class="QCheckBox" name="cb10m">
- <property name="toolTip">
- <string>10m FT8</string>
- </property>
- <property name="text">
- <string>10m</string>
- </property>
- </widget>
- </item>
- <item row="4" column="1">
- <widget class="QCheckBox" name="cb6m">
- <property name="toolTip">
- <string>6m FT8</string>
- </property>
- <property name="text">
- <string>6m</string>
- </property>
- </widget>
- </item>
- <item row="3" column="0">
- <widget class="QCheckBox" name="cb60m">
- <property name="toolTip">
- <string>60m FT8</string>
- </property>
- <property name="text">
- <string>60m</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QCheckBox" name="cb160m">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="toolTip">
- <string>160m FT8</string>
- </property>
- <property name="text">
- <string>160m</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QCheckBox" name="cb80m">
- <property name="toolTip">
- <string>80m FT8</string>
- </property>
- <property name="text">
- <string>80m</string>
- </property>
- </widget>
- </item>
- <item row="6" column="0">
- <widget class="QCheckBox" name="cb20m">
- <property name="toolTip">
- <string>20m FT8</string>
- </property>
- <property name="text">
- <string>20m</string>
- </property>
- </widget>
- </item>
- <item row="7" column="0">
- <widget class="QCheckBox" name="cb17m">
- <property name="toolTip">
- <string>17m FT8</string>
- </property>
- <property name="text">
- <string>17m</string>
- </property>
- </widget>
- </item>
- <item row="5" column="1">
- <widget class="QCheckBox" name="cb4m">
- <property name="toolTip">
- <string>4m FT8</string>
- </property>
- <property name="text">
- <string>4m</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QCheckBox" name="cb15m">
- <property name="toolTip">
- <string>15m FT8</string>
- </property>
- <property name="text">
- <string>15m</string>
- </property>
- </widget>
- </item>
- <item row="6" column="1">
- <widget class="QCheckBox" name="cb2m">
- <property name="toolTip">
- <string>2m FT8</string>
- </property>
- <property name="text">
- <string>2m</string>
- </property>
- </widget>
- </item>
- <item row="8" column="2">
- <widget class="QCheckBox" name="cb10mFT4">
- <property name="toolTip">
- <string>10m FT4</string>
- </property>
- <property name="text">
- <string>10m FT4</string>
- </property>
- </widget>
- </item>
- <item row="7" column="2">
- <widget class="QCheckBox" name="cb12mFT4">
- <property name="toolTip">
- <string>12m FT4</string>
- </property>
- <property name="text">
- <string>12m FT4</string>
- </property>
- </widget>
- </item>
- <item row="6" column="2">
- <widget class="QCheckBox" name="cb15mFT4">
- <property name="toolTip">
- <string>15m FT4</string>
- </property>
- <property name="text">
- <string>15m FT4</string>
- </property>
- </widget>
- </item>
- <item row="5" column="2">
- <widget class="QCheckBox" name="cb17mFT4">
- <property name="toolTip">
- <string>17m FT4</string>
- </property>
- <property name="text">
- <string>17m FT4</string>
- </property>
- </widget>
- </item>
- <item row="4" column="2">
- <widget class="QCheckBox" name="cb20mFT4">
- <property name="toolTip">
- <string>20m FT4</string>
- </property>
- <property name="text">
- <string>20m FT4</string>
- </property>
- </widget>
- </item>
- <item row="3" column="2">
- <widget class="QCheckBox" name="cb30mFT4">
- <property name="toolTip">
- <string>30m FT4</string>
- </property>
- <property name="text">
- <string>30m FT4</string>
- </property>
- </widget>
- </item>
- <item row="2" column="2">
- <widget class="QCheckBox" name="cb40mFT4">
- <property name="toolTip">
- <string>40m FT4</string>
- </property>
- <property name="text">
- <string>40m FT4</string>
- </property>
- </widget>
- </item>
- <item row="1" column="2">
- <widget class="QCheckBox" name="cb80mFT4">
- <property name="toolTip">
- <string>80m FT4</string>
- </property>
- <property name="text">
- <string>80m FT4</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <layout class="QGridLayout" name="gridLayout_10" columnstretch="0,1">
- <property name="bottomMargin">
- <number>0</number>
- </property>
- <property name="horizontalSpacing">
- <number>1</number>
- </property>
- <property name="verticalSpacing">
- <number>6</number>
- </property>
- <item row="6" column="0">
- <widget class="QCheckBox" name="cbQRG6">
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string>FT8 QRG6</string>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item row="0" column="0">
- <widget class="QCheckBox" name="cbQRG1">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string>FT8 QRG1</string>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QCheckBox" name="cbQRG2">
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string>FT8 QRG2</string>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item row="7" column="0">
- <widget class="QCheckBox" name="cbQRG7">
- <property name="toolTip">
- <string>FT8 QRG7</string>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item row="8" column="1">
- <widget class="QSpinBox" name="sbQRG8">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>57</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string>FT8 QRG8 in kHz.</string>
- </property>
- <property name="showGroupSeparator" stdset="0">
- <bool>true</bool>
- </property>
- <property name="maximum">
- <number>99999999</number>
- </property>
- <property name="value">
- <number>28091</number>
- </property>
- <property name="displayIntegerBase">
- <number>10</number>
- </property>
- </widget>
- </item>
- <item row="5" column="0">
- <widget class="QCheckBox" name="cbQRG5">
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string>FT8 QRG5</string>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QCheckBox" name="cbQRG3">
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string>FT8 QRG3</string>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item row="4" column="0">
- <widget class="QCheckBox" name="cbQRG4">
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string>FT8 QRG4</string>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item row="8" column="0">
- <widget class="QCheckBox" name="cbQRG8">
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string>FT8 QRG8</string>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item row="7" column="1">
- <widget class="QSpinBox" name="sbQRG7">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>57</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string>FT8 QRG7 in kHz.</string>
- </property>
- <property name="showGroupSeparator" stdset="0">
- <bool>true</bool>
- </property>
- <property name="maximum">
- <number>99999999</number>
- </property>
- <property name="value">
- <number>24911</number>
- </property>
- </widget>
- </item>
- <item row="6" column="1">
- <widget class="QSpinBox" name="sbQRG6">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>57</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string>FT8 QRG6 in kHz.</string>
- </property>
- <property name="showGroupSeparator" stdset="0">
- <bool>true</bool>
- </property>
- <property name="maximum">
- <number>99999999</number>
- </property>
- <property name="value">
- <number>21091</number>
- </property>
- </widget>
- </item>
- <item row="5" column="1">
- <widget class="QSpinBox" name="sbQRG5">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>57</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string>FT8 QRG5 in kHz.</string>
- </property>
- <property name="showGroupSeparator" stdset="0">
- <bool>true</bool>
- </property>
- <property name="maximum">
- <number>99999999</number>
- </property>
- <property name="value">
- <number>18095</number>
- </property>
- </widget>
- </item>
- <item row="4" column="1">
- <widget class="QSpinBox" name="sbQRG4">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>57</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string>FT8 QRG4 in kHz.</string>
- </property>
- <property name="showGroupSeparator" stdset="0">
- <bool>true</bool>
- </property>
- <property name="maximum">
- <number>99999999</number>
- </property>
- <property name="value">
- <number>14090</number>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QSpinBox" name="sbQRG3">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>57</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string>FT8 QRG3 in kHz.</string>
- </property>
- <property name="showGroupSeparator" stdset="0">
- <bool>true</bool>
- </property>
- <property name="maximum">
- <number>99999999</number>
- </property>
- <property name="value">
- <number>10131</number>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QSpinBox" name="sbQRG2">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>57</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string>FT8 QRG2 in kHz.</string>
- </property>
- <property name="showGroupSeparator" stdset="0">
- <bool>true</bool>
- </property>
- <property name="maximum">
- <number>99999999</number>
- </property>
- <property name="value">
- <number>7056</number>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QSpinBox" name="sbQRG1">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>57</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string>FT8 QRG1 in kHz.</string>
- </property>
- <property name="showGroupSeparator" stdset="0">
- <bool>true</bool>
- </property>
- <property name="maximum">
- <number>99999999</number>
- </property>
- <property name="singleStep">
- <number>1</number>
- </property>
- <property name="value">
- <number>3567</number>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="page_2">
- <layout class="QVBoxLayout" name="verticalLayout_5">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
- <number>0</number>
- </property>
- <item>
- <widget class="QWidget" name="widget_2" native="true">
- <layout class="QHBoxLayout" name="horizontalLayout_9">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
- <number>0</number>
- </property>
- <item>
- <widget class="QWidget" name="WSPR_controls_widget" native="true">
- <layout class="QGridLayout" name="gridLayout_9">
- <item row="1" column="0">
- <spacer name="horizontalSpacer_7">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="1" column="2">
- <spacer name="horizontalSpacer_6">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="2" column="1">
- <spacer name="verticalSpacer_2">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="1" column="1">
- <layout class="QHBoxLayout" name="horizontalLayout_12">
- <item>
- <layout class="QVBoxLayout" name="verticalLayout_7">
- <item>
- <widget class="QSpinBox" name="WSPRfreqSpinBox">
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <property name="suffix">
- <string> Hz</string>
- </property>
- <property name="prefix">
- <string>Tx </string>
- </property>
- <property name="minimum">
- <number>1400</number>
- </property>
- <property name="maximum">
- <number>1600</number>
- </property>
- <property name="value">
- <number>1500</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QSpinBox" name="sbFST4W_RxFreq">
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <property name="suffix">
- <string> Hz</string>
- </property>
- <property name="prefix">
- <string>Rx </string>
- </property>
- <property name="minimum">
- <number>100</number>
- </property>
- <property name="maximum">
- <number>4900</number>
- </property>
- <property name="singleStep">
- <number>100</number>
- </property>
- <property name="value">
- <number>1500</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="HintedSpinBox" name="sbFST4W_FTol">
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <property name="suffix">
- <string> Hz</string>
- </property>
- <property name="prefix">
- <string>F Tol </string>
- </property>
- <property name="minimum">
- <number>100</number>
- </property>
- <property name="maximum">
- <number>500</number>
- </property>
- <property name="singleStep">
- <number>100</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QComboBox" name="RoundRobin">
- <property name="editable">
- <bool>true</bool>
- </property>
- <property name="currentIndex">
- <number>0</number>
- </property>
- <item>
- <property name="text">
- <string>Random</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>1/2</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>2/2</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>1/3</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>2/3</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>3/3</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>1/4</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>2/4</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>3/4</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>4/4</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>1/5</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>2/5</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>3/5</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>4/5</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>5/5</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>1/6</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>2/6</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>3/6</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>4/6</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>5/6</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>6/6</string>
- </property>
- </item>
- </widget>
- </item>
- <item>
- <widget class="QSpinBox" name="sbTxPercent">
- <property name="toolTip">
- <string>Percentage of minute sequences devoted to transmitting.</string>
- </property>
- <property name="styleSheet">
- <string notr="true">QSpinBox:enabled[notx="true"] {
- color: rgb(0, 0, 0);
- background-color: rgb(255, 255, 0);
-}</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <property name="suffix">
- <string> %</string>
- </property>
- <property name="prefix">
- <string>Tx Pct </string>
- </property>
- <property name="maximum">
- <number>100</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="RestrictedSpinBox" name="sbTR_FST4W">
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <property name="suffix">
- <string> s</string>
- </property>
- <property name="prefix">
- <string>T/R </string>
- </property>
- <property name="minimum">
- <number>15</number>
- </property>
- <property name="maximum">
- <number>1800</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="band_hopping_group_box">
- <property name="title">
- <string>Band Hopping</string>
- </property>
- <property name="checkable">
- <bool>true</bool>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout_7">
- <item>
- <widget class="QPushButton" name="band_hopping_schedule_push_button">
- <property name="toolTip">
- <string>Choose bands and times of day for band-hopping.</string>
- </property>
- <property name="text">
- <string>Schedule ...</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QVBoxLayout" name="verticalLayout_8">
- <item>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_10">
- <item>
- <widget class="QCheckBox" name="cbUploadWSPR_Spots">
- <property name="toolTip">
- <string>Upload decoded messages to WSPRnet.org.</string>
- </property>
- <property name="styleSheet">
- <string notr="true">QCheckBox:unchecked {
- color: rgb(0, 0, 0);
- background-color: rgb(255, 255, 0);
-}</string>
- </property>
- <property name="text">
- <string>Upload spots</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QCheckBox" name="WSPR_prefer_type_1_check_box">
- <property name="toolTip">
- <string><html><head/><body><p>6 digit locators cause 2 different messages to be sent, the second contains the full locator but only a hashed callsign, other stations must have decoded the first once before they can decode your call in the second. Check this option to only send 4 digit locators if it will avoid the two message protocol.</p></body></html></string>
- </property>
- <property name="accessibleDescription">
- <string>6 digit locators cause 2 different messages to be sent, the second contains the full locator but only a hashed callsign, other stations must have decoded the first once before they can decode your call in the second. Check this option to only send 4 digit locators if it will avoid the two message protocol.</string>
- </property>
- <property name="text">
- <string>Prefer Type 1 messages</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="cbNoOwnCall">
- <property name="text">
- <string>No own call decodes</string>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_13">
- <item>
- <widget class="QPushButton" name="pbTxNext">
- <property name="toolTip">
- <string><html><head/><body><p>Transmit during the next sequence.</p></body></html></string>
- </property>
- <property name="styleSheet">
- <string notr="true">QPushButton:checked {
- color: rgb(0, 0, 0);
- background-color: red;
- border-style: outset;
- border-width: 1px;
- border-radius: 5px;
- border-color: black;
- min-width: 5em;
- padding: 3px;
-}</string>
- </property>
- <property name="text">
- <string>Tx Next</string>
- </property>
- <property name="checkable">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer_2">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_14">
- <item>
- <widget class="QComboBox" name="TxPowerComboBox">
- <property name="toolTip">
- <string>Set Tx power in dBm (dB above 1 mW) as part of your WSPR message.</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer_3">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- </layout>
- </item>
- </layout>
- </item>
- </layout>
- </item>
- <item row="0" column="1">
- <spacer name="verticalSpacer_3">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="page_3">
- <layout class="QHBoxLayout" name="horizontalLayout_17">
- <item>
- <spacer name="horizontalSpacer_4">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Expanding</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <layout class="QVBoxLayout" name="verticalLayout_12">
- <item>
- <spacer name="verticalSpacer_7">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Expanding</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <layout class="QGridLayout" name="gridLayout_2" columnstretch="3,2">
- <item row="1" column="0">
- <widget class="QRadioButton" name="rbEchoMessage">
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="text">
- <string>Message</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="HintedSpinBox" name="sbToneSpacing">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <property name="suffix">
- <string> Hz</string>
- </property>
- <property name="prefix">
- <string>Spacing </string>
- </property>
- </widget>
- </item>
- <item row="0" column="0">
- <widget class="QRadioButton" name="rbFixedTone">
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="text">
- <string>Fixed Tone</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QLineEdit" name="leEchoMessage">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="text">
- <string>K1JT</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QRadioButton" name="rbEchoCW">
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="text">
- <string>CW</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <spacer name="verticalSpacer_5">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- <item>
- <spacer name="horizontalSpacer_5">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Expanding</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- <item row="0" column="4" colspan="2">
- <widget class="QLabel" name="labDialFreq">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="focusPolicy">
- <enum>Qt::WheelFocus</enum>
- </property>
- <property name="toolTip">
- <string>USB dial frequency</string>
- </property>
- <property name="styleSheet">
- <string notr="true">QLabel {
- font-family: MS Shell Dlg 2;
- font-size: 16pt;
- color : yellow;
- background-color : black;
-}
-QLabel[oob="true"] {
- background-color: red;
-}</string>
- </property>
- <property name="text">
- <string>14.078 000</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <property name="margin">
- <number>5</number>
- </property>
- </widget>
- </item>
- <item row="1" column="3" rowspan="2">
- <layout class="QVBoxLayout" name="verticalLayout_15">
- <item>
- <widget class="QPushButton" name="houndButton">
- <property name="minimumSize">
- <size>
- <width>32</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="focusPolicy">
- <enum>Qt::StrongFocus</enum>
- </property>
- <property name="toolTip">
- <string>Toggle FT8 hound mode On/Off.<br>Right-click to activate or deactivate SuperFox mode.</string>
- </property>
- <property name="text">
- <string>H</string>
- </property>
- <property name="checkable">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="ft8Button">
- <property name="minimumSize">
- <size>
- <width>32</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="focusPolicy">
- <enum>Qt::StrongFocus</enum>
- </property>
- <property name="toolTip">
- <string>Switch to FT8 mode.<br>Right-click to toggle last used contest mode On/Off.</string>
- </property>
- <property name="text">
- <string>FT8</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="ft4Button">
- <property name="minimumSize">
- <size>
- <width>32</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string>Switch to FT4 mode</string>
- </property>
- <property name="text">
- <string>FT4</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="msk144Button">
- <property name="minimumSize">
- <size>
- <width>32</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="focusPolicy">
- <enum>Qt::StrongFocus</enum>
- </property>
- <property name="toolTip">
- <string>Switch to MSK144 mode</string>
- </property>
- <property name="text">
- <string>MSK</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="q65Button">
- <property name="minimumSize">
- <size>
- <width>32</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="focusPolicy">
- <enum>Qt::StrongFocus</enum>
- </property>
- <property name="toolTip">
- <string><html><head/><body><p>Switch to Q65 mode.<br> Right-click to switch to Q65 Pileup mode.</p></body></html></string>
- </property>
- <property name="text">
- <string>Q65</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="jt65Button">
- <property name="minimumSize">
- <size>
- <width>32</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="focusPolicy">
- <enum>Qt::StrongFocus</enum>
- </property>
- <property name="toolTip">
- <string><html><head/><body><p>Switch to JT65 mode. <br>Right-click to switch to JT9 mode.</p></body></html></string>
- </property>
- <property name="text">
- <string>JT65</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="echoButton">
- <property name="minimumSize">
- <size>
- <width>32</width>
- <height>0</height>
- </size>
- </property>
- <property name="toolTip">
- <string><html><head/><body><p>Switch to Echo mode</p></body></html></string>
- </property>
- <property name="text">
- <string>Echo</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="2" column="4" colspan="2">
- <widget class="QLabel" name="labUTC">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="styleSheet">
- <string notr="true">QLabel {
- font-family: MS Shell Dlg 2;
- font-size: 16pt;
- background-color : black;
- color : yellow;
-}</string>
- </property>
- <property name="frameShape">
- <enum>QFrame::StyledPanel</enum>
- </property>
- <property name="frameShadow">
- <enum>QFrame::Sunken</enum>
- </property>
- <property name="lineWidth">
- <number>2</number>
- </property>
- <property name="midLineWidth">
- <number>0</number>
- </property>
- <property name="text">
- <string><html><head/><body><p align="center"> 2015 Jun 17 </p><p align="center"> 01:23:45 </p></body></html></string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <property name="margin">
- <number>5</number>
- </property>
- </widget>
- </item>
- <item row="0" column="2" colspan="2">
- <layout class="QHBoxLayout" name="horizontalLayout_16" stretch="1,0">
- <item>
- <widget class="BandComboBox" name="bandComboBox">
- <property name="sizePolicy">
- <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string><html><head/><body><p>Select operating band or enter frequency in MHz or enter kHz increment followed by k.</p></body></html></string>
- </property>
- <property name="accessibleName">
- <string>Frequency entry</string>
- </property>
- <property name="accessibleDescription">
- <string>Select operating band or enter frequency in MHz or enter kHz increment followed by k.</string>
- </property>
- <property name="editable">
- <bool>true</bool>
- </property>
- <property name="maxVisibleItems">
- <number>28</number>
- </property>
- <property name="insertPolicy">
- <enum>QComboBox::NoInsert</enum>
- </property>
- <property name="sizeAdjustPolicy">
- <enum>QComboBox::AdjustToMinimumContentsLengthWithIcon</enum>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="readFreq">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="toolTip">
- <string><html><head/><body><p>If orange or red there has been a rig control failure, click to reset and read the dial frequency. S implies split mode.</p></body></html></string>
- </property>
- <property name="accessibleDescription">
- <string>If orange or red there has been a rig control failure, click to reset and read the dial frequency. S implies split mode.</string>
- </property>
- <property name="styleSheet">
- <string notr="true">QPushButton {
- font-family: helvetica;
- font-size: 9pt;
- font-weight: bold;
- background-color: white;
- color: black;
- border-style: solid;
- border-width:1px;
- border-radius:10px;
- border-color: gray;
- max-width:20px;
- max-height:20px;
- min-width:20px;
- min-height:20px;
-}
-QPushButton[state="error"] {
- background-color: red;
-}
-QPushButton[state="warning"] {
- background-color: orange;
-}
-QPushButton[state="ok"] {
- background-color: #00ff00;
-}</string>
- </property>
- <property name="text">
- <string>?</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </widget>
- <widget class="QMenuBar" name="menuBar">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>880</width>
- <height>22</height>
- </rect>
- </property>
- <widget class="QMenu" name="menuFile">
- <property name="title">
- <string>File</string>
- </property>
- <addaction name="actionOpen"/>
- <addaction name="actionOpen_next_in_directory"/>
- <addaction name="actionDecode_remaining_files_in_directory"/>
- <addaction name="separator"/>
- <addaction name="actionDelete_all_wav_files_in_SaveDir"/>
- <addaction name="actionErase_ALL_TXT"/>
- <addaction name="actionErase_wsjtx_log_adi"/>
- <addaction name="actionErase_Tx_Log"/>
- <addaction name="actionErase_Ignore_List"/>
- <addaction name="actionErase_WSPR_hashtable"/>
- <addaction name="actionErase_list_of_Q65_callers"/>
- <addaction name="reset_cabrillo_log_action"/>
- <addaction name="actionExport_Cabrillo_log"/>
- <addaction name="actionOpen_log_directory"/>
- <addaction name="separator"/>
- <addaction name="actionSettings"/>
- <addaction name="separator"/>
- <addaction name="separator"/>
- <addaction name="actionExit"/>
- </widget>
- <widget class="QMenu" name="menuView">
- <property name="title">
- <string>View</string>
- </property>
- <addaction name="actionWide_Waterfall"/>
- <addaction name="actionAstronomical_data"/>
- <addaction name="actionMessage_averaging"/>
- <addaction name="actionEcho_Graph"/>
- <addaction name="actionFast_Graph"/>
- <addaction name="contest_log_action"/>
- <addaction name="fox_log_action"/>
- <addaction name="actionColors"/>
- <addaction name="actionActiveStations"/>
- <addaction name="actionSWL_Mode"/>
- <addaction name="actionQSYMessage_Creator"/>
- <addaction name="actionQSY_Monitor"/>
- <addaction name="actionEnable_QSY_Popups"/>
- <addaction name="actionBand_Buttons"/>
- <addaction name="actionVHF_UHF_Buttons"/>
- <addaction name="actionUse_Dark_Style"/>
- </widget>
- <widget class="QMenu" name="menuFilters">
- <property name="title">
- <string>Filters</string>
- </property>
- <addaction name="actionHideB4"/>
- <addaction name="actionHideToday"/>
- <addaction name="actionHideIgnored"/>
- <addaction name="separator"/>
- <addaction name="actionIgnoreB4"/>
- <addaction name="actionIgnoreToday"/>
- <addaction name="actionIgnoreIgnored"/>
- <addaction name="separator"/>
- <addaction name="actionHideTerritory1"/>
- <addaction name="actionHideTerritory2"/>
- <addaction name="actionHideTerritory3"/>
- <addaction name="actionHideTerritory4"/>
- <addaction name="separator"/>
- <addaction name="actionHideEU"/>
- <addaction name="actionHideNA"/>
- <addaction name="actionHideSA"/>
- <addaction name="actionHideAS"/>
- <addaction name="actionHideAF"/>
- <addaction name="actionHideOC"/>
- <addaction name="actionHideAN"/>
- <addaction name="separator"/>
- <addaction name="actionHighlightB4"/>
- <addaction name="actionHighlightToday"/>
- <addaction name="actionHighlightIgnored"/>
- <addaction name="separator"/>
- <addaction name="actionHighlightTerritory1"/>
- <addaction name="actionHighlightTerritory2"/>
- <addaction name="actionHighlightTerritory3"/>
- <addaction name="actionHighlightTerritory4"/>
- </widget>
- <widget class="QMenu" name="menuDecode">
- <property name="title">
- <string>Decode</string>
- </property>
- <widget class="QMenu" name="menuParameters">
- <property name="title">
- <string>Parameters</string>
- </property>
- <widget class="QMenu" name="menuDecoder_sensitivity">
- <property name="title">
- <string>Decoder sensitivity</string>
- </property>
- <addaction name="actionFT8SensMin"/>
- <addaction name="actionlowFT8thresholds"/>
- <addaction name="actionFT8subpass"/>
- </widget>
- <widget class="QMenu" name="menuDecoder_start">
- <property name="title">
- <string>Decoder start</string>
- </property>
- <addaction name="actionStartTwoStage"/>
- <addaction name="actionStartThreeStage"/>
- <addaction name="actionStartEarly"/>
- <addaction name="actionStartNormal"/>
- <addaction name="actionStartLate"/>
- </widget>
- <widget class="QMenu" name="menuFT8_threads">
- <property name="title">
- <string>Number of threads</string>
- </property>
- <addaction name="actionMTAuto"/>
- <addaction name="actionMT1"/>
- <addaction name="actionMT2"/>
- <addaction name="actionMT3"/>
- <addaction name="actionMT4"/>
- <addaction name="actionMT5"/>
- <addaction name="actionMT6"/>
- <addaction name="actionMT7"/>
- <addaction name="actionMT8"/>
- <addaction name="actionMT9"/>
- <addaction name="actionMT10"/>
- <addaction name="actionMT11"/>
- <addaction name="actionMT12"/>
- </widget>
- <widget class="QMenu" name="menuQSO_RX_freq_sensitivity">
- <property name="title">
- <string>QSO RX freq sensitivity</string>
- </property>
- <addaction name="actionRXfLow"/>
- <addaction name="actionRXfMedium"/>
- <addaction name="actionRXfHigh"/>
- </widget>
- <widget class="QMenu" name="menuDecoding_cycles">
- <property name="title">
- <string>Decoding cycles</string>
- </property>
- <addaction name="actionDecFT8cycles1"/>
- <addaction name="actionDecFT8cycles2"/>
- <addaction name="actionDecFT8cycles3"/>
- </widget>
- <addaction name="menuFT8_threads"/>
- <addaction name="menuDecoding_cycles"/>
- <addaction name="menuQSO_RX_freq_sensitivity"/>
- <addaction name="menuDecoder_sensitivity"/>
- <addaction name="menuDecoder_start"/>
- <addaction name="separator"/>
- <addaction name="actionFT8WidebandDXCallSearch"/>
- <addaction name="actionHide_FT8_dupe_messages"/>
- </widget>
- <addaction name="actionQuickDecode"/>
- <addaction name="actionMediumDecode"/>
- <addaction name="actionDeepestDecode"/>
- <addaction name="separator"/>
- <addaction name="actionUse_multithreaded_FT8_decoder"/>
- <addaction name="menuParameters"/>
- <addaction name="separator"/>
- <addaction name="actionInclude_averaging"/>
- <addaction name="actionInclude_correlation"/>
- <addaction name="actionEnable_AP_FT8"/>
- <addaction name="actionEnable_AP_JT65"/>
- <addaction name="actionEnable_AP_DXcall"/>
- <addaction name="actionAuto_Clear_Avg"/>
- <addaction name="actionDisable_clicks_on_waterfall"/>
- <addaction name="actionReduce_false_decodes"/>
- <addaction name="separator"/>
- <addaction name="actionFull_Duplex_Mode"/>
- </widget>
- <widget class="QMenu" name="menuSave">
- <property name="title">
- <string>Save</string>
- </property>
- <addaction name="actionNone"/>
- <addaction name="actionSave_decoded"/>
- <addaction name="actionSave_all"/>
- <addaction name="actionRemove_after_30days"/>
- <addaction name="separator"/>
- <addaction name="actionDon_t_split_ALL_TXT"/>
- <addaction name="actionSplit_ALL_TXT_yearly"/>
- <addaction name="actionSplit_ALL_TXT_monthly"/>
- <addaction name="actionDisable_writing_of_ALL_TXT"/>
- <addaction name="separator"/>
- <addaction name="actionDefault_event_logging"/>
- <addaction name="actionDiagnostic_mode"/>
- <addaction name="actionDisable_event_logging"/>
- </widget>
- <widget class="QMenu" name="menuHelp">
- <property name="title">
- <string>Help</string>
- </property>
- <addaction name="actionRelease_Notes"/>
- <addaction name="actionOnline_User_Guide"/>
- <addaction name="actionLocal_User_Guide"/>
- <addaction name="actionFT8_DXpedition_Mode_User_Guide"/>
- <addaction name="actionSuperFox_User_Guide"/>
- <addaction name="actionQSG_FST4"/>
- <addaction name="actionQSG_Q65"/>
- <addaction name="actionQSG_X250_M3"/>
- <addaction name="actionQuick_Start_Guide_to_WSJT_X_2_7_and_QMAP"/>
- <addaction name="download_samples_action"/>
- <addaction name="separator"/>
- <addaction name="actionWSJT_X_improved_Home_Page"/>
- <addaction name="actionThe_additional_features_of_wsjt_x_improved"/>
- <addaction name="actionRecommended_Audio_Settings"/>
- <addaction name="actionRig_Control_Errors"/>
- <addaction name="separator"/>
- <addaction name="actionKeyboard_shortcuts"/>
- <addaction name="actionSpecial_mouse_commands"/>
- <addaction name="actionShort_list_of_add_on_prefixes_and_suffixes"/>
- <addaction name="separator"/>
- <addaction name="actionCopyright_Notice"/>
- <addaction name="separator"/>
- <addaction name="actionAbout"/>
- </widget>
- <widget class="QMenu" name="menuMode">
- <property name="title">
- <string>Mode</string>
- </property>
- <addaction name="actionFST4"/>
- <addaction name="actionFT4"/>
- <addaction name="actionFT8"/>
- <addaction name="actionJT4"/>
- <addaction name="actionJT9"/>
- <addaction name="actionJT65"/>
- <addaction name="actionQ65"/>
- <addaction name="separator"/>
- <addaction name="actionMSK144"/>
- <addaction name="separator"/>
- <addaction name="actionFST4W"/>
- <addaction name="actionWSPR"/>
- <addaction name="separator"/>
- <addaction name="actionEcho"/>
- <addaction name="separator"/>
- <addaction name="actionFreqCal"/>
- </widget>
- <widget class="QMenu" name="menuConfig">
- <property name="title">
- <string>Configurations</string>
- </property>
- </widget>
- <widget class="QMenu" name="menuTools">
- <property name="title">
- <string>Tools</string>
- </property>
- <addaction name="actionErase_reference_spectrum"/>
- <addaction name="actionMeasure_reference_spectrum"/>
- <addaction name="separator"/>
- <addaction name="actionMeasure_phase_response"/>
- <addaction name="view_phase_response_action"/>
- <addaction name="separator"/>
- <addaction name="actionFrequency_calibration"/>
- <addaction name="actionSolve_FreqCal"/>
- </widget>
- <addaction name="menuFile"/>
- <addaction name="menuConfig"/>
- <addaction name="menuView"/>
- <addaction name="menuFilters"/>
- <addaction name="menuMode"/>
- <addaction name="menuDecode"/>
- <addaction name="menuSave"/>
- <addaction name="menuTools"/>
- <addaction name="menuHelp"/>
- </widget>
- <widget class="QStatusBar" name="statusBar"/>
- <action name="actionExit">
- <property name="text">
- <string>Exit</string>
- </property>
- <property name="menuRole">
- <enum>QAction::QuitRole</enum>
- </property>
- </action>
- <action name="actionAbout">
- <property name="text">
- <string>About WSJT-X</string>
- </property>
- <property name="menuRole">
- <enum>QAction::AboutRole</enum>
- </property>
- </action>
- <action name="actionWide_Waterfall">
- <property name="text">
- <string>Waterfall</string>
- </property>
- </action>
- <action name="actionOpen">
- <property name="text">
- <string>Open</string>
- </property>
- <property name="shortcut">
- <string>Ctrl+O</string>
- </property>
- </action>
- <action name="actionOpen_next_in_directory">
- <property name="text">
- <string>Open next in directory</string>
- </property>
- </action>
- <action name="actionDecode_remaining_files_in_directory">
- <property name="text">
- <string>Decode remaining files in directory</string>
- </property>
- <property name="shortcut">
- <string>Shift+F6</string>
- </property>
- </action>
- <action name="actionDelete_all_wav_files_in_SaveDir">
- <property name="text">
- <string>Delete all *.wav && *.c2 files in SaveDir</string>
- </property>
- </action>
- <action name="actionQuickDecode">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="checked">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>Fast</string>
- </property>
- </action>
- <action name="actionNone">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>None</string>
- </property>
- </action>
- <action name="actionSave_all">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Save all</string>
- </property>
- </action>
- <action name="actionRemove_after_30days">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Remove saved files after 30 days</string>
- </property>
- </action>
- <action name="actionOnline_User_Guide">
- <property name="text">
- <string>Online User Guide</string>
- </property>
- </action>
- <action name="actionKeyboard_shortcuts">
- <property name="text">
- <string>Keyboard shortcuts</string>
- </property>
- </action>
- <action name="actionSpecial_mouse_commands">
- <property name="text">
- <string>Special mouse commands</string>
- </property>
- </action>
- <action name="actionJT9">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>JT9</string>
- </property>
- </action>
- <action name="actionSave_decoded">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Save decoded</string>
- </property>
- </action>
- <action name="actionMediumDecode">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="checked">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>Normal</string>
- </property>
- </action>
- <action name="actionDeepestDecode">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Deep</string>
- </property>
- </action>
- <action name="actionErase_ALL_TXT">
- <property name="text">
- <string>Erase ALL.TXT</string>
- </property>
- </action>
- <action name="actionErase_wsjtx_log_adi">
- <property name="text">
- <string>Erase wsjtx_log.adi</string>
- </property>
- </action>
- <action name="actionErase_Tx_Log">
- <property name="text">
- <string>Erase wsjtx.log</string>
- </property>
- </action>
- <action name="actionErase_Ignore_List">
- <property name="text">
- <string>Erase Ignore List</string>
- </property>
- </action>
- <action name="actionJT65">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>JT65</string>
- </property>
- </action>
- <action name="actionAstronomical_data">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Astronomical data</string>
- </property>
- </action>
- <action name="actionShort_list_of_add_on_prefixes_and_suffixes">
- <property name="text">
- <string>List of Type 1 prefixes and suffixes</string>
- </property>
- </action>
- <action name="actionSettings">
- <property name="text">
- <string>Settings...</string>
- </property>
- <property name="menuRole">
- <enum>QAction::PreferencesRole</enum>
- </property>
- </action>
- <action name="actionLocal_User_Guide">
- <property name="text">
- <string>Local User Guide</string>
- </property>
- </action>
- <action name="actionOpen_log_directory">
- <property name="text">
- <string>Open log directory</string>
- </property>
- </action>
- <action name="actionJT4">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>JT4</string>
- </property>
- </action>
- <action name="actionMessage_averaging">
- <property name="text">
- <string>Message averaging</string>
- </property>
- <property name="shortcut">
- <string>F7</string>
- </property>
- </action>
- <action name="actionInclude_averaging">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Enable averaging</string>
- </property>
- </action>
- <action name="actionInclude_correlation">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Enable deep search</string>
- </property>
- </action>
- <action name="actionWSPR">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>WSPR</string>
- </property>
- </action>
- <action name="actionEcho_Graph">
- <property name="text">
- <string>Echo Graph</string>
- </property>
- <property name="shortcut">
- <string>F8</string>
- </property>
- </action>
- <action name="actionEcho">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Echo</string>
- </property>
- <property name="toolTip">
- <string>EME Echo mode</string>
- </property>
- </action>
- <action name="actionISCAT">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>ISCAT</string>
- </property>
- </action>
- <action name="actionFast_Graph">
- <property name="text">
- <string>Fast Graph</string>
- </property>
- <property name="shortcut">
- <string>F9</string>
- </property>
- </action>
- <action name="download_samples_action">
- <property name="text">
- <string>&Download Samples ...</string>
- </property>
- <property name="whatsThis">
- <string><html><head/><body><p>Download sample audio files demonstrating the various modes.</p></body></html></string>
- </property>
- </action>
- <action name="actionMSK144">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>MSK144</string>
- </property>
- </action>
- <action name="actionQRA64">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>QRA64</string>
- </property>
- </action>
- <action name="actionRelease_Notes">
- <property name="text">
- <string>Release Notes</string>
- </property>
- </action>
- <action name="actionEnable_AP_DXcall">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Enable AP for DX Call</string>
- </property>
- </action>
- <action name="actionFreqCal">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>FreqCal</string>
- </property>
- </action>
- <action name="actionMeasure_reference_spectrum">
- <property name="text">
- <string>Measure reference spectrum</string>
- </property>
- </action>
- <action name="actionMeasure_phase_response">
- <property name="text">
- <string>Measure phase response</string>
- </property>
- </action>
- <action name="actionErase_reference_spectrum">
- <property name="text">
- <string>Erase reference spectrum</string>
- </property>
- </action>
- <action name="actionFrequency_calibration">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Execute frequency calibration cycle</string>
- </property>
- </action>
- <action name="view_phase_response_action">
- <property name="text">
- <string>Equalization tools ...</string>
- </property>
- </action>
- <action name="actionFT8">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>FT8</string>
- </property>
- </action>
- <action name="actionEnable_AP_FT8">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Enable AP</string>
- </property>
- </action>
- <action name="actionEnable_AP_JT65">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Enable AP</string>
- </property>
- </action>
- <action name="actionSolve_FreqCal">
- <property name="text">
- <string>Solve for calibration parameters</string>
- </property>
- </action>
- <action name="actionCopyright_Notice">
- <property name="text">
- <string>Copyright notice</string>
- </property>
- <property name="shortcut">
- <string>Shift+F1</string>
- </property>
- </action>
- <action name="fox_log_action">
- <property name="checkable">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>Fox log</string>
- </property>
- </action>
- <action name="actionFT8_DXpedition_Mode_User_Guide">
- <property name="text">
- <string>FT8 DXpedition Mode User Guide</string>
- </property>
- </action>
- <action name="reset_cabrillo_log_action">
- <property name="text">
- <string>Reset Cabrillo log ...</string>
- </property>
- </action>
- <action name="actionColors">
- <property name="text">
- <string>Color highlighting scheme</string>
- </property>
- </action>
- <action name="actionExport_Cabrillo_log">
- <property name="text">
- <string>Export Cabrillo log ...</string>
- </property>
- </action>
- <action name="actionQSG_FST4">
- <property name="text">
- <string>Quick-Start Guide to FST4 and FST4W</string>
- </property>
- </action>
- <action name="contest_log_action">
- <property name="text">
- <string>Contest log</string>
- </property>
- </action>
- <action name="actionErase_WSPR_hashtable">
- <property name="text">
- <string>Erase WSPR hashtable</string>
- </property>
- </action>
- <action name="actionFT4">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>FT4</string>
- </property>
- </action>
- <action name="actionFST4">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>FST4</string>
- </property>
- </action>
- <action name="actionFST4W">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>FST4W</string>
- </property>
- </action>
- <action name="actionQ65">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Q65</string>
- </property>
- </action>
- <action name="actionSWL_Mode">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>SWL Mode</string>
- </property>
- <property name="toolTip">
- <string>Hide lower panel controls to maximize deocde windows</string>
- </property>
- </action>
- <action name="actionQSG_Q65">
- <property name="text">
- <string>Quick-Start Guide to Q65</string>
- </property>
- </action>
- <action name="actionAuto_Clear_Avg">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Auto Clear Avg after decode</string>
- </property>
- </action>
- <action name="actionQSG_X250_M3">
- <property name="text">
- <string>Quick-Start Guide to WSJT-X 2.5.0 and MAP65 3.0</string>
- </property>
- </action>
- <action name="actionDon_t_split_ALL_TXT">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Don't split ALL.TXT</string>
- </property>
- </action>
- <action name="actionSplit_ALL_TXT_yearly">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Split ALL.TXT yearly</string>
- </property>
- </action>
- <action name="actionSplit_ALL_TXT_monthly">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Split ALL.TXT monthly</string>
- </property>
- </action>
- <action name="actionDisable_writing_of_ALL_TXT">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Disable writing of ALL.TXT</string>
- </property>
- </action>
- <action name="actionActiveStations">
- <property name="text">
- <string>Active Stations</string>
- </property>
- </action>
- <action name="actionBand_Buttons">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="checked">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>Band Buttons</string>
- </property>
- </action>
- <action name="actionUse_Dark_Style">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Use Dark Style</string>
- </property>
- </action>
- <action name="actionReduce_false_decodes">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Reduce false decodes</string>
- </property>
- </action>
- <action name="actionDefault_event_logging">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Default event logging</string>
- </property>
- </action>
- <action name="actionDiagnostic_mode">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Diagnostic mode</string>
- </property>
- </action>
- <action name="actionDisable_event_logging">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Disable event logging</string>
- </property>
- </action>
- <action name="actionQuick_Start_Guide_to_WSJT_X_2_7_and_QMAP">
- <property name="text">
- <string>Quick-Start Guide to WSJT-X 2.7 and QMAP</string>
- </property>
- </action>
- <action name="actionWSJT_X_improved_Home_Page">
- <property name="text">
- <string>WSJT-X_improved Home Page</string>
- </property>
- <property name="whatsThis">
- <string><html><head/><body><p>Go to the wsjt-x_improved home page.</p></body></html></string>
- </property>
- </action>
- <action name="actionThe_additional_features_of_wsjt_x_improved">
- <property name="text">
- <string>The additional features of wsjt-x_improved</string>
- </property>
- <property name="whatsThis">
- <string><html><head/><body><p>Overview on the additional features of wsjt-x_improved.</p></body></html></string>
- </property>
- </action>
- <action name="actionRecommended_Audio_Settings">
- <property name="text">
- <string>Recommended audio settings</string>
- </property>
- <property name="whatsThis">
- <string><html><head/><body><p>Recommended Audio Settings.</p></body></html></string>
- </property>
- </action>
- <action name="actionRig_Control_Errors">
- <property name="text">
- <string>How to deal with rig control errors</string>
- </property>
- <property name="whatsThis">
- <string><html><head/><body><p>How to deal with rig control errors.</p></body></html></string>
- </property>
- </action>
- <action name="actionErase_list_of_Q65_callers">
- <property name="text">
- <string>Erase list of Q65 callers</string>
- </property>
- </action>
- <action name="actionSuperFox_User_Guide">
- <property name="text">
- <string>SuperFox User Guide</string>
- </property>
- </action>
- <action name="actionQSYMessage_Creator">
- <property name="checkable">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>Message Creator</string>
- </property>
- </action>
- <action name="actionHideB4">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Hide stations worked before on band</string>
- </property>
- </action>
- <action name="actionHideToday">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Hide stations worked today or yesterday</string>
- </property>
- </action>
- <action name="actionHideIgnored">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Hide stations from Ignore List</string>
- </property>
- </action>
- <action name="actionIgnoreToday">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Ignore stations worked today or yesterday</string>
- </property>
- </action>
- <action name="actionIgnoreIgnored">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Ignore stations from Ignore List</string>
- </property>
- </action>
- <action name="actionHideTerritory1">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Hide stations from Territory 1</string>
- </property>
- </action>
- <action name="actionHideTerritory2">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Hide stations from Territory 2</string>
- </property>
- </action>
- <action name="actionHideTerritory3">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Hide stations from Territory 3</string>
- </property>
- </action>
- <action name="actionHideTerritory4">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Hide stations from Territory 4</string>
- </property>
- </action>
- <action name="actionHideEU">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Hide stations from Europe</string>
- </property>
- </action>
- <action name="actionHideNA">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Hide stations from North America</string>
- </property>
- </action>
- <action name="actionHideSA">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Hide stations from South America</string>
- </property>
- </action>
- <action name="actionHideAS">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Hide stations from Asia</string>
- </property>
- </action>
- <action name="actionHideAF">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Hide stations from Africa</string>
- </property>
- </action>
- <action name="actionHideOC">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Hide stations from Oceania</string>
- </property>
- </action>
- <action name="actionHideAN">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Hide stations from Antarctica</string>
- </property>
- </action>
- <action name="actionFull_Duplex_Mode">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Full Duplex Mode</string>
- </property>
- </action>
- <action name="actionHighlightB4">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Highlight callsigns worked before on band</string>
- </property>
- </action>
- <action name="actionHighlightToday">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Highlight callsigns worked today or yesterday</string>
- </property>
- </action>
- <action name="actionHighlightIgnored">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Highlight callsigns from Ignore List</string>
- </property>
- </action>
- <action name="actionEnable_QSY_Popups">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="checked">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>Enable Message Popups</string>
- </property>
- </action>
- <action name="actionQSY_Monitor">
- <property name="checkable">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>QSY Monitor</string>
- </property>
- </action>
- <action name="actionIgnoreB4">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Ignore stations worked before on band</string>
- </property>
- </action>
- <action name="actionUse_multithreaded_FT8_decoder">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Use multithreaded FT8 decoder</string>
- </property>
- </action>
- <action name="actionMTAuto">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Auto</string>
- </property>
- </action>
- <action name="actionMT1">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>1</string>
- </property>
- </action>
- <action name="actionMT2">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>2</string>
- </property>
- <property name="iconText">
- <string>2</string>
- </property>
- </action>
- <action name="actionMT3">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>3</string>
- </property>
- <property name="iconText">
- <string>3</string>
- </property>
- </action>
- <action name="actionMT4">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>4</string>
- </property>
- </action>
- <action name="actionMT5">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>5</string>
- </property>
- <property name="iconText">
- <string>5</string>
- </property>
- </action>
- <action name="actionMT6">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>6</string>
- </property>
- <property name="iconText">
- <string>6</string>
- </property>
- </action>
- <action name="actionMT7">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>7</string>
- </property>
- <property name="iconText">
- <string>7</string>
- </property>
- </action>
- <action name="actionMT8">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>8</string>
- </property>
- </action>
- <action name="actionMT9">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>9</string>
- </property>
- <property name="iconText">
- <string>9</string>
- </property>
- </action>
- <action name="actionMT10">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>10</string>
- </property>
- <property name="iconText">
- <string>10</string>
- </property>
- </action>
- <action name="actionMT11">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>11</string>
- </property>
- <property name="iconText">
- <string>11</string>
- </property>
- </action>
- <action name="actionMT12">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>12</string>
- </property>
- </action>
- <action name="actionRXfLow">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Low</string>
- </property>
- </action>
- <action name="actionRXfMedium">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Medium</string>
- </property>
- </action>
- <action name="actionRXfHigh">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>High</string>
- </property>
- </action>
- <action name="actionDecFT8cycles1">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>1</string>
- </property>
- </action>
- <action name="actionDecFT8cycles2">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>2</string>
- </property>
- </action>
- <action name="actionDecFT8cycles3">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>3</string>
- </property>
- </action>
- <action name="actionFT8SensMin">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Minimum</string>
- </property>
- </action>
- <action name="actionlowFT8thresholds">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Use low thresholds</string>
- </property>
- </action>
- <action name="actionFT8subpass">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Use subpass</string>
- </property>
- </action>
- <action name="actionStartTwoStage">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>2-Stage</string>
- </property>
- </action>
- <action name="actionStartThreeStage">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>3-Stage</string>
- </property>
- </action>
- <action name="actionStartEarly">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Early</string>
- </property>
- </action>
- <action name="actionStartNormal">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Normal</string>
- </property>
- </action>
- <action name="actionStartLate">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Late</string>
- </property>
- </action>
- <action name="actionFT8WidebandDXCallSearch">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Wideband DX Call search</string>
- </property>
- </action>
- <action name="actionHide_FT8_dupe_messages">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Hide FT8 dupe messages</string>
- </property>
- </action>
- <action name="actionVHF_UHF_Buttons">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>VHF / UHF Buttons</string>
- </property>
- </action>
- <action name="actionHighlightTerritory1">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Highlight stations from Territory 1</string>
- </property>
- </action>
- <action name="actionHighlightTerritory2">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Highlight stations from Territory 2</string>
- </property>
- </action>
- <action name="actionHighlightTerritory3">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Highlight stations from Territory 3</string>
- </property>
- </action>
- <action name="actionHighlightTerritory4">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Highlight stations from Territory 4</string>
- </property>
- </action>
- <action name="actionDisable_clicks_on_waterfall">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Disable clicks on waterfall</string>
- </property>
- </action>
- </widget>
- <layoutdefault spacing="6" margin="11"/>
- <customwidgets>
- <customwidget>
- <class>DisplayText</class>
- <extends>QTextBrowser</extends>
- <header>widgets/displaytext.h</header>
- </customwidget>
- <customwidget>
- <class>LettersSpinBox</class>
- <extends>QSpinBox</extends>
- <header>widgets/LettersSpinBox.hpp</header>
- </customwidget>
- <customwidget>
- <class>SignalMeter</class>
- <extends>QFrame</extends>
- <header>widgets/signalmeter.h</header>
- <container>1</container>
- </customwidget>
- <customwidget>
- <class>HintedSpinBox</class>
- <extends>QSpinBox</extends>
- <header>widgets/HintedSpinBox.hpp</header>
- </customwidget>
- <customwidget>
- <class>RestrictedSpinBox</class>
- <extends>QSpinBox</extends>
- <header>widgets/RestrictedSpinBox.hpp</header>
- </customwidget>
- <customwidget>
- <class>DoubleClickableRadioButton</class>
- <extends>QRadioButton</extends>
- <header>widgets/DoubleClickableRadioButton.hpp</header>
- </customwidget>
- <customwidget>
- <class>DoubleClickablePushButton</class>
- <extends>QPushButton</extends>
- <header>widgets/DoubleClickablePushButton.hpp</header>
- </customwidget>
- <customwidget>
- <class>BandComboBox</class>
- <extends>QComboBox</extends>
- <header>widgets/BandComboBox.hpp</header>
- </customwidget>
- </customwidgets>
- <tabstops>
- <tabstop>decodedTextBrowser</tabstop>
- <tabstop>decodedTextBrowser2</tabstop>
- <tabstop>cbCQonly</tabstop>
- <tabstop>logQSOButton</tabstop>
- <tabstop>stopButton</tabstop>
- <tabstop>monitorButton</tabstop>
- <tabstop>EraseButton</tabstop>
- <tabstop>ClrAvgButton</tabstop>
- <tabstop>DecodeButton</tabstop>
- <tabstop>autoButton</tabstop>
- <tabstop>stopTxButton</tabstop>
- <tabstop>tuneButton</tabstop>
- <tabstop>cbMenus</tabstop>
- <tabstop>sbNB</tabstop>
- <tabstop>dxCallEntry</tabstop>
- <tabstop>dxGridEntry</tabstop>
- <tabstop>txFirstCheckBox</tabstop>
- <tabstop>TxFreqSpinBox</tabstop>
- <tabstop>pbR2T</tabstop>
- <tabstop>sbFtol</tabstop>
- <tabstop>pbT2R</tabstop>
- <tabstop>RxFreqSpinBox</tabstop>
- <tabstop>rptSpinBox</tabstop>
- <tabstop>sbTR</tabstop>
- <tabstop>cbHoldTxFreq</tabstop>
- <tabstop>sbF_Low</tabstop>
- <tabstop>sbF_High</tabstop>
- <tabstop>sbSubmode</tabstop>
- <tabstop>syncSpinBox</tabstop>
- <tabstop>sbCQTxFreq</tabstop>
- <tabstop>cbCQTx</tabstop>
- <tabstop>cbRxAll</tabstop>
- <tabstop>cbShMsgs</tabstop>
- <tabstop>cbFast9</tabstop>
- <tabstop>cbAutoSeq</tabstop>
- <tabstop>cbTx6</tabstop>
- <tabstop>cbSWL</tabstop>
- <tabstop>pbBestSP</tabstop>
- <tabstop>measure_check_box</tabstop>
- <tabstop>tabWidget</tabstop>
- <tabstop>genStdMsgsPushButton</tabstop>
- <tabstop>tx1</tabstop>
- <tabstop>txrb1</tabstop>
- <tabstop>txb1</tabstop>
- <tabstop>tx2</tabstop>
- <tabstop>txrb2</tabstop>
- <tabstop>txb2</tabstop>
- <tabstop>tx3</tabstop>
- <tabstop>txrb3</tabstop>
- <tabstop>txb3</tabstop>
- <tabstop>tx4</tabstop>
- <tabstop>txrb4</tabstop>
- <tabstop>txb4</tabstop>
- <tabstop>tx5</tabstop>
- <tabstop>txrb5</tabstop>
- <tabstop>txb5</tabstop>
- <tabstop>tx6</tabstop>
- <tabstop>txrb6</tabstop>
- <tabstop>txb6</tabstop>
- <tabstop>WSPRfreqSpinBox</tabstop>
- <tabstop>sbFST4W_RxFreq</tabstop>
- <tabstop>sbFST4W_FTol</tabstop>
- <tabstop>RoundRobin</tabstop>
- <tabstop>sbTxPercent</tabstop>
- <tabstop>sbTR_FST4W</tabstop>
- <tabstop>band_hopping_group_box</tabstop>
- <tabstop>band_hopping_schedule_push_button</tabstop>
- <tabstop>cbUploadWSPR_Spots</tabstop>
- <tabstop>WSPR_prefer_type_1_check_box</tabstop>
- <tabstop>cbNoOwnCall</tabstop>
- <tabstop>pbTxNext</tabstop>
- <tabstop>TxPowerComboBox</tabstop>
- <tabstop>outAttenuation</tabstop>
- <tabstop>sbSerialNumber</tabstop>
- </tabstops>
- <resources/>
- <connections/>
-</ui>
+<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>MainWindow</class> + <widget class="QMainWindow" name="MainWindow"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>880</width> + <height>685</height> + </rect> + </property> + <property name="minimumSize"> + <size> + <width>750</width> + <height>0</height> + </size> + </property> + <property name="windowTitle"> + <string>WSJT-X by K1JT</string> + </property> + <property name="toolTip"> + <string/> + </property> + <property name="styleSheet"> + <string notr="true"/> + </property> + <widget class="QWidget" name="centralWidget"> + <layout class="QVBoxLayout" name="verticalLayout_6" stretch="0,0"> + <item> + <widget class="QSplitter" name="decodes_splitter"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <widget class="QWidget" name="layoutWidget"> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <item> + <widget class="QLabel" name="lh_decodes_title_label"> + <property name="maximumSize"> + <size> + <width>500</width> + <height>16777215</height> + </size> + </property> + <property name="font"> + <font> + <pointsize>10</pointsize> + <bold>false</bold> + </font> + </property> + <property name="text"> + <string>Band Activity</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="lh_decodes_headings_label"> + <property name="minimumSize"> + <size> + <width>300</width> + <height>20</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>20</height> + </size> + </property> + <property name="palette"> + <palette> + <active> + <colorrole role="Base"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>252</red> + <green>252</green> + <blue>252</blue> + </color> + </brush> + </colorrole> + <colorrole role="Window"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>170</red> + <green>170</green> + <blue>170</blue> + </color> + </brush> + </colorrole> + </active> + <inactive> + <colorrole role="Base"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>252</red> + <green>252</green> + <blue>252</blue> + </color> + </brush> + </colorrole> + <colorrole role="Window"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>170</red> + <green>170</green> + <blue>170</blue> + </color> + </brush> + </colorrole> + </inactive> + <disabled> + <colorrole role="Base"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>170</red> + <green>170</green> + <blue>170</blue> + </color> + </brush> + </colorrole> + <colorrole role="Window"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>170</red> + <green>170</green> + <blue>170</blue> + </color> + </brush> + </colorrole> + </disabled> + </palette> + </property> + <property name="autoFillBackground"> + <bool>true</bool> + </property> + <property name="text"> + <string>UTC dB DT Freq Dr </string> + </property> + <property name="textFormat"> + <enum>Qt::PlainText</enum> + </property> + <property name="indent"> + <number>5</number> + </property> + </widget> + </item> + <item> + <widget class="DisplayText" name="decodedTextBrowser"> + <property name="frameShape"> + <enum>QFrame::StyledPanel</enum> + </property> + <property name="verticalScrollBarPolicy"> + <enum>Qt::ScrollBarAlwaysOn</enum> + </property> + <property name="horizontalScrollBarPolicy"> + <enum>Qt::ScrollBarAsNeeded</enum> + </property> + <property name="cursorWidth"> + <number>0</number> + </property> + <property name="textInteractionFlags"> + <set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set> + </property> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="rh_decodes_widget" native="true"> + <layout class="QVBoxLayout" name="verticalLayout_9"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="QLabel" name="rh_decodes_title_label"> + <property name="font"> + <font> + <pointsize>10</pointsize> + <bold>false</bold> + </font> + </property> + <property name="text"> + <string>Rx Frequency</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="rh_decodes_headings_label"> + <property name="minimumSize"> + <size> + <width>300</width> + <height>20</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>20</height> + </size> + </property> + <property name="palette"> + <palette> + <active> + <colorrole role="Base"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>252</red> + <green>252</green> + <blue>252</blue> + </color> + </brush> + </colorrole> + <colorrole role="Window"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>170</red> + <green>170</green> + <blue>170</blue> + </color> + </brush> + </colorrole> + </active> + <inactive> + <colorrole role="Base"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>252</red> + <green>252</green> + <blue>252</blue> + </color> + </brush> + </colorrole> + <colorrole role="Window"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>170</red> + <green>170</green> + <blue>170</blue> + </color> + </brush> + </colorrole> + </inactive> + <disabled> + <colorrole role="Base"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>170</red> + <green>170</green> + <blue>170</blue> + </color> + </brush> + </colorrole> + <colorrole role="Window"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>170</red> + <green>170</green> + <blue>170</blue> + </color> + </brush> + </colorrole> + </disabled> + </palette> + </property> + <property name="autoFillBackground"> + <bool>true</bool> + </property> + <property name="text"> + <string>UTC dB DT Freq Dr </string> + </property> + <property name="textFormat"> + <enum>Qt::PlainText</enum> + </property> + <property name="indent"> + <number>5</number> + </property> + </widget> + </item> + <item> + <widget class="DisplayText" name="decodedTextBrowser2"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="verticalScrollBarPolicy"> + <enum>Qt::ScrollBarAlwaysOn</enum> + </property> + <property name="cursorWidth"> + <number>0</number> + </property> + <property name="textInteractionFlags"> + <set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set> + </property> + </widget> + </item> + </layout> + </widget> + </widget> + </item> + <item> + <widget class="QWidget" name="lower_panel_widget" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <layout class="QVBoxLayout" name="verticalLayout_4"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <layout class="QGridLayout" name="Band_buttons_Layout"> + <property name="spacing"> + <number>3</number> + </property> + <item row="0" column="3"> + <widget class="QPushButton" name="pb40"> + <property name="minimumSize"> + <size> + <width>20</width> + <height>0</height> + </size> + </property> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> + <property name="text"> + <string>40</string> + </property> + </widget> + </item> + <item row="0" column="9"> + <widget class="QPushButton" name="pb10"> + <property name="minimumSize"> + <size> + <width>20</width> + <height>0</height> + </size> + </property> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> + <property name="text"> + <string>10</string> + </property> + </widget> + </item> + <item row="0" column="6"> + <widget class="QPushButton" name="pb17"> + <property name="minimumSize"> + <size> + <width>20</width> + <height>0</height> + </size> + </property> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> + <property name="text"> + <string>17</string> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QPushButton" name="pb60"> + <property name="minimumSize"> + <size> + <width>20</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>60</string> + </property> + </widget> + </item> + <item row="0" column="8"> + <widget class="QPushButton" name="pb12"> + <property name="minimumSize"> + <size> + <width>20</width> + <height>0</height> + </size> + </property> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> + <property name="text"> + <string>12</string> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QPushButton" name="pb160"> + <property name="minimumSize"> + <size> + <width>25</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>160</string> + </property> + </widget> + </item> + <item row="0" column="5"> + <widget class="QPushButton" name="pb20"> + <property name="minimumSize"> + <size> + <width>20</width> + <height>0</height> + </size> + </property> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> + <property name="text"> + <string>20</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QPushButton" name="pb80"> + <property name="minimumSize"> + <size> + <width>20</width> + <height>0</height> + </size> + </property> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> + <property name="text"> + <string>80</string> + </property> + </widget> + </item> + <item row="0" column="13"> + <widget class="QPushButton" name="pb70"> + <property name="minimumSize"> + <size> + <width>20</width> + <height>0</height> + </size> + </property> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> + <property name="text"> + <string>70</string> + </property> + </widget> + </item> + <item row="0" column="7"> + <widget class="QPushButton" name="pb15"> + <property name="minimumSize"> + <size> + <width>20</width> + <height>0</height> + </size> + </property> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> + <property name="text"> + <string>15</string> + </property> + </widget> + </item> + <item row="0" column="11"> + <widget class="QPushButton" name="pb2"> + <property name="minimumSize"> + <size> + <width>15</width> + <height>0</height> + </size> + </property> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> + <property name="text"> + <string>2</string> + </property> + </widget> + </item> + <item row="0" column="4"> + <widget class="QPushButton" name="pb30"> + <property name="minimumSize"> + <size> + <width>20</width> + <height>0</height> + </size> + </property> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> + <property name="text"> + <string>30</string> + </property> + </widget> + </item> + <item row="0" column="10"> + <widget class="QPushButton" name="pb6"> + <property name="minimumSize"> + <size> + <width>15</width> + <height>0</height> + </size> + </property> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> + <property name="text"> + <string>6</string> + </property> + </widget> + </item> + <item row="1" column="13"> + <widget class="QPushButton" name="pb24G"> + <property name="minimumSize"> + <size> + <width>25</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>24G</string> + </property> + </widget> + </item> + <item row="1" column="11"> + <widget class="QPushButton" name="pb10G"> + <property name="minimumSize"> + <size> + <width>25</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>10G</string> + </property> + </widget> + </item> + <item row="1" column="10"> + <widget class="QPushButton" name="pb5G"> + <property name="minimumSize"> + <size> + <width>25</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>5G</string> + </property> + </widget> + </item> + <item row="1" column="9"> + <widget class="QPushButton" name="pb9"> + <property name="minimumSize"> + <size> + <width>25</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>9</string> + </property> + </widget> + </item> + <item row="1" column="8"> + <widget class="QPushButton" name="pb13"> + <property name="minimumSize"> + <size> + <width>25</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>13</string> + </property> + </widget> + </item> + <item row="1" column="7"> + <widget class="QPushButton" name="pb23"> + <property name="minimumSize"> + <size> + <width>25</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>23</string> + </property> + </widget> + </item> + <item row="1" column="6"> + <widget class="QPushButton" name="pb902"> + <property name="minimumSize"> + <size> + <width>25</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>33</string> + </property> + </widget> + </item> + <item row="1" column="5"> + <widget class="QPushButton" name="pb432"> + <property name="minimumSize"> + <size> + <width>25</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>70</string> + </property> + </widget> + </item> + <item row="1" column="4"> + <widget class="QPushButton" name="pb220"> + <property name="minimumSize"> + <size> + <width>25</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>1.25</string> + </property> + </widget> + </item> + <item row="1" column="3"> + <widget class="QPushButton" name="pb144"> + <property name="minimumSize"> + <size> + <width>25</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>2</string> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QPushButton" name="pb4"> + <property name="minimumSize"> + <size> + <width>25</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>4</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QPushButton" name="pb50"> + <property name="minimumSize"> + <size> + <width>25</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>6</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QPushButton" name="pb8"> + <property name="minimumSize"> + <size> + <width>25</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>8</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,0,2,2,2,2,2,0,2,2,2,2,1"> + <item> + <widget class="QCheckBox" name="cbCQonly"> + <property name="toolTip"> + <string>CQ messages only.</string> + </property> + <property name="text"> + <string>CQ only</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="cbBypass"> + <property name="toolTip"> + <string>Bypass Filters toggled via Settings or the Filters menu.</string> + </property> + <property name="text"> + <string>BP</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="logQSOButton"> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="toolTip"> + <string>Enter this QSO in log</string> + </property> + <property name="text"> + <string>Log &QSO</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="stopButton"> + <property name="minimumSize"> + <size> + <width>50</width> + <height>0</height> + </size> + </property> + <property name="toolTip"> + <string>Stop monitoring</string> + </property> + <property name="text"> + <string>&Stop</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="monitorButton"> + <property name="minimumSize"> + <size> + <width>50</width> + <height>0</height> + </size> + </property> + <property name="toolTip"> + <string><html><head/><body><p>Toggle monitoring On/Off. <br>Yellow when saving .wav files.</p></body></html></string> + </property> + <property name="styleSheet"> + <string notr="true">QPushButton:checked { + color: #000000; + background-color: #00ff00; + border-style: outset; + border-width: 1px; + border-radius: 5px; + border-color: black; + min-width: 5em; + padding: 3px; +}</string> + </property> + <property name="text"> + <string>&Monitor</string> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="checked"> + <bool>false</bool> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="EraseButton"> + <property name="minimumSize"> + <size> + <width>50</width> + <height>0</height> + </size> + </property> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> + <property name="toolTip"> + <string><html><head/><body><p>Erase right window. Double-click to erase both windows.</p></body></html></string> + </property> + <property name="accessibleDescription"> + <string>Erase right window. Double-click to erase both windows.</string> + </property> + <property name="text"> + <string>&Erase</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="ClrAvgButton"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="toolTip"> + <string><html><head/><body><p>Clear the accumulating message average.</p></body></html></string> + </property> + <property name="accessibleDescription"> + <string>Clear the accumulating message average.</string> + </property> + <property name="text"> + <string>Clear Avg</string> + </property> + </widget> + </item> + <item> + <widget class="HintedSpinBox" name="sbEchoAvg"> + <property name="prefix"> + <string>Avg </string> + </property> + <property name="minimum"> + <number>1</number> + </property> + <property name="maximum"> + <number>100</number> + </property> + <property name="value"> + <number>10</number> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="DecodeButton"> + <property name="minimumSize"> + <size> + <width>50</width> + <height>0</height> + </size> + </property> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> + <property name="toolTip"> + <string><html><head/><body><p>Decode most recent Rx period at QSO Frequency</p></body></html></string> + </property> + <property name="accessibleDescription"> + <string>Decode most recent Rx period at QSO Frequency</string> + </property> + <property name="styleSheet"> + <string notr="true">QPushButton:checked { + color: rgb(0, 0, 0); + background-color: cyan; + border-style: outset; + border-width: 1px; + border-radius: 5px; + border-color: black; + min-width: 5em; + padding: 3px; +}</string> + </property> + <property name="text"> + <string>&Decode</string> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="autoButton"> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> + <property name="toolTip"> + <string><html><head/><body><p>Toggle Auto-Tx On/Off</p></body></html></string> + </property> + <property name="accessibleDescription"> + <string>Toggle Auto-Tx On/Off</string> + </property> + <property name="styleSheet"> + <string notr="true">QPushButton:checked { + color: white; + background-color: red; + border-style: outset; + border-width: 1px; + border-radius: 5px; + border-color: black; + min-width: 5em; + padding: 3px; +}</string> + </property> + <property name="text"> + <string>E&nable Tx</string> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="stopTxButton"> + <property name="minimumSize"> + <size> + <width>50</width> + <height>0</height> + </size> + </property> + <property name="toolTip"> + <string>Stop transmitting immediately</string> + </property> + <property name="text"> + <string>&Halt Tx</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="tuneButton"> + <property name="minimumSize"> + <size> + <width>50</width> + <height>0</height> + </size> + </property> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> + <property name="toolTip"> + <string><html><head/><body><p>Toggle a pure Tx tone On/Off <br>Right-click to tune rig</p></body></html></string> + </property> + <property name="accessibleDescription"> + <string>Toggle a pure Tx tone On/Off</string> + </property> + <property name="styleSheet"> + <string notr="true">QPushButton:checked { + color: white; + background-color: red; + border-style: outset; + border-width: 1px; + border-radius: 5px; + border-color: black; + min-width: 5em; + padding: 3px; +}</string> + </property> + <property name="text"> + <string>&Tune</string> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="cbMenus"> + <property name="text"> + <string>Menus</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QGridLayout" name="gridLayout_5" rowstretch="1,0,0" columnstretch="0,0,0,0,1,1,5,0"> + <item row="1" column="4" colspan="2"> + <widget class="QWidget" name="DX_controls_widget" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>114</width> + <height>0</height> + </size> + </property> + <layout class="QVBoxLayout" name="verticalLayout_110"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>1</number> + </property> + <item> + <layout class="QGridLayout" name="DXCall_gridLayout" columnstretch="3,2"> + <item row="0" column="0"> + <widget class="QPushButton" name="DX_Call_Button"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> + <property name="toolTip"> + <string><html><head/><body><p>Toggle Wait &amp; Call On/Off. Right-click to clear the DX Call box.</p></body></html></string> + </property> + <property name="styleSheet"> + <string notr="true">QPushButton { + background-color: #9fafd5; + border: none; +}</string> + </property> + <property name="text"> + <string>DX Call</string> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLineEdit" name="dxCallEntry"> + <property name="toolTip"> + <string>Callsign of station to be worked</string> + </property> + <property name="text"> + <string/> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLabel" name="label_4"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="palette"> + <palette> + <active> + <colorrole role="Base"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>252</red> + <green>252</green> + <blue>252</blue> + </color> + </brush> + </colorrole> + <colorrole role="Window"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>159</red> + <green>175</green> + <blue>213</blue> + </color> + </brush> + </colorrole> + </active> + <inactive> + <colorrole role="Base"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>252</red> + <green>252</green> + <blue>252</blue> + </color> + </brush> + </colorrole> + <colorrole role="Window"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>159</red> + <green>175</green> + <blue>213</blue> + </color> + </brush> + </colorrole> + </inactive> + <disabled> + <colorrole role="Base"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>159</red> + <green>175</green> + <blue>213</blue> + </color> + </brush> + </colorrole> + <colorrole role="Window"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>159</red> + <green>175</green> + <blue>213</blue> + </color> + </brush> + </colorrole> + </disabled> + </palette> + </property> + <property name="autoFillBackground"> + <bool>true</bool> + </property> + <property name="text"> + <string>DX Grid</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="margin"> + <number>5</number> + </property> + <property name="indent"> + <number>2</number> + </property> + <property name="buddy"> + <cstring>dxGridEntry</cstring> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLineEdit" name="dxGridEntry"> + <property name="toolTip"> + <string>Locator of station to be worked</string> + </property> + <property name="text"> + <string/> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="QLabel" name="labAz"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="autoFillBackground"> + <bool>true</bool> + </property> + <property name="text"> + <string>Az: 251 16553 km</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="indent"> + <number>4</number> + </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="lookup_control_layout"> + <property name="spacing"> + <number>3</number> + </property> + <item> + <widget class="QPushButton" name="lookupButton"> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> + <property name="toolTip"> + <string><html><head/><body><p>Search for callsign in database. <br>Right-click searches for callsign on QRZ.com.</p></body></html></string> + </property> + <property name="text"> + <string>&Lookup</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="addButton"> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> + <property name="toolTip"> + <string><html><head/><body><p>Add callsign and locator to database. <br>Right-click searches for callsign on hamqth.com.</p></body></html></string> + </property> + <property name="text"> + <string>Add</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="ignoreButton"> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> + <property name="toolTip"> + <string><html><head/><body><p>Put callsign on the Ignore List.<br>Right-click searches for callsign on qrzcq.com.</p></body></html></string> + </property> + <property name="text"> + <string>Ignore</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + </item> + <item row="1" column="7" rowspan="2"> + <widget class="QSlider" name="outAttenuation"> + <property name="toolTip"> + <string>Adjust Tx audio level</string> + </property> + <property name="maximum"> + <number>450</number> + </property> + <property name="value"> + <number>0</number> + </property> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="invertedAppearance"> + <bool>true</bool> + </property> + <property name="invertedControls"> + <bool>true</bool> + </property> + <property name="tickPosition"> + <enum>QSlider::TicksBelow</enum> + </property> + <property name="tickInterval"> + <number>50</number> + </property> + </widget> + </item> + <item row="0" column="7"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Pwr</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="1" column="2" rowspan="2"> + <layout class="QVBoxLayout" name="verticalLayout_11"> + <property name="spacing"> + <number>6</number> + </property> + <item> + <widget class="QSpinBox" name="sbNB"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>100</width> + <height>16777215</height> + </size> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="suffix"> + <string> %</string> + </property> + <property name="prefix"> + <string>NB </string> + </property> + <property name="minimum"> + <number>-2</number> + </property> + <property name="maximum"> + <number>25</number> + </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <property name="spacing"> + <number>0</number> + </property> + <item> + <widget class="SignalMeter" name="signal_meter_widget"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>100</width> + <height>16777215</height> + </size> + </property> + <property name="toolTip"> + <string><html><head/><body><p>30dB recommended when only noise present<br/>Green when good<br/>Red when clipping may occur<br/>Yellow when too low</p></body></html></string> + </property> + <property name="accessibleName"> + <string>Rx Signal</string> + </property> + <property name="accessibleDescription"> + <string>30dB recommended when only noise present +Green when good +Red when clipping may occur +Yellow when too low</string> + </property> + <property name="frameShape"> + <enum>QFrame::Panel</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Sunken</enum> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + </layout> + </item> + <item row="0" column="6" rowspan="3"> + <widget class="QStackedWidget" name="controls_stack_widget"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="currentIndex"> + <number>0</number> + </property> + <widget class="QWidget" name="page"> + <layout class="QHBoxLayout" name="horizontalLayout_8"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="QWidget" name="QSO_controls_widget" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_6" stretch="1,2"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <layout class="QGridLayout" name="gridLayout_3" columnstretch="0,0"> + <item row="1" column="0" colspan="2"> + <layout class="QHBoxLayout" name="horizontalLayout_11"> + <item> + <widget class="QSpinBox" name="sbCQTxFreq"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip"> + <string><html><head/><body><p>Frequency to call CQ on in kHz above the current MHz</p></body></html></string> + </property> + <property name="accessibleDescription"> + <string>Frequency to call CQ on in kHz above the current MHz</string> + </property> + <property name="prefix"> + <string>Tx CQ </string> + </property> + <property name="minimum"> + <number>1</number> + </property> + <property name="maximum"> + <number>999</number> + </property> + <property name="value"> + <number>260</number> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="cbCQTx"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip"> + <string><html><head/><body><p>Check this to call CQ on the &quot;Tx CQ&quot; frequency. Rx will be on the current frequency and the CQ message wiill include the current Rx frequency so callers know which frequency to reply on.</p><p>Not available to nonstandard callsign holders.</p></body></html></string> + </property> + <property name="accessibleDescription"> + <string>Check this to call CQ on the "Tx CQ" frequency. Rx will be on the current frequency and the CQ message wiill include the current Rx frequency so callers know which frequency to reply on. +Not available to nonstandard callsign holders.</string> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="cbRxAll"> + <property name="toolTip"> + <string>Decode other Hounds calling above 1000 Hz audio offset</string> + </property> + <property name="text"> + <string>Rx All Freqs</string> + </property> + </widget> + </item> + </layout> + </item> + <item row="3" column="0" colspan="2"> + <layout class="QHBoxLayout" name="horizontalLayout_15"> + <item> + <widget class="QLabel" name="labDXped"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>100</width> + <height>16777215</height> + </size> + </property> + <property name="text"> + <string>Fox</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="cbSWL"> + <property name="toolTip"> + <string><html><head/><body><p>Check to monitor Sh messages.</p></body></html></string> + </property> + <property name="accessibleDescription"> + <string>Check to monitor Sh messages.</string> + </property> + <property name="text"> + <string>SWL</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="pbBestSP"> + <property name="toolTip"> + <string>Enable auto response to the first decode from a new DXCC or new call on the current band.</string> + </property> + <property name="styleSheet"> + <string notr="true">QPushButton:checked { + color: rgb(0, 0, 0); + background-color: red; + border-style: outset; + border-width: 1px; + border-radius: 5px; + border-color: black; + min-width: 5em; + padding: 3px; +}</string> + </property> + <property name="text"> + <string>Best S+P</string> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="measure_check_box"> + <property name="toolTip"> + <string><html><head/><body><p>Check this to start recording calibration data.<br/>While measuring calibration correction is disabled.<br/>When not checked you can view the calibration results.</p></body></html></string> + </property> + <property name="accessibleDescription"> + <string>Check this to start recording calibration data. +While measuring calibration correction is disabled. +When not checked you can view the calibration results.</string> + </property> + <property name="text"> + <string>Measure</string> + </property> + </widget> + </item> + </layout> + </item> + <item row="2" column="0" colspan="2"> + <layout class="QHBoxLayout" name="horizontalLayout_5"> + <item> + <widget class="QCheckBox" name="cbShMsgs"> + <property name="toolTip"> + <string><html><head/><body><p>Check to use short-format messages.</p></body></html></string> + </property> + <property name="accessibleDescription"> + <string>Check to use short-format messages.</string> + </property> + <property name="text"> + <string>Sh</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="cbFast9"> + <property name="toolTip"> + <string><html><head/><body><p>Check to enable JT9 fast modes</p></body></html></string> + </property> + <property name="accessibleDescription"> + <string>Check to enable JT9 fast modes</string> + </property> + <property name="text"> + <string>Fast</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="cbAutoSeq"> + <property name="toolTip"> + <string><html><head/><body><p>Check to enable automatic sequencing of Tx messages based on received messages.</p></body></html></string> + </property> + <property name="accessibleDescription"> + <string>Check to enable automatic sequencing of Tx messages based on received messages.</string> + </property> + <property name="text"> + <string>Auto Seq</string> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="respondComboBox"> + <property name="toolTip"> + <string><html><head/><body><p>Select <span style=" font-weight:600;">CQ: None</span> to choose callers manually.</p><p>Select <span style=" font-weight:600;">CQ: First</span> to respond automatically to the first decoded reply to your CQ. </p><p>Select <span style=" font-weight:600;">CQ: Max Dist</span> to respond automatically to the reply yielding most points in the ARRL International Digital Contest, or in general to the most distant station, if its message has a valid grid.</p><p>Select <span style=" font-weight:600;">CQ: Max dB</span> to respond automatically to the the strongest station's reply to your CQ. </p><p>Select <span style=" font-weight:600;">CQ: Min dB</span> to respond automatically to the the weakest station's reply to your CQ. </p></body></html></string> + </property> + <property name="currentText"> + <string/> + </property> + <property name="currentIndex"> + <number>-1</number> + </property> + <property name="maxVisibleItems"> + <number>5</number> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="cbTx6"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip"> + <string>Check to generate "@1250 (SEND MSGS)" in Tx6.</string> + </property> + <property name="text"> + <string>Tx6</string> + </property> + </widget> + </item> + </layout> + </item> + <item row="0" column="0"> + <layout class="QVBoxLayout" name="verticalLayout_14"> + <item> + <widget class="QCheckBox" name="txFirstCheckBox"> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> + <property name="toolTip"> + <string><html><head/><body><p>Check to Tx in even-numbered minutes or sequences, starting at 0; uncheck for odd sequences. Right-click to freeze the state of the checkbox. Right-click either the FT8 or MSK button to unfreeze.</p></body></html></string> + </property> + <property name="accessibleDescription"> + <string><html><head/><body><p>Check to Tx in even-numbered minutes or sequences, starting at 0; uncheck for odd sequences. Right-click to freeze the state of the checkbox. Right-click either the FT8 or MSK button to unfreeze.</p></body></html></string> + </property> + <property name="text"> + <string>Tx even/1st</string> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="TxFreqSpinBox"> + <property name="toolTip"> + <string>Audio Tx frequency</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="suffix"> + <string> Hz</string> + </property> + <property name="prefix"> + <string>Tx </string> + </property> + <property name="minimum"> + <number>200</number> + </property> + <property name="maximum"> + <number>5000</number> + </property> + <property name="value"> + <number>1500</number> + </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_4" stretch="0,6,0"> + <item> + <widget class="QPushButton" name="pbR2T"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>15</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>35</width> + <height>16777215</height> + </size> + </property> + <property name="toolTip"> + <string>Set Tx frequency to Rx Frequency</string> + </property> + <property name="accessibleName"> + <string>Set Tx frequency to Rx Frequency</string> + </property> + <property name="text"> + <string>â–²</string> + </property> + </widget> + </item> + <item> + <widget class="HintedSpinBox" name="sbFtol"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip"> + <string>Frequency tolerance (Hz)</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="prefix"> + <string>F Tol </string> + </property> + <property name="minimum"> + <number>1</number> + </property> + <property name="maximum"> + <number>1000</number> + </property> + <property name="value"> + <number>10</number> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="pbT2R"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>15</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>35</width> + <height>16777215</height> + </size> + </property> + <property name="toolTip"> + <string>Set Rx frequency to Tx Frequency</string> + </property> + <property name="accessibleName"> + <string>Set Rx frequency to Tx Frequency</string> + </property> + <property name="text"> + <string>â–¼</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="QSpinBox" name="RxFreqSpinBox"> + <property name="toolTip"> + <string>Audio Rx frequency</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="suffix"> + <string> Hz</string> + </property> + <property name="prefix"> + <string>Rx </string> + </property> + <property name="minimum"> + <number>200</number> + </property> + <property name="maximum"> + <number>5000</number> + </property> + <property name="value"> + <number>1500</number> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="rptSpinBox"> + <property name="toolTip"> + <string><html><head/><body><p>Signal report: Signal-to-noise ratio in 2500 Hz reference bandwidth (dB).</p></body></html></string> + </property> + <property name="accessibleDescription"> + <string>Signal report: Signal-to-noise ratio in 2500 Hz reference bandwidth (dB).</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="prefix"> + <string> Report </string> + </property> + <property name="minimum"> + <number>-50</number> + </property> + <property name="maximum"> + <number>49</number> + </property> + <property name="value"> + <number>-15</number> + </property> + </widget> + </item> + <item> + <widget class="RestrictedSpinBox" name="sbTR"> + <property name="toolTip"> + <string><html><head/><body><p>Tx/Rx or Frequency calibration sequence length</p></body></html></string> + </property> + <property name="accessibleDescription"> + <string>Tx/Rx or Frequency calibration sequence length</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="suffix"> + <string> s</string> + </property> + <property name="prefix"> + <string>T/R </string> + </property> + <property name="minimum"> + <number>5</number> + </property> + <property name="maximum"> + <number>1800</number> + </property> + <property name="value"> + <number>30</number> + </property> + </widget> + </item> + </layout> + </item> + <item row="4" column="0"> + <spacer name="verticalSpacer_4"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + <item row="0" column="1"> + <layout class="QVBoxLayout" name="verticalLayout_13"> + <item> + <layout class="QGridLayout" name="submode_gridLayout"> + <property name="horizontalSpacing"> + <number>4</number> + </property> + <item row="0" column="1"> + <widget class="QPushButton" name="pb15C"> + <property name="minimumSize"> + <size> + <width>30</width> + <height>0</height> + </size> + </property> + <property name="toolTip"> + <string><html><head/><body><p>Switch to T/R 15 s and Submode C.</p></body></html></string> + </property> + <property name="text"> + <string>15C</string> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QPushButton" name="pb15A"> + <property name="minimumSize"> + <size> + <width>32</width> + <height>0</height> + </size> + </property> + <property name="toolTip"> + <string><html><head/><body><p>Switch to T/R 15 s and Submode A.</p></body></html></string> + </property> + <property name="text"> + <string>15A</string> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QPushButton" name="pb30B"> + <property name="minimumSize"> + <size> + <width>32</width> + <height>0</height> + </size> + </property> + <property name="toolTip"> + <string><html><head/><body><p>Switch to T/R 30 s and Submode B.</p></body></html></string> + </property> + <property name="text"> + <string>30B</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QPushButton" name="pb60C"> + <property name="minimumSize"> + <size> + <width>30</width> + <height>0</height> + </size> + </property> + <property name="toolTip"> + <string><html><head/><body><p>Switch to T/R 60 s and Submode C.</p></body></html></string> + </property> + <property name="text"> + <string>60C</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QPushButton" name="pb60D"> + <property name="minimumSize"> + <size> + <width>30</width> + <height>0</height> + </size> + </property> + <property name="toolTip"> + <string><html><head/><body><p>Switch to T/R 60 s and Submode D.</p></body></html></string> + </property> + <property name="text"> + <string>60D</string> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QPushButton" name="pb60E"> + <property name="minimumSize"> + <size> + <width>30</width> + <height>0</height> + </size> + </property> + <property name="toolTip"> + <string><html><head/><body><p>Switch to T/R 60 s and Submode E.</p></body></html></string> + </property> + <property name="text"> + <string>60E</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="QCheckBox" name="cbHoldTxFreq"> + <property name="toolTip"> + <string><html><head/><body><p>Check to keep Tx frequency fixed when double-clicking on decoded text.</p></body></html></string> + </property> + <property name="accessibleDescription"> + <string>Check to keep Tx frequency fixed when double-clicking on decoded text.</string> + </property> + <property name="text"> + <string>Hold Tx Freq</string> + </property> + </widget> + </item> + <item> + <widget class="QStackedWidget" name="opt_controls_stack"> + <property name="currentIndex"> + <number>1</number> + </property> + <widget class="QWidget" name="page_0"> + <layout class="QVBoxLayout" name="verticalLayout"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="QSpinBox" name="sbSerialNumber"> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="prefix"> + <string>Tx# </string> + </property> + <property name="minimum"> + <number>1</number> + </property> + <property name="maximum"> + <number>4095</number> + </property> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="page_1"> + <layout class="QVBoxLayout" name="verticalLayout_10"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="QSpinBox" name="sbF_Low"> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="prefix"> + <string>F Low </string> + </property> + <property name="minimum"> + <number>100</number> + </property> + <property name="maximum"> + <number>5000</number> + </property> + <property name="singleStep"> + <number>50</number> + </property> + <property name="value"> + <number>600</number> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="sbF_High"> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="suffix"> + <string/> + </property> + <property name="prefix"> + <string>F High </string> + </property> + <property name="minimum"> + <number>100</number> + </property> + <property name="maximum"> + <number>5000</number> + </property> + <property name="singleStep"> + <number>50</number> + </property> + <property name="value"> + <number>1400</number> + </property> + </widget> + </item> + </layout> + </widget> + </widget> + </item> + <item> + <widget class="LettersSpinBox" name="sbSubmode"> + <property name="toolTip"> + <string><html><head/><body><p>Submode determines tone spacing; A is narrowest.</p></body></html></string> + </property> + <property name="accessibleDescription"> + <string>Submode determines tone spacing; A is narrowest.</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="prefix"> + <string>Submode </string> + </property> + <property name="minimum"> + <number>0</number> + </property> + <property name="maximum"> + <number>7</number> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="syncSpinBox"> + <property name="toolTip"> + <string><html><head/><body><p>Synchronizing threshold. Lower numbers accept weaker sync signals.</p></body></html></string> + </property> + <property name="accessibleDescription"> + <string>Synchronizing threshold. Lower numbers accept weaker sync signals.</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="prefix"> + <string>Sync </string> + </property> + <property name="minimum"> + <number>-1</number> + </property> + <property name="maximum"> + <number>10</number> + </property> + <property name="value"> + <number>1</number> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="sbMaxDrift"> + <property name="toolTip"> + <string>Maximum drift rate in units of symbol rate per transmission.</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="prefix"> + <string>Max Drift </string> + </property> + <property name="maximum"> + <number>50</number> + </property> + <property name="singleStep"> + <number>5</number> + </property> + </widget> + </item> + <item> + <spacer name="verticalSpacer_6"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + </layout> + </item> + <item> + <widget class="QTabWidget" name="tabWidget"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="tabPosition"> + <enum>QTabWidget::West</enum> + </property> + <property name="tabShape"> + <enum>QTabWidget::Triangular</enum> + </property> + <property name="currentIndex"> + <number>0</number> + </property> + <widget class="QWidget" name="tab"> + <attribute name="title"> + <string>1</string> + </attribute> + <layout class="QGridLayout" name="gridLayout_7"> + <item row="0" column="0"> + <layout class="QGridLayout" name="gridLayout_6" columnstretch="1,0,0"> + <item row="6" column="1"> + <widget class="QRadioButton" name="txrb6"> + <property name="toolTip"> + <string>Send this message in next Tx interval</string> + </property> + <property name="styleSheet"> + <string notr="true">margin-left: 10%; margin-right: 0%</string> + </property> + <property name="text"> + <string/> + </property> + <property name="shortcut"> + <string>Ctrl+6</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLabel" name="label_5"> + <property name="toolTip"> + <string>Queue up the next Tx message</string> + </property> + <property name="text"> + <string>Next</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLineEdit" name="tx1"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </item> + <item row="4" column="1"> + <widget class="DoubleClickableRadioButton" name="txrb4"> + <property name="toolTip"> + <string><html><head/><body><p>Send this message in next Tx interval</p><p>Double-click to toggle between RRR and RR73 messages in Tx4 (not allowed for type 2 compound call holders)</p><p>RR73 messages should only be used when you are reasonably confident that no message repetitions will be required</p></body></html></string> + </property> + <property name="accessibleDescription"> + <string>Send this message in next Tx interval +Double-click to toggle between RRR and RR73 messages in Tx4 (not allowed for type 2 compound call holders) +RR73 messages should only be used when you are reasonably confident that no message repetitions will be required</string> + </property> + <property name="styleSheet"> + <string notr="true">margin-left: 10%; margin-right: 0%</string> + </property> + <property name="text"> + <string/> + </property> + <property name="shortcut"> + <string>Ctrl+4</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="DoubleClickableRadioButton" name="txrb1"> + <property name="toolTip"> + <string><html><head/><body><p>Send this message in next Tx interval</p><p>Double click to toggle the use of the Tx1 message to start a QSO with a station (not allowed for type 1 compound call holders)</p></body></html></string> + </property> + <property name="accessibleDescription"> + <string>Send this message in next Tx interval +Double click to toggle the use of the Tx1 message to start a QSO with a station (not allowed for type 1 compound call holders)</string> + </property> + <property name="styleSheet"> + <string notr="true">margin-left: 10%; margin-right: 0%</string> + </property> + <property name="text"> + <string/> + </property> + <property name="shortcut"> + <string>Ctrl+1</string> + </property> + </widget> + </item> + <item row="6" column="0"> + <widget class="QLineEdit" name="tx6"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </item> + <item row="5" column="2"> + <widget class="DoubleClickablePushButton" name="txb5"> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> + <property name="toolTip"> + <string><html><head/><body><p>Switch to this Tx message NOW</p><p>Double-click to reset to the standard 73 message</p><p>Right-click to retain Tx5 free text</p></body></html></string> + </property> + <property name="accessibleDescription"> + <string><html><head/><body><p>Switch to this Tx message NOW</p><p>Double-click to reset to the standard 73 message</p><p>Right-click to retain Tx5 free text</p></body></html></string> + </property> + <property name="styleSheet"> + <string notr="true">padding-left: 15%; padding-right: 15%; padding-top: 3%; padding-bottom: 3%</string> + </property> + <property name="text"> + <string>Tx &5</string> + </property> + <property name="shortcut"> + <string>Alt+5</string> + </property> + </widget> + </item> + <item row="2" column="2"> + <widget class="QPushButton" name="txb2"> + <property name="toolTip"> + <string>Switch to this Tx message NOW</string> + </property> + <property name="styleSheet"> + <string notr="true">padding-left: 15%; padding-right: 15%; padding-top: 3%; padding-bottom: 3%</string> + </property> + <property name="text"> + <string>Tx &2</string> + </property> + <property name="shortcut"> + <string>Alt+2</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLineEdit" name="tx2"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QLabel" name="label_2"> + <property name="toolTip"> + <string>Switch to this Tx message NOW</string> + </property> + <property name="text"> + <string>Now</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QRadioButton" name="txrb2"> + <property name="toolTip"> + <string>Send this message in next Tx interval</string> + </property> + <property name="styleSheet"> + <string notr="true">margin-left: 10%; margin-right: 0%</string> + </property> + <property name="text"> + <string/> + </property> + <property name="shortcut"> + <string>Ctrl+2</string> + </property> + </widget> + </item> + <item row="4" column="0"> + <widget class="QLineEdit" name="tx4"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLineEdit" name="tx3"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QPushButton" name="genStdMsgsPushButton"> + <property name="toolTip"> + <string>Generate standard messages for minimal QSO</string> + </property> + <property name="text"> + <string>Generate Std Msgs</string> + </property> + </widget> + </item> + <item row="3" column="2"> + <widget class="QPushButton" name="txb3"> + <property name="toolTip"> + <string>Switch to this Tx message NOW</string> + </property> + <property name="styleSheet"> + <string notr="true">padding-left: 15%; padding-right: 15%; padding-top: 3%; padding-bottom: 3%</string> + </property> + <property name="text"> + <string>Tx &3</string> + </property> + <property name="shortcut"> + <string>Alt+3</string> + </property> + </widget> + </item> + <item row="4" column="2"> + <widget class="DoubleClickablePushButton" name="txb4"> + <property name="toolTip"> + <string><html><head/><body><p>Switch to this Tx message NOW</p><p>Double-click to toggle between RRR and RR73 messages in Tx4 (not allowed for type2 compound call holders)</p><p>RR73 messages should only be used when you are reasonably confident that no message repetitions will be required</p></body></html></string> + </property> + <property name="accessibleDescription"> + <string>Switch to this Tx message NOW +Double-click to toggle between RRR and RR73 messages in Tx4 (not allowed for type2 compound call holders) +RR73 messages should only be used when you are reasonably confident that no message repetitions will be required</string> + </property> + <property name="styleSheet"> + <string notr="true">padding-left: 15%; padding-right: 15%; padding-top: 3%; padding-bottom: 3%</string> + </property> + <property name="text"> + <string>Tx &4</string> + </property> + <property name="shortcut"> + <string>Alt+4</string> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="DoubleClickablePushButton" name="txb1"> + <property name="toolTip"> + <string><html><head/><body><p>Switch to this Tx message NOW</p><p>Double click to toggle the use of the Tx1 message to start a QSO with a station (not allowed for type 1 compound call holders)</p></body></html></string> + </property> + <property name="accessibleDescription"> + <string>Switch to this Tx message NOW +Double click to toggle the use of the Tx1 message to start a QSO with a station (not allowed for type 1 compound call holders)</string> + </property> + <property name="layoutDirection"> + <enum>Qt::LeftToRight</enum> + </property> + <property name="styleSheet"> + <string notr="true">padding-left: 15%; padding-right: 15%; padding-top: 3%; padding-bottom: 3%</string> + </property> + <property name="text"> + <string>Tx &1</string> + </property> + <property name="shortcut"> + <string>Alt+1</string> + </property> + </widget> + </item> + <item row="6" column="2"> + <widget class="QPushButton" name="txb6"> + <property name="toolTip"> + <string>Switch to this Tx message NOW</string> + </property> + <property name="styleSheet"> + <string notr="true">padding-left: 15%; padding-right: 15%; padding-top: 3%; padding-bottom: 3%</string> + </property> + <property name="text"> + <string>Tx &6</string> + </property> + <property name="shortcut"> + <string>Alt+6</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QRadioButton" name="txrb3"> + <property name="toolTip"> + <string>Send this message in next Tx interval</string> + </property> + <property name="styleSheet"> + <string notr="true">margin-left: 10%; margin-right: 0%</string> + </property> + <property name="text"> + <string/> + </property> + <property name="shortcut"> + <string>Ctrl+3</string> + </property> + </widget> + </item> + <item row="5" column="0"> + <widget class="QComboBox" name="tx5"> + <property name="toolTip"> + <string>Enter a free text message (maximum 13 characters) +or select a predefined macro from the dropdown list. +Press ENTER to add the current text to the predefined +list. The list can be maintained in Settings (F2).</string> + </property> + <property name="editable"> + <bool>true</bool> + </property> + <property name="insertPolicy"> + <enum>QComboBox::InsertAtBottom</enum> + </property> + </widget> + </item> + <item row="5" column="1"> + <widget class="DoubleClickableRadioButton" name="txrb5"> + <property name="toolTip"> + <string><html><head/><body><p>Send this message in next Tx interval</p><p>Double-click to reset to the standard 73 message</p></body></html></string> + </property> + <property name="accessibleDescription"> + <string>Send this message in next Tx interval +Double-click to reset to the standard 73 message</string> + </property> + <property name="styleSheet"> + <string notr="true">margin-left: 10%; margin-right: 0%</string> + </property> + <property name="text"> + <string/> + </property> + <property name="shortcut"> + <string>Ctrl+5</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <widget class="QWidget" name="tab_3"> + <attribute name="title"> + <string>2</string> + </attribute> + <layout class="QGridLayout" name="gridLayout_11" columnstretch="1"> + <property name="leftMargin"> + <number>4</number> + </property> + <property name="topMargin"> + <number>4</number> + </property> + <property name="rightMargin"> + <number>4</number> + </property> + <property name="bottomMargin"> + <number>4</number> + </property> + <property name="horizontalSpacing"> + <number>4</number> + </property> + <item row="0" column="0" rowspan="2"> + <layout class="QGridLayout" name="gridLayout" columnstretch="2,2,1"> + <property name="topMargin"> + <number>0</number> + </property> + <property name="horizontalSpacing"> + <number>6</number> + </property> + <item row="8" column="2"> + <widget class="QCheckBox" name="cbSendMsg"> + <property name="toolTip"> + <string><html><head/><body><p>Transmit free text message at the next opportunity.</p></body></html></string> + </property> + <property name="text"> + <string>Send msg</string> + </property> + </widget> + </item> + <item row="7" column="2"> + <widget class="QPushButton" name="pbFreeText"> + <property name="toolTip"> + <string><html><head/><body><p>Enter a free text message.</p></body></html></string> + </property> + <property name="text"> + <string>Free Text</string> + </property> + </widget> + </item> + <item row="4" column="2"> + <widget class="QComboBox" name="comboBoxCQ"> + <property name="toolTip"> + <string><html><head/><body><p>Select a specific CQ message.</p></body></html></string> + </property> + <property name="currentText"> + <string>CQ</string> + </property> + <item> + <property name="text"> + <string>CQ</string> + </property> + </item> + <item> + <property name="text"> + <string>CQ AF</string> + </property> + </item> + <item> + <property name="text"> + <string>CQ AN</string> + </property> + </item> + <item> + <property name="text"> + <string>CQ AS</string> + </property> + </item> + <item> + <property name="text"> + <string>CQ EU</string> + </property> + </item> + <item> + <property name="text"> + <string>CQ NA</string> + </property> + </item> + <item> + <property name="text"> + <string>CQ OC</string> + </property> + </item> + <item> + <property name="text"> + <string>CQ SA</string> + </property> + </item> + <item> + <property name="text"> + <string>CQ 0</string> + </property> + </item> + <item> + <property name="text"> + <string>CQ 1</string> + </property> + </item> + <item> + <property name="text"> + <string>CQ 2</string> + </property> + </item> + <item> + <property name="text"> + <string>CQ 3</string> + </property> + </item> + <item> + <property name="text"> + <string>CQ 4</string> + </property> + </item> + <item> + <property name="text"> + <string>CQ 5</string> + </property> + </item> + <item> + <property name="text"> + <string>CQ 6</string> + </property> + </item> + <item> + <property name="text"> + <string>CQ 7</string> + </property> + </item> + <item> + <property name="text"> + <string>CQ 8</string> + </property> + </item> + <item> + <property name="text"> + <string>CQ 9</string> + </property> + </item> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="label_queue"> + <property name="font"> + <font> + <pointsize>9</pointsize> + </font> + </property> + <property name="text"> + <string>Queue</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QCheckBox" name="cbWorkDupes"> + <property name="text"> + <string>Allow Dupes</string> + </property> + </widget> + </item> + <item row="6" column="2"> + <widget class="QPushButton" name="pbFoxReset"> + <property name="toolTip"> + <string><html><head/><body><p>Clear all queues.</p></body></html></string> + </property> + <property name="text"> + <string>Reset</string> + </property> + </widget> + </item> + <item row="2" column="2"> + <widget class="QSpinBox" name="sbNlist"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + <property name="toolTip"> + <string><html><head/><body><p>Maximum number of callsigns to be displayed in the queue.</p></body></html></string> + </property> + <property name="prefix"> + <string>N List </string> + </property> + <property name="minimum"> + <number>5</number> + </property> + <property name="maximum"> + <number>100</number> + </property> + <property name="value"> + <number>12</number> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QComboBox" name="comboBoxHoundSort"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + <property name="toolTip"> + <string><html><head/><body><p>Select a desired sort order for callsigns in the queue.</p></body></html></string> + </property> + <property name="currentText"> + <string>Random</string> + </property> + <property name="maxVisibleItems"> + <number>8</number> + </property> + <item> + <property name="text"> + <string>Random</string> + </property> + </item> + <item> + <property name="text"> + <string>Call</string> + </property> + </item> + <item> + <property name="text"> + <string>Grid</string> + </property> + </item> + <item> + <property name="text"> + <string>S/N (dB)</string> + </property> + </item> + <item> + <property name="text"> + <string>Distance</string> + </property> + </item> + <item> + <property name="text"> + <string>Age</string> + </property> + </item> + <item> + <property name="text"> + <string>Continent</string> + </property> + </item> + <item> + <property name="text"> + <string>Score</string> + </property> + </item> + </widget> + </item> + <item row="5" column="2"> + <widget class="QCheckBox" name="cbMoreCQs"> + <property name="toolTip"> + <string><html><head/><body><p>Include a CQ message along with other messages.</p></body></html></string> + </property> + <property name="text"> + <string>More CQs</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLabel" name="label_inProcess"> + <property name="text"> + <string>In Progress</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="3" column="2"> + <widget class="QSpinBox" name="sbNslots"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + <property name="toolTip"> + <string><html><head/><body><p>Maximum number of concurrent streams for Fox transmissions.</p></body></html></string> + </property> + <property name="suffix"> + <string/> + </property> + <property name="prefix"> + <string>N Slots </string> + </property> + <property name="minimum"> + <number>1</number> + </property> + <property name="maximum"> + <number>5</number> + </property> + <property name="value"> + <number>1</number> + </property> + <property name="displayIntegerBase"> + <number>10</number> + </property> + </widget> + </item> + <item row="9" column="2"> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + <item row="1" column="1" rowspan="9"> + <widget class="DisplayText" name="foxTxListTextBrowser"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + <property name="sizeAdjustPolicy"> + <enum>QAbstractScrollArea::AdjustToContentsOnFirstShow</enum> + </property> + </widget> + </item> + <item row="1" column="0" rowspan="9"> + <widget class="DisplayText" name="houndQueueTextBrowser"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + <property name="sizeAdjustPolicy"> + <enum>QAbstractScrollArea::AdjustToContentsOnFirstShow</enum> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <widget class="QWidget" name="tab_4"> + <attribute name="title"> + <string>3</string> + </attribute> + <layout class="QGridLayout" name="gridLayout_13"> + <property name="leftMargin"> + <number>2</number> + </property> + <property name="topMargin"> + <number>3</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>1</number> + </property> + <item row="0" column="0"> + <layout class="QHBoxLayout" name="horizontalLayout_30"> + <property name="spacing"> + <number>0</number> + </property> + <item> + <widget class="QWidget" name="widget_3" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <layout class="QGridLayout" name="gridLayout_8" columnstretch="1,1,1"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>1</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <property name="horizontalSpacing"> + <number>1</number> + </property> + <property name="verticalSpacing"> + <number>6</number> + </property> + <item row="7" column="1"> + <widget class="QCheckBox" name="cb70cm"> + <property name="toolTip"> + <string>70cm FT8</string> + </property> + <property name="text"> + <string>70cm</string> + </property> + </widget> + </item> + <item row="5" column="0"> + <widget class="QCheckBox" name="cb30m"> + <property name="toolTip"> + <string>30m FT8</string> + </property> + <property name="text"> + <string>30m</string> + </property> + </widget> + </item> + <item row="8" column="0" rowspan="2" colspan="2"> + <widget class="QPushButton" name="pbBandHopping"> + <property name="minimumSize"> + <size> + <width>0</width> + <height>34</height> + </size> + </property> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> + <property name="toolTip"> + <string><html><head/><body><p>Toggle band hopping On/Off. Band hopping occurs every other full minute. Changes to the checkboxes take effect immediately.<br/>Right-click to switch to the next selected band hopping frequency, or to test the default audio device, when band hopping is disabled.</p></body></html></string> + </property> + <property name="styleSheet"> + <string notr="true">QPushButton:checked { + background-color: red; + border-style: outset; + border-width: 1px; + border-radius: 5px; + border-color: black; + min-width: 5em; + padding: 3px; +}</string> + </property> + <property name="text"> + <string> Band Hopping </string> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QCheckBox" name="cb12m"> + <property name="toolTip"> + <string>12m FT8</string> + </property> + <property name="text"> + <string>12m</string> + </property> + </widget> + </item> + <item row="4" column="0"> + <widget class="QCheckBox" name="cb40m"> + <property name="toolTip"> + <string>40m FT8</string> + </property> + <property name="text"> + <string>40m</string> + </property> + </widget> + </item> + <item row="9" column="2"> + <widget class="QCheckBox" name="cb2mMSK"> + <property name="toolTip"> + <string>2m MSK144</string> + </property> + <property name="whatsThis"> + <string/> + </property> + <property name="text"> + <string>2m MSK</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QCheckBox" name="cb10m"> + <property name="toolTip"> + <string>10m FT8</string> + </property> + <property name="text"> + <string>10m</string> + </property> + </widget> + </item> + <item row="4" column="1"> + <widget class="QCheckBox" name="cb6m"> + <property name="toolTip"> + <string>6m FT8</string> + </property> + <property name="text"> + <string>6m</string> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QCheckBox" name="cb60m"> + <property name="toolTip"> + <string>60m FT8</string> + </property> + <property name="text"> + <string>60m</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QCheckBox" name="cb160m"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip"> + <string>160m FT8</string> + </property> + <property name="text"> + <string>160m</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QCheckBox" name="cb80m"> + <property name="toolTip"> + <string>80m FT8</string> + </property> + <property name="text"> + <string>80m</string> + </property> + </widget> + </item> + <item row="6" column="0"> + <widget class="QCheckBox" name="cb20m"> + <property name="toolTip"> + <string>20m FT8</string> + </property> + <property name="text"> + <string>20m</string> + </property> + </widget> + </item> + <item row="7" column="0"> + <widget class="QCheckBox" name="cb17m"> + <property name="toolTip"> + <string>17m FT8</string> + </property> + <property name="text"> + <string>17m</string> + </property> + </widget> + </item> + <item row="5" column="1"> + <widget class="QCheckBox" name="cb4m"> + <property name="toolTip"> + <string>4m FT8</string> + </property> + <property name="text"> + <string>4m</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QCheckBox" name="cb15m"> + <property name="toolTip"> + <string>15m FT8</string> + </property> + <property name="text"> + <string>15m</string> + </property> + </widget> + </item> + <item row="6" column="1"> + <widget class="QCheckBox" name="cb2m"> + <property name="toolTip"> + <string>2m FT8</string> + </property> + <property name="text"> + <string>2m</string> + </property> + </widget> + </item> + <item row="8" column="2"> + <widget class="QCheckBox" name="cb10mFT4"> + <property name="toolTip"> + <string>10m FT4</string> + </property> + <property name="text"> + <string>10m FT4</string> + </property> + </widget> + </item> + <item row="7" column="2"> + <widget class="QCheckBox" name="cb12mFT4"> + <property name="toolTip"> + <string>12m FT4</string> + </property> + <property name="text"> + <string>12m FT4</string> + </property> + </widget> + </item> + <item row="6" column="2"> + <widget class="QCheckBox" name="cb15mFT4"> + <property name="toolTip"> + <string>15m FT4</string> + </property> + <property name="text"> + <string>15m FT4</string> + </property> + </widget> + </item> + <item row="5" column="2"> + <widget class="QCheckBox" name="cb17mFT4"> + <property name="toolTip"> + <string>17m FT4</string> + </property> + <property name="text"> + <string>17m FT4</string> + </property> + </widget> + </item> + <item row="4" column="2"> + <widget class="QCheckBox" name="cb20mFT4"> + <property name="toolTip"> + <string>20m FT4</string> + </property> + <property name="text"> + <string>20m FT4</string> + </property> + </widget> + </item> + <item row="3" column="2"> + <widget class="QCheckBox" name="cb30mFT4"> + <property name="toolTip"> + <string>30m FT4</string> + </property> + <property name="text"> + <string>30m FT4</string> + </property> + </widget> + </item> + <item row="2" column="2"> + <widget class="QCheckBox" name="cb40mFT4"> + <property name="toolTip"> + <string>40m FT4</string> + </property> + <property name="text"> + <string>40m FT4</string> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QCheckBox" name="cb80mFT4"> + <property name="toolTip"> + <string>80m FT4</string> + </property> + <property name="text"> + <string>80m FT4</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <layout class="QGridLayout" name="gridLayout_10" columnstretch="0,1"> + <property name="bottomMargin"> + <number>0</number> + </property> + <property name="horizontalSpacing"> + <number>1</number> + </property> + <property name="verticalSpacing"> + <number>6</number> + </property> + <item row="6" column="0"> + <widget class="QCheckBox" name="cbQRG6"> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + <property name="toolTip"> + <string>FT8 QRG6</string> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QCheckBox" name="cbQRG1"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + <property name="toolTip"> + <string>FT8 QRG1</string> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QCheckBox" name="cbQRG2"> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + <property name="toolTip"> + <string>FT8 QRG2</string> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="7" column="0"> + <widget class="QCheckBox" name="cbQRG7"> + <property name="toolTip"> + <string>FT8 QRG7</string> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="8" column="1"> + <widget class="QSpinBox" name="sbQRG8"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>57</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + <property name="toolTip"> + <string>FT8 QRG8 in kHz.</string> + </property> + <property name="showGroupSeparator" stdset="0"> + <bool>true</bool> + </property> + <property name="maximum"> + <number>99999999</number> + </property> + <property name="value"> + <number>28091</number> + </property> + <property name="displayIntegerBase"> + <number>10</number> + </property> + </widget> + </item> + <item row="5" column="0"> + <widget class="QCheckBox" name="cbQRG5"> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + <property name="toolTip"> + <string>FT8 QRG5</string> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QCheckBox" name="cbQRG3"> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + <property name="toolTip"> + <string>FT8 QRG3</string> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="4" column="0"> + <widget class="QCheckBox" name="cbQRG4"> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + <property name="toolTip"> + <string>FT8 QRG4</string> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="8" column="0"> + <widget class="QCheckBox" name="cbQRG8"> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + <property name="toolTip"> + <string>FT8 QRG8</string> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="7" column="1"> + <widget class="QSpinBox" name="sbQRG7"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>57</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + <property name="toolTip"> + <string>FT8 QRG7 in kHz.</string> + </property> + <property name="showGroupSeparator" stdset="0"> + <bool>true</bool> + </property> + <property name="maximum"> + <number>99999999</number> + </property> + <property name="value"> + <number>24911</number> + </property> + </widget> + </item> + <item row="6" column="1"> + <widget class="QSpinBox" name="sbQRG6"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>57</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + <property name="toolTip"> + <string>FT8 QRG6 in kHz.</string> + </property> + <property name="showGroupSeparator" stdset="0"> + <bool>true</bool> + </property> + <property name="maximum"> + <number>99999999</number> + </property> + <property name="value"> + <number>21091</number> + </property> + </widget> + </item> + <item row="5" column="1"> + <widget class="QSpinBox" name="sbQRG5"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>57</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + <property name="toolTip"> + <string>FT8 QRG5 in kHz.</string> + </property> + <property name="showGroupSeparator" stdset="0"> + <bool>true</bool> + </property> + <property name="maximum"> + <number>99999999</number> + </property> + <property name="value"> + <number>18095</number> + </property> + </widget> + </item> + <item row="4" column="1"> + <widget class="QSpinBox" name="sbQRG4"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>57</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + <property name="toolTip"> + <string>FT8 QRG4 in kHz.</string> + </property> + <property name="showGroupSeparator" stdset="0"> + <bool>true</bool> + </property> + <property name="maximum"> + <number>99999999</number> + </property> + <property name="value"> + <number>14090</number> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QSpinBox" name="sbQRG3"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>57</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + <property name="toolTip"> + <string>FT8 QRG3 in kHz.</string> + </property> + <property name="showGroupSeparator" stdset="0"> + <bool>true</bool> + </property> + <property name="maximum"> + <number>99999999</number> + </property> + <property name="value"> + <number>10131</number> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QSpinBox" name="sbQRG2"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>57</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + <property name="toolTip"> + <string>FT8 QRG2 in kHz.</string> + </property> + <property name="showGroupSeparator" stdset="0"> + <bool>true</bool> + </property> + <property name="maximum"> + <number>99999999</number> + </property> + <property name="value"> + <number>7056</number> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QSpinBox" name="sbQRG1"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>57</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + <property name="toolTip"> + <string>FT8 QRG1 in kHz.</string> + </property> + <property name="showGroupSeparator" stdset="0"> + <bool>true</bool> + </property> + <property name="maximum"> + <number>99999999</number> + </property> + <property name="singleStep"> + <number>1</number> + </property> + <property name="value"> + <number>3567</number> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </item> + </layout> + </widget> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="page_2"> + <layout class="QVBoxLayout" name="verticalLayout_5"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="QWidget" name="widget_2" native="true"> + <layout class="QHBoxLayout" name="horizontalLayout_9"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="QWidget" name="WSPR_controls_widget" native="true"> + <layout class="QGridLayout" name="gridLayout_9"> + <item row="1" column="0"> + <spacer name="horizontalSpacer_7"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="1" column="2"> + <spacer name="horizontalSpacer_6"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="2" column="1"> + <spacer name="verticalSpacer_2"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + <item row="1" column="1"> + <layout class="QHBoxLayout" name="horizontalLayout_12"> + <item> + <layout class="QVBoxLayout" name="verticalLayout_7"> + <item> + <widget class="QSpinBox" name="WSPRfreqSpinBox"> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="suffix"> + <string> Hz</string> + </property> + <property name="prefix"> + <string>Tx </string> + </property> + <property name="minimum"> + <number>1400</number> + </property> + <property name="maximum"> + <number>1600</number> + </property> + <property name="value"> + <number>1500</number> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="sbFST4W_RxFreq"> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="suffix"> + <string> Hz</string> + </property> + <property name="prefix"> + <string>Rx </string> + </property> + <property name="minimum"> + <number>100</number> + </property> + <property name="maximum"> + <number>4900</number> + </property> + <property name="singleStep"> + <number>100</number> + </property> + <property name="value"> + <number>1500</number> + </property> + </widget> + </item> + <item> + <widget class="HintedSpinBox" name="sbFST4W_FTol"> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="suffix"> + <string> Hz</string> + </property> + <property name="prefix"> + <string>F Tol </string> + </property> + <property name="minimum"> + <number>100</number> + </property> + <property name="maximum"> + <number>500</number> + </property> + <property name="singleStep"> + <number>100</number> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="RoundRobin"> + <property name="editable"> + <bool>true</bool> + </property> + <property name="currentIndex"> + <number>0</number> + </property> + <item> + <property name="text"> + <string>Random</string> + </property> + </item> + <item> + <property name="text"> + <string>1/2</string> + </property> + </item> + <item> + <property name="text"> + <string>2/2</string> + </property> + </item> + <item> + <property name="text"> + <string>1/3</string> + </property> + </item> + <item> + <property name="text"> + <string>2/3</string> + </property> + </item> + <item> + <property name="text"> + <string>3/3</string> + </property> + </item> + <item> + <property name="text"> + <string>1/4</string> + </property> + </item> + <item> + <property name="text"> + <string>2/4</string> + </property> + </item> + <item> + <property name="text"> + <string>3/4</string> + </property> + </item> + <item> + <property name="text"> + <string>4/4</string> + </property> + </item> + <item> + <property name="text"> + <string>1/5</string> + </property> + </item> + <item> + <property name="text"> + <string>2/5</string> + </property> + </item> + <item> + <property name="text"> + <string>3/5</string> + </property> + </item> + <item> + <property name="text"> + <string>4/5</string> + </property> + </item> + <item> + <property name="text"> + <string>5/5</string> + </property> + </item> + <item> + <property name="text"> + <string>1/6</string> + </property> + </item> + <item> + <property name="text"> + <string>2/6</string> + </property> + </item> + <item> + <property name="text"> + <string>3/6</string> + </property> + </item> + <item> + <property name="text"> + <string>4/6</string> + </property> + </item> + <item> + <property name="text"> + <string>5/6</string> + </property> + </item> + <item> + <property name="text"> + <string>6/6</string> + </property> + </item> + </widget> + </item> + <item> + <widget class="QSpinBox" name="sbTxPercent"> + <property name="toolTip"> + <string>Percentage of minute sequences devoted to transmitting.</string> + </property> + <property name="styleSheet"> + <string notr="true">QSpinBox:enabled[notx="true"] { + color: rgb(0, 0, 0); + background-color: rgb(255, 255, 0); +}</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="suffix"> + <string> %</string> + </property> + <property name="prefix"> + <string>Tx Pct </string> + </property> + <property name="maximum"> + <number>100</number> + </property> + </widget> + </item> + <item> + <widget class="RestrictedSpinBox" name="sbTR_FST4W"> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="suffix"> + <string> s</string> + </property> + <property name="prefix"> + <string>T/R </string> + </property> + <property name="minimum"> + <number>15</number> + </property> + <property name="maximum"> + <number>1800</number> + </property> + </widget> + </item> + <item> + <widget class="QGroupBox" name="band_hopping_group_box"> + <property name="title"> + <string>Band Hopping</string> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_7"> + <item> + <widget class="QPushButton" name="band_hopping_schedule_push_button"> + <property name="toolTip"> + <string>Choose bands and times of day for band-hopping.</string> + </property> + <property name="text"> + <string>Schedule ...</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QVBoxLayout" name="verticalLayout_8"> + <item> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_10"> + <item> + <widget class="QCheckBox" name="cbUploadWSPR_Spots"> + <property name="toolTip"> + <string>Upload decoded messages to WSPRnet.org.</string> + </property> + <property name="styleSheet"> + <string notr="true">QCheckBox:unchecked { + color: rgb(0, 0, 0); + background-color: rgb(255, 255, 0); +}</string> + </property> + <property name="text"> + <string>Upload spots</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="QCheckBox" name="WSPR_prefer_type_1_check_box"> + <property name="toolTip"> + <string><html><head/><body><p>6 digit locators cause 2 different messages to be sent, the second contains the full locator but only a hashed callsign, other stations must have decoded the first once before they can decode your call in the second. Check this option to only send 4 digit locators if it will avoid the two message protocol.</p></body></html></string> + </property> + <property name="accessibleDescription"> + <string>6 digit locators cause 2 different messages to be sent, the second contains the full locator but only a hashed callsign, other stations must have decoded the first once before they can decode your call in the second. Check this option to only send 4 digit locators if it will avoid the two message protocol.</string> + </property> + <property name="text"> + <string>Prefer Type 1 messages</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="cbNoOwnCall"> + <property name="text"> + <string>No own call decodes</string> + </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_13"> + <item> + <widget class="QPushButton" name="pbTxNext"> + <property name="toolTip"> + <string><html><head/><body><p>Transmit during the next sequence.</p></body></html></string> + </property> + <property name="styleSheet"> + <string notr="true">QPushButton:checked { + color: rgb(0, 0, 0); + background-color: red; + border-style: outset; + border-width: 1px; + border-radius: 5px; + border-color: black; + min-width: 5em; + padding: 3px; +}</string> + </property> + <property name="text"> + <string>Tx Next</string> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_14"> + <item> + <widget class="QComboBox" name="TxPowerComboBox"> + <property name="toolTip"> + <string>Set Tx power in dBm (dB above 1 mW) as part of your WSPR message.</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_3"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + </layout> + </item> + </layout> + </item> + </layout> + </item> + <item row="0" column="1"> + <spacer name="verticalSpacer_3"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="page_3"> + <layout class="QHBoxLayout" name="horizontalLayout_17"> + <item> + <spacer name="horizontalSpacer_4"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <layout class="QVBoxLayout" name="verticalLayout_12"> + <item> + <spacer name="verticalSpacer_7"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + <item> + <layout class="QGridLayout" name="gridLayout_2" columnstretch="3,2"> + <item row="1" column="0"> + <widget class="QRadioButton" name="rbEchoMessage"> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + <property name="text"> + <string>Message</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="HintedSpinBox" name="sbToneSpacing"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="suffix"> + <string> Hz</string> + </property> + <property name="prefix"> + <string>Spacing </string> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QRadioButton" name="rbFixedTone"> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + <property name="text"> + <string>Fixed Tone</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QLineEdit" name="leEchoMessage"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + <property name="text"> + <string>K1JT</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QRadioButton" name="rbEchoCW"> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + <property name="text"> + <string>CW</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <spacer name="verticalSpacer_5"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item> + <spacer name="horizontalSpacer_5"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + </widget> + </item> + <item row="0" column="4" colspan="2"> + <widget class="QLabel" name="labDialFreq"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="focusPolicy"> + <enum>Qt::WheelFocus</enum> + </property> + <property name="toolTip"> + <string>USB dial frequency</string> + </property> + <property name="styleSheet"> + <string notr="true">QLabel { + font-family: MS Shell Dlg 2; + font-size: 16pt; + color : yellow; + background-color : black; +} +QLabel[oob="true"] { + background-color: red; +}</string> + </property> + <property name="text"> + <string>14.078 000</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="margin"> + <number>5</number> + </property> + </widget> + </item> + <item row="1" column="3" rowspan="2"> + <layout class="QVBoxLayout" name="verticalLayout_15"> + <item> + <widget class="QPushButton" name="houndButton"> + <property name="minimumSize"> + <size> + <width>32</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> + <property name="toolTip"> + <string>Toggle FT8 hound mode On/Off.<br>Right-click to activate or deactivate SuperFox mode.</string> + </property> + <property name="text"> + <string>H</string> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="ft8Button"> + <property name="minimumSize"> + <size> + <width>32</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> + <property name="toolTip"> + <string>Switch to FT8 mode.<br>Right-click to toggle last used contest mode On/Off.</string> + </property> + <property name="text"> + <string>FT8</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="ft4Button"> + <property name="minimumSize"> + <size> + <width>32</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + <property name="toolTip"> + <string>Switch to FT4 mode</string> + </property> + <property name="text"> + <string>FT4</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="msk144Button"> + <property name="minimumSize"> + <size> + <width>32</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> + <property name="toolTip"> + <string>Switch to MSK144 mode</string> + </property> + <property name="text"> + <string>MSK</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="q65Button"> + <property name="minimumSize"> + <size> + <width>32</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> + <property name="toolTip"> + <string><html><head/><body><p>Switch to Q65 mode.<br> Right-click to switch to Q65 Pileup mode.</p></body></html></string> + </property> + <property name="text"> + <string>Q65</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="jt65Button"> + <property name="minimumSize"> + <size> + <width>32</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> + <property name="toolTip"> + <string><html><head/><body><p>Switch to JT65 mode. <br>Right-click to switch to JT9 mode.</p></body></html></string> + </property> + <property name="text"> + <string>JT65</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="echoButton"> + <property name="minimumSize"> + <size> + <width>32</width> + <height>0</height> + </size> + </property> + <property name="toolTip"> + <string><html><head/><body><p>Switch to Echo mode</p></body></html></string> + </property> + <property name="text"> + <string>Echo</string> + </property> + </widget> + </item> + </layout> + </item> + <item row="2" column="4" colspan="2"> + <widget class="QLabel" name="labUTC"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="styleSheet"> + <string notr="true">QLabel { + font-family: MS Shell Dlg 2; + font-size: 16pt; + background-color : black; + color : yellow; +}</string> + </property> + <property name="frameShape"> + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Sunken</enum> + </property> + <property name="lineWidth"> + <number>2</number> + </property> + <property name="midLineWidth"> + <number>0</number> + </property> + <property name="text"> + <string><html><head/><body><p align="center"> 2015 Jun 17 </p><p align="center"> 01:23:45 </p></body></html></string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="margin"> + <number>5</number> + </property> + </widget> + </item> + <item row="0" column="2" colspan="2"> + <layout class="QHBoxLayout" name="horizontalLayout_16" stretch="1,0"> + <item> + <widget class="BandComboBox" name="bandComboBox"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + <property name="toolTip"> + <string><html><head/><body><p>Select operating band or enter frequency in MHz or enter kHz increment followed by k.</p></body></html></string> + </property> + <property name="accessibleName"> + <string>Frequency entry</string> + </property> + <property name="accessibleDescription"> + <string>Select operating band or enter frequency in MHz or enter kHz increment followed by k.</string> + </property> + <property name="editable"> + <bool>true</bool> + </property> + <property name="maxVisibleItems"> + <number>28</number> + </property> + <property name="insertPolicy"> + <enum>QComboBox::NoInsert</enum> + </property> + <property name="sizeAdjustPolicy"> + <enum>QComboBox::AdjustToMinimumContentsLengthWithIcon</enum> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="readFreq"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip"> + <string><html><head/><body><p>If orange or red there has been a rig control failure, click to reset and read the dial frequency. S implies split mode.</p></body></html></string> + </property> + <property name="accessibleDescription"> + <string>If orange or red there has been a rig control failure, click to reset and read the dial frequency. S implies split mode.</string> + </property> + <property name="styleSheet"> + <string notr="true">QPushButton { + font-family: helvetica; + font-size: 9pt; + font-weight: bold; + background-color: white; + color: black; + border-style: solid; + border-width:1px; + border-radius:10px; + border-color: gray; + max-width:20px; + max-height:20px; + min-width:20px; + min-height:20px; +} +QPushButton[state="error"] { + background-color: red; +} +QPushButton[state="warning"] { + background-color: orange; +} +QPushButton[state="ok"] { + background-color: #00ff00; +}</string> + </property> + <property name="text"> + <string>?</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + <widget class="QMenuBar" name="menuBar"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>880</width> + <height>17</height> + </rect> + </property> + <widget class="QMenu" name="menuFile"> + <property name="title"> + <string>File</string> + </property> + <addaction name="actionOpen"/> + <addaction name="actionOpen_next_in_directory"/> + <addaction name="actionDecode_remaining_files_in_directory"/> + <addaction name="separator"/> + <addaction name="actionDelete_all_wav_files_in_SaveDir"/> + <addaction name="actionErase_ALL_TXT"/> + <addaction name="actionErase_wsjtx_log_adi"/> + <addaction name="actionErase_Tx_Log"/> + <addaction name="actionErase_Ignore_List"/> + <addaction name="actionErase_WSPR_hashtable"/> + <addaction name="actionErase_list_of_Q65_callers"/> + <addaction name="reset_cabrillo_log_action"/> + <addaction name="actionExport_Cabrillo_log"/> + <addaction name="actionOpen_log_directory"/> + <addaction name="separator"/> + <addaction name="actionSettings"/> + <addaction name="separator"/> + <addaction name="separator"/> + <addaction name="actionExit"/> + </widget> + <widget class="QMenu" name="menuView"> + <property name="title"> + <string>View</string> + </property> + <addaction name="actionWide_Waterfall"/> + <addaction name="actionAstronomical_data"/> + <addaction name="actionMessage_averaging"/> + <addaction name="actionEcho_Graph"/> + <addaction name="actionFast_Graph"/> + <addaction name="contest_log_action"/> + <addaction name="fox_log_action"/> + <addaction name="actionColors"/> + <addaction name="actionActiveStations"/> + <addaction name="actionSWL_Mode"/> + <addaction name="actionQSYMessage_Creator"/> + <addaction name="actionQSY_Monitor"/> + <addaction name="actionEnable_QSY_Popups"/> + <addaction name="actionBand_Buttons"/> + <addaction name="actionVHF_UHF_Buttons"/> + <addaction name="actionUse_Dark_Style"/> + </widget> + <widget class="QMenu" name="menuFilters"> + <property name="title"> + <string>Filters</string> + </property> + <addaction name="actionHideB4"/> + <addaction name="actionHideToday"/> + <addaction name="actionHideIgnored"/> + <addaction name="separator"/> + <addaction name="actionIgnoreB4"/> + <addaction name="actionIgnoreToday"/> + <addaction name="actionIgnoreIgnored"/> + <addaction name="separator"/> + <addaction name="actionHideTerritory1"/> + <addaction name="actionHideTerritory2"/> + <addaction name="actionHideTerritory3"/> + <addaction name="actionHideTerritory4"/> + <addaction name="separator"/> + <addaction name="actionHideEU"/> + <addaction name="actionHideNA"/> + <addaction name="actionHideSA"/> + <addaction name="actionHideAS"/> + <addaction name="actionHideAF"/> + <addaction name="actionHideOC"/> + <addaction name="actionHideAN"/> + <addaction name="separator"/> + <addaction name="actionHighlightB4"/> + <addaction name="actionHighlightToday"/> + <addaction name="actionHighlightIgnored"/> + <addaction name="separator"/> + <addaction name="actionHighlightTerritory1"/> + <addaction name="actionHighlightTerritory2"/> + <addaction name="actionHighlightTerritory3"/> + <addaction name="actionHighlightTerritory4"/> + <addaction name="separator"/> + <addaction name="actionHighlight_Whitelist_entries"/> + </widget> + <widget class="QMenu" name="menuDecode"> + <property name="title"> + <string>Decode</string> + </property> + <widget class="QMenu" name="menuParameters"> + <property name="title"> + <string>Parameters</string> + </property> + <widget class="QMenu" name="menuDecoder_sensitivity"> + <property name="title"> + <string>Decoder sensitivity</string> + </property> + <addaction name="actionFT8SensMin"/> + <addaction name="actionlowFT8thresholds"/> + <addaction name="actionFT8subpass"/> + </widget> + <widget class="QMenu" name="menuDecoder_start"> + <property name="title"> + <string>Decoder start</string> + </property> + <addaction name="actionStartTwoStage"/> + <addaction name="actionStartThreeStage"/> + <addaction name="actionStartEarly"/> + <addaction name="actionStartNormal"/> + <addaction name="actionStartLate"/> + </widget> + <widget class="QMenu" name="menuFT8_threads"> + <property name="title"> + <string>Number of threads</string> + </property> + <addaction name="actionMTAuto"/> + <addaction name="actionMT1"/> + <addaction name="actionMT2"/> + <addaction name="actionMT3"/> + <addaction name="actionMT4"/> + <addaction name="actionMT5"/> + <addaction name="actionMT6"/> + <addaction name="actionMT7"/> + <addaction name="actionMT8"/> + <addaction name="actionMT9"/> + <addaction name="actionMT10"/> + <addaction name="actionMT11"/> + <addaction name="actionMT12"/> + </widget> + <widget class="QMenu" name="menuQSO_RX_freq_sensitivity"> + <property name="title"> + <string>QSO RX freq sensitivity</string> + </property> + <addaction name="actionRXfLow"/> + <addaction name="actionRXfMedium"/> + <addaction name="actionRXfHigh"/> + </widget> + <widget class="QMenu" name="menuDecoding_cycles"> + <property name="title"> + <string>Decoding cycles</string> + </property> + <addaction name="actionDecFT8cycles1"/> + <addaction name="actionDecFT8cycles2"/> + <addaction name="actionDecFT8cycles3"/> + </widget> + <addaction name="menuFT8_threads"/> + <addaction name="menuDecoding_cycles"/> + <addaction name="menuQSO_RX_freq_sensitivity"/> + <addaction name="menuDecoder_sensitivity"/> + <addaction name="menuDecoder_start"/> + <addaction name="separator"/> + <addaction name="actionFT8WidebandDXCallSearch"/> + <addaction name="actionHide_FT8_dupe_messages"/> + </widget> + <addaction name="actionQuickDecode"/> + <addaction name="actionMediumDecode"/> + <addaction name="actionDeepestDecode"/> + <addaction name="separator"/> + <addaction name="actionUse_multithreaded_FT8_decoder"/> + <addaction name="menuParameters"/> + <addaction name="separator"/> + <addaction name="actionInclude_averaging"/> + <addaction name="actionInclude_correlation"/> + <addaction name="actionEnable_AP_FT8"/> + <addaction name="actionEnable_AP_JT65"/> + <addaction name="actionEnable_AP_DXcall"/> + <addaction name="actionHide_AP_info"/> + <addaction name="actionAuto_Clear_Avg"/> + <addaction name="actionDisable_clicks_on_waterfall"/> + <addaction name="actionReduce_false_decodes"/> + <addaction name="separator"/> + <addaction name="actionFull_Duplex_Mode"/> + </widget> + <widget class="QMenu" name="menuSave"> + <property name="title"> + <string>Save</string> + </property> + <addaction name="actionNone"/> + <addaction name="actionSave_decoded"/> + <addaction name="actionSave_all"/> + <addaction name="actionRemove_after_30days"/> + <addaction name="separator"/> + <addaction name="actionDon_t_split_ALL_TXT"/> + <addaction name="actionSplit_ALL_TXT_yearly"/> + <addaction name="actionSplit_ALL_TXT_monthly"/> + <addaction name="actionDisable_writing_of_ALL_TXT"/> + <addaction name="separator"/> + <addaction name="actionDefault_event_logging"/> + <addaction name="actionDiagnostic_mode"/> + <addaction name="actionDisable_event_logging"/> + </widget> + <widget class="QMenu" name="menuHelp"> + <property name="title"> + <string>Help</string> + </property> + <addaction name="actionRelease_Notes"/> + <addaction name="actionOnline_User_Guide"/> + <addaction name="actionLocal_User_Guide"/> + <addaction name="actionFT8_DXpedition_Mode_User_Guide"/> + <addaction name="actionSuperFox_User_Guide"/> + <addaction name="actionQSG_FST4"/> + <addaction name="actionQSG_Q65"/> + <addaction name="actionQSG_X250_M3"/> + <addaction name="actionQuick_Start_Guide_to_WSJT_X_2_7_and_QMAP"/> + <addaction name="download_samples_action"/> + <addaction name="actionDownload_EME_Ephemeris_Chart"/> + <addaction name="separator"/> + <addaction name="actionRecommended_Audio_Settings"/> + <addaction name="separator"/> + <addaction name="actionKeyboard_shortcuts"/> + <addaction name="actionSpecial_mouse_commands"/> + <addaction name="actionShort_list_of_add_on_prefixes_and_suffixes"/> + <addaction name="separator"/> + <addaction name="actionCopyright_Notice"/> + <addaction name="separator"/> + <addaction name="actionAbout"/> + </widget> + <widget class="QMenu" name="menuMode"> + <property name="title"> + <string>Mode</string> + </property> + <addaction name="actionFST4"/> + <addaction name="actionFT4"/> + <addaction name="actionFT8"/> + <addaction name="actionJT4"/> + <addaction name="actionJT9"/> + <addaction name="actionJT65"/> + <addaction name="actionQ65"/> + <addaction name="separator"/> + <addaction name="actionMSK144"/> + <addaction name="separator"/> + <addaction name="actionFST4W"/> + <addaction name="actionWSPR"/> + <addaction name="separator"/> + <addaction name="actionEcho"/> + <addaction name="separator"/> + <addaction name="actionFreqCal"/> + </widget> + <widget class="QMenu" name="menuConfig"> + <property name="title"> + <string>Configurations</string> + </property> + </widget> + <widget class="QMenu" name="menuTools"> + <property name="title"> + <string>Tools</string> + </property> + <addaction name="actionErase_reference_spectrum"/> + <addaction name="actionMeasure_reference_spectrum"/> + <addaction name="separator"/> + <addaction name="actionMeasure_phase_response"/> + <addaction name="view_phase_response_action"/> + <addaction name="separator"/> + <addaction name="actionFrequency_calibration"/> + <addaction name="actionSolve_FreqCal"/> + </widget> + <addaction name="menuFile"/> + <addaction name="menuConfig"/> + <addaction name="menuView"/> + <addaction name="menuFilters"/> + <addaction name="menuMode"/> + <addaction name="menuDecode"/> + <addaction name="menuSave"/> + <addaction name="menuTools"/> + <addaction name="menuHelp"/> + </widget> + <widget class="QStatusBar" name="statusBar"/> + <action name="actionExit"> + <property name="text"> + <string>Exit</string> + </property> + <property name="menuRole"> + <enum>QAction::QuitRole</enum> + </property> + </action> + <action name="actionAbout"> + <property name="text"> + <string>About WSJT-X</string> + </property> + <property name="menuRole"> + <enum>QAction::AboutRole</enum> + </property> + </action> + <action name="actionWide_Waterfall"> + <property name="text"> + <string>Waterfall</string> + </property> + </action> + <action name="actionOpen"> + <property name="text"> + <string>Open</string> + </property> + <property name="shortcut"> + <string>Ctrl+O</string> + </property> + </action> + <action name="actionOpen_next_in_directory"> + <property name="text"> + <string>Open next in directory</string> + </property> + </action> + <action name="actionDecode_remaining_files_in_directory"> + <property name="text"> + <string>Decode remaining files in directory</string> + </property> + <property name="shortcut"> + <string>Shift+F6</string> + </property> + </action> + <action name="actionDelete_all_wav_files_in_SaveDir"> + <property name="text"> + <string>Delete all *.wav && *.c2 files in SaveDir</string> + </property> + </action> + <action name="actionQuickDecode"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="checked"> + <bool>false</bool> + </property> + <property name="text"> + <string>Fast</string> + </property> + </action> + <action name="actionNone"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="text"> + <string>None</string> + </property> + </action> + <action name="actionSave_all"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Save all</string> + </property> + </action> + <action name="actionRemove_after_30days"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Remove saved files after 30 days</string> + </property> + </action> + <action name="actionOnline_User_Guide"> + <property name="text"> + <string>Online User Guide</string> + </property> + </action> + <action name="actionKeyboard_shortcuts"> + <property name="text"> + <string>Keyboard shortcuts</string> + </property> + </action> + <action name="actionSpecial_mouse_commands"> + <property name="text"> + <string>Special mouse commands</string> + </property> + </action> + <action name="actionJT9"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="text"> + <string>JT9</string> + </property> + </action> + <action name="actionSave_decoded"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="text"> + <string>Save decoded</string> + </property> + </action> + <action name="actionMediumDecode"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="checked"> + <bool>false</bool> + </property> + <property name="text"> + <string>Normal</string> + </property> + </action> + <action name="actionDeepestDecode"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="text"> + <string>Deep</string> + </property> + </action> + <action name="actionErase_ALL_TXT"> + <property name="text"> + <string>Erase ALL.TXT</string> + </property> + </action> + <action name="actionErase_wsjtx_log_adi"> + <property name="text"> + <string>Erase wsjtx_log.adi</string> + </property> + </action> + <action name="actionErase_Tx_Log"> + <property name="text"> + <string>Erase wsjtx.log</string> + </property> + </action> + <action name="actionErase_Ignore_List"> + <property name="text"> + <string>Erase Ignore List</string> + </property> + </action> + <action name="actionJT65"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>JT65</string> + </property> + </action> + <action name="actionAstronomical_data"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Astronomical data</string> + </property> + </action> + <action name="actionShort_list_of_add_on_prefixes_and_suffixes"> + <property name="text"> + <string>List of Type 1 prefixes and suffixes</string> + </property> + </action> + <action name="actionSettings"> + <property name="text"> + <string>Settings...</string> + </property> + <property name="menuRole"> + <enum>QAction::PreferencesRole</enum> + </property> + </action> + <action name="actionLocal_User_Guide"> + <property name="text"> + <string>Local User Guide</string> + </property> + </action> + <action name="actionOpen_log_directory"> + <property name="text"> + <string>Open log directory</string> + </property> + </action> + <action name="actionJT4"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>JT4</string> + </property> + </action> + <action name="actionMessage_averaging"> + <property name="text"> + <string>Message averaging</string> + </property> + <property name="shortcut"> + <string>F7</string> + </property> + </action> + <action name="actionInclude_averaging"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Enable averaging</string> + </property> + </action> + <action name="actionInclude_correlation"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Enable deep search</string> + </property> + </action> + <action name="actionWSPR"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>WSPR</string> + </property> + </action> + <action name="actionEcho_Graph"> + <property name="text"> + <string>Echo Graph</string> + </property> + <property name="shortcut"> + <string>F8</string> + </property> + </action> + <action name="actionEcho"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Echo</string> + </property> + <property name="toolTip"> + <string>EME Echo mode</string> + </property> + </action> + <action name="actionISCAT"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>ISCAT</string> + </property> + </action> + <action name="actionFast_Graph"> + <property name="text"> + <string>Fast Graph</string> + </property> + <property name="shortcut"> + <string>F9</string> + </property> + </action> + <action name="download_samples_action"> + <property name="text"> + <string>&Download Samples ...</string> + </property> + <property name="whatsThis"> + <string><html><head/><body><p>Download sample audio files demonstrating the various modes.</p></body></html></string> + </property> + </action> + <action name="actionMSK144"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>MSK144</string> + </property> + </action> + <action name="actionQRA64"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>QRA64</string> + </property> + </action> + <action name="actionRelease_Notes"> + <property name="text"> + <string>Release Notes</string> + </property> + </action> + <action name="actionEnable_AP_DXcall"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Enable AP for DX Call</string> + </property> + </action> + <action name="actionFreqCal"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>FreqCal</string> + </property> + </action> + <action name="actionMeasure_reference_spectrum"> + <property name="text"> + <string>Measure reference spectrum</string> + </property> + </action> + <action name="actionMeasure_phase_response"> + <property name="text"> + <string>Measure phase response</string> + </property> + </action> + <action name="actionErase_reference_spectrum"> + <property name="text"> + <string>Erase reference spectrum</string> + </property> + </action> + <action name="actionFrequency_calibration"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Execute frequency calibration cycle</string> + </property> + </action> + <action name="view_phase_response_action"> + <property name="text"> + <string>Equalization tools ...</string> + </property> + </action> + <action name="actionFT8"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="text"> + <string>FT8</string> + </property> + </action> + <action name="actionEnable_AP_FT8"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Enable AP</string> + </property> + </action> + <action name="actionEnable_AP_JT65"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Enable AP</string> + </property> + </action> + <action name="actionSolve_FreqCal"> + <property name="text"> + <string>Solve for calibration parameters</string> + </property> + </action> + <action name="actionCopyright_Notice"> + <property name="text"> + <string>Copyright notice</string> + </property> + <property name="shortcut"> + <string>Shift+F1</string> + </property> + </action> + <action name="fox_log_action"> + <property name="checkable"> + <bool>false</bool> + </property> + <property name="text"> + <string>Fox log</string> + </property> + </action> + <action name="actionFT8_DXpedition_Mode_User_Guide"> + <property name="text"> + <string>FT8 DXpedition Mode User Guide</string> + </property> + </action> + <action name="reset_cabrillo_log_action"> + <property name="text"> + <string>Reset Cabrillo log ...</string> + </property> + </action> + <action name="actionColors"> + <property name="text"> + <string>Color highlighting scheme</string> + </property> + </action> + <action name="actionExport_Cabrillo_log"> + <property name="text"> + <string>Export Cabrillo log ...</string> + </property> + </action> + <action name="actionQSG_FST4"> + <property name="text"> + <string>Quick-Start Guide to FST4 and FST4W</string> + </property> + </action> + <action name="contest_log_action"> + <property name="text"> + <string>Contest log</string> + </property> + </action> + <action name="actionErase_WSPR_hashtable"> + <property name="text"> + <string>Erase WSPR hashtable</string> + </property> + </action> + <action name="actionFT4"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>FT4</string> + </property> + </action> + <action name="actionFST4"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>FST4</string> + </property> + </action> + <action name="actionFST4W"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>FST4W</string> + </property> + </action> + <action name="actionQ65"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Q65</string> + </property> + </action> + <action name="actionSWL_Mode"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>SWL Mode</string> + </property> + <property name="toolTip"> + <string>Hide lower panel controls to maximize deocde windows</string> + </property> + </action> + <action name="actionQSG_Q65"> + <property name="text"> + <string>Quick-Start Guide to Q65</string> + </property> + </action> + <action name="actionAuto_Clear_Avg"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Auto Clear Avg after decode</string> + </property> + </action> + <action name="actionQSG_X250_M3"> + <property name="text"> + <string>Quick-Start Guide to WSJT-X 2.5.0 and MAP65 3.0</string> + </property> + </action> + <action name="actionDon_t_split_ALL_TXT"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="text"> + <string>Don't split ALL.TXT</string> + </property> + </action> + <action name="actionSplit_ALL_TXT_yearly"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Split ALL.TXT yearly</string> + </property> + </action> + <action name="actionSplit_ALL_TXT_monthly"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Split ALL.TXT monthly</string> + </property> + </action> + <action name="actionDisable_writing_of_ALL_TXT"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Disable writing of ALL.TXT</string> + </property> + </action> + <action name="actionActiveStations"> + <property name="text"> + <string>Active Stations</string> + </property> + </action> + <action name="actionBand_Buttons"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="checked"> + <bool>false</bool> + </property> + <property name="text"> + <string>Band Buttons</string> + </property> + </action> + <action name="actionUse_Dark_Style"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Use Dark Style</string> + </property> + </action> + <action name="actionReduce_false_decodes"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Reduce false decodes</string> + </property> + </action> + <action name="actionDefault_event_logging"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="text"> + <string>Default event logging</string> + </property> + </action> + <action name="actionDiagnostic_mode"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Diagnostic mode</string> + </property> + </action> + <action name="actionDisable_event_logging"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Disable event logging</string> + </property> + </action> + <action name="actionQuick_Start_Guide_to_WSJT_X_2_7_and_QMAP"> + <property name="text"> + <string>Quick-Start Guide to WSJT-X 2.7 and QMAP</string> + </property> + </action> + <action name="actionRecommended_Audio_Settings"> + <property name="text"> + <string>Recommended audio settings</string> + </property> + <property name="whatsThis"> + <string><html><head/><body><p>Recommended Audio Settings.</p></body></html></string> + </property> + </action> + <action name="actionRig_Control_Errors"> + <property name="text"> + <string>How to deal with rig control errors</string> + </property> + <property name="whatsThis"> + <string><html><head/><body><p>How to deal with rig control errors.</p></body></html></string> + </property> + </action> + <action name="actionErase_list_of_Q65_callers"> + <property name="text"> + <string>Erase list of Q65 callers</string> + </property> + </action> + <action name="actionSuperFox_User_Guide"> + <property name="text"> + <string>SuperFox User Guide</string> + </property> + </action> + <action name="actionQSYMessage_Creator"> + <property name="checkable"> + <bool>false</bool> + </property> + <property name="text"> + <string>Message Creator</string> + </property> + </action> + <action name="actionHideB4"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Hide stations worked before on band</string> + </property> + </action> + <action name="actionHideToday"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Hide stations worked today or yesterday</string> + </property> + </action> + <action name="actionHideIgnored"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Hide stations from Ignore List</string> + </property> + </action> + <action name="actionIgnoreToday"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Ignore stations worked today or yesterday</string> + </property> + </action> + <action name="actionIgnoreIgnored"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Ignore stations from Ignore List</string> + </property> + </action> + <action name="actionHideTerritory1"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Hide stations from Territory 1</string> + </property> + </action> + <action name="actionHideTerritory2"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Hide stations from Territory 2</string> + </property> + </action> + <action name="actionHideTerritory3"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Hide stations from Territory 3</string> + </property> + </action> + <action name="actionHideTerritory4"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Hide stations from Territory 4</string> + </property> + </action> + <action name="actionHideEU"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Hide stations from Europe</string> + </property> + </action> + <action name="actionHideNA"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Hide stations from North America</string> + </property> + </action> + <action name="actionHideSA"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Hide stations from South America</string> + </property> + </action> + <action name="actionHideAS"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Hide stations from Asia</string> + </property> + </action> + <action name="actionHideAF"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Hide stations from Africa</string> + </property> + </action> + <action name="actionHideOC"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Hide stations from Oceania</string> + </property> + </action> + <action name="actionHideAN"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Hide stations from Antarctica</string> + </property> + </action> + <action name="actionFull_Duplex_Mode"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Full Duplex Mode</string> + </property> + </action> + <action name="actionHighlightB4"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Highlight callsigns worked before on band</string> + </property> + </action> + <action name="actionHighlightToday"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Highlight callsigns worked today or yesterday</string> + </property> + </action> + <action name="actionHighlightIgnored"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Highlight callsigns from Ignore List</string> + </property> + </action> + <action name="actionEnable_QSY_Popups"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="checked"> + <bool>false</bool> + </property> + <property name="text"> + <string>Enable Message Popups</string> + </property> + </action> + <action name="actionQSY_Monitor"> + <property name="checkable"> + <bool>false</bool> + </property> + <property name="text"> + <string>QSY Monitor</string> + </property> + </action> + <action name="actionIgnoreB4"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Ignore stations worked before on band</string> + </property> + </action> + <action name="actionUse_multithreaded_FT8_decoder"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Use multithreaded FT8 decoder</string> + </property> + </action> + <action name="actionMTAuto"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="text"> + <string>Auto</string> + </property> + </action> + <action name="actionMT1"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>1</string> + </property> + </action> + <action name="actionMT2"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>2</string> + </property> + <property name="iconText"> + <string>2</string> + </property> + </action> + <action name="actionMT3"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>3</string> + </property> + <property name="iconText"> + <string>3</string> + </property> + </action> + <action name="actionMT4"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>4</string> + </property> + </action> + <action name="actionMT5"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>5</string> + </property> + <property name="iconText"> + <string>5</string> + </property> + </action> + <action name="actionMT6"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>6</string> + </property> + <property name="iconText"> + <string>6</string> + </property> + </action> + <action name="actionMT7"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>7</string> + </property> + <property name="iconText"> + <string>7</string> + </property> + </action> + <action name="actionMT8"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>8</string> + </property> + </action> + <action name="actionMT9"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>9</string> + </property> + <property name="iconText"> + <string>9</string> + </property> + </action> + <action name="actionMT10"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>10</string> + </property> + <property name="iconText"> + <string>10</string> + </property> + </action> + <action name="actionMT11"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>11</string> + </property> + <property name="iconText"> + <string>11</string> + </property> + </action> + <action name="actionMT12"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>12</string> + </property> + </action> + <action name="actionRXfLow"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Low</string> + </property> + </action> + <action name="actionRXfMedium"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="text"> + <string>Medium</string> + </property> + </action> + <action name="actionRXfHigh"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>High</string> + </property> + </action> + <action name="actionDecFT8cycles1"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>1</string> + </property> + </action> + <action name="actionDecFT8cycles2"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>2</string> + </property> + </action> + <action name="actionDecFT8cycles3"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="text"> + <string>3</string> + </property> + </action> + <action name="actionFT8SensMin"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Minimum</string> + </property> + </action> + <action name="actionlowFT8thresholds"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Use low thresholds</string> + </property> + </action> + <action name="actionFT8subpass"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="text"> + <string>Use subpass</string> + </property> + </action> + <action name="actionStartTwoStage"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>2-Stage</string> + </property> + </action> + <action name="actionStartThreeStage"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>3-Stage</string> + </property> + </action> + <action name="actionStartEarly"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Early</string> + </property> + </action> + <action name="actionStartNormal"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="text"> + <string>Normal</string> + </property> + </action> + <action name="actionStartLate"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Late</string> + </property> + </action> + <action name="actionFT8WidebandDXCallSearch"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Wideband DX Call search</string> + </property> + </action> + <action name="actionHide_FT8_dupe_messages"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Hide FT8 dupe messages</string> + </property> + </action> + <action name="actionVHF_UHF_Buttons"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>VHF / UHF Buttons</string> + </property> + </action> + <action name="actionHighlightTerritory1"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Highlight stations from Territory 1</string> + </property> + </action> + <action name="actionHighlightTerritory2"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Highlight stations from Territory 2</string> + </property> + </action> + <action name="actionHighlightTerritory3"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Highlight stations from Territory 3</string> + </property> + </action> + <action name="actionHighlightTerritory4"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Highlight stations from Territory 4</string> + </property> + </action> + <action name="actionDisable_clicks_on_waterfall"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Disable clicks on waterfall</string> + </property> + </action> + <action name="actionDownload_EME_Ephemeris_Chart"> + <property name="text"> + <string>Download EME Ephemeris Chart</string> + </property> + </action> + <action name="actionHide_AP_info"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Hide AP information</string> + </property> + <property name="toolTip"> + <string><html><head/><body><p>Hide AP information</p></body></html></string> + </property> + </action> + <action name="actionHighlight_Whitelist_entries"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Highlight Whitelist entries</string> + </property> + </action> + </widget> + <layoutdefault spacing="6" margin="11"/> + <customwidgets> + <customwidget> + <class>DisplayText</class> + <extends>QTextBrowser</extends> + <header>widgets/displaytext.h</header> + </customwidget> + <customwidget> + <class>LettersSpinBox</class> + <extends>QSpinBox</extends> + <header>widgets/LettersSpinBox.hpp</header> + </customwidget> + <customwidget> + <class>SignalMeter</class> + <extends>QFrame</extends> + <header>widgets/signalmeter.h</header> + <container>1</container> + </customwidget> + <customwidget> + <class>HintedSpinBox</class> + <extends>QSpinBox</extends> + <header>widgets/HintedSpinBox.hpp</header> + </customwidget> + <customwidget> + <class>RestrictedSpinBox</class> + <extends>QSpinBox</extends> + <header>widgets/RestrictedSpinBox.hpp</header> + </customwidget> + <customwidget> + <class>DoubleClickableRadioButton</class> + <extends>QRadioButton</extends> + <header>widgets/DoubleClickableRadioButton.hpp</header> + </customwidget> + <customwidget> + <class>DoubleClickablePushButton</class> + <extends>QPushButton</extends> + <header>widgets/DoubleClickablePushButton.hpp</header> + </customwidget> + <customwidget> + <class>BandComboBox</class> + <extends>QComboBox</extends> + <header>widgets/BandComboBox.hpp</header> + </customwidget> + </customwidgets> + <tabstops> + <tabstop>decodedTextBrowser</tabstop> + <tabstop>decodedTextBrowser2</tabstop> + <tabstop>cbCQonly</tabstop> + <tabstop>logQSOButton</tabstop> + <tabstop>stopButton</tabstop> + <tabstop>monitorButton</tabstop> + <tabstop>EraseButton</tabstop> + <tabstop>ClrAvgButton</tabstop> + <tabstop>DecodeButton</tabstop> + <tabstop>autoButton</tabstop> + <tabstop>stopTxButton</tabstop> + <tabstop>tuneButton</tabstop> + <tabstop>cbMenus</tabstop> + <tabstop>sbNB</tabstop> + <tabstop>dxCallEntry</tabstop> + <tabstop>dxGridEntry</tabstop> + <tabstop>txFirstCheckBox</tabstop> + <tabstop>TxFreqSpinBox</tabstop> + <tabstop>pbR2T</tabstop> + <tabstop>sbFtol</tabstop> + <tabstop>pbT2R</tabstop> + <tabstop>RxFreqSpinBox</tabstop> + <tabstop>rptSpinBox</tabstop> + <tabstop>sbTR</tabstop> + <tabstop>cbHoldTxFreq</tabstop> + <tabstop>sbF_Low</tabstop> + <tabstop>sbF_High</tabstop> + <tabstop>sbSubmode</tabstop> + <tabstop>syncSpinBox</tabstop> + <tabstop>sbCQTxFreq</tabstop> + <tabstop>cbCQTx</tabstop> + <tabstop>cbRxAll</tabstop> + <tabstop>cbShMsgs</tabstop> + <tabstop>cbFast9</tabstop> + <tabstop>cbAutoSeq</tabstop> + <tabstop>cbTx6</tabstop> + <tabstop>cbSWL</tabstop> + <tabstop>pbBestSP</tabstop> + <tabstop>measure_check_box</tabstop> + <tabstop>tabWidget</tabstop> + <tabstop>genStdMsgsPushButton</tabstop> + <tabstop>tx1</tabstop> + <tabstop>txrb1</tabstop> + <tabstop>txb1</tabstop> + <tabstop>tx2</tabstop> + <tabstop>txrb2</tabstop> + <tabstop>txb2</tabstop> + <tabstop>tx3</tabstop> + <tabstop>txrb3</tabstop> + <tabstop>txb3</tabstop> + <tabstop>tx4</tabstop> + <tabstop>txrb4</tabstop> + <tabstop>txb4</tabstop> + <tabstop>tx5</tabstop> + <tabstop>txrb5</tabstop> + <tabstop>txb5</tabstop> + <tabstop>tx6</tabstop> + <tabstop>txrb6</tabstop> + <tabstop>txb6</tabstop> + <tabstop>WSPRfreqSpinBox</tabstop> + <tabstop>sbFST4W_RxFreq</tabstop> + <tabstop>sbFST4W_FTol</tabstop> + <tabstop>RoundRobin</tabstop> + <tabstop>sbTxPercent</tabstop> + <tabstop>sbTR_FST4W</tabstop> + <tabstop>band_hopping_group_box</tabstop> + <tabstop>band_hopping_schedule_push_button</tabstop> + <tabstop>cbUploadWSPR_Spots</tabstop> + <tabstop>WSPR_prefer_type_1_check_box</tabstop> + <tabstop>cbNoOwnCall</tabstop> + <tabstop>pbTxNext</tabstop> + <tabstop>TxPowerComboBox</tabstop> + <tabstop>outAttenuation</tabstop> + <tabstop>sbSerialNumber</tabstop> + <tabstop>DX_Call_Button</tabstop> + </tabstops> + <resources/> + <connections/> +</ui> diff --git a/widgets/messageaveraging.cpp b/widgets/messageaveraging.cpp index a1e84f41..21f7b07c 100755..100644 --- a/widgets/messageaveraging.cpp +++ b/widgets/messageaveraging.cpp @@ -1,73 +1,73 @@ -#include "messageaveraging.h"
-
-#include <QSettings>
-#include <QApplication>
-#include <QTextCharFormat>
-
-#include "SettingsGroup.hpp"
-#include "qt_helpers.hpp"
-#include "ui_messageaveraging.h"
-
-#include "moc_messageaveraging.cpp"
-
-MessageAveraging::MessageAveraging(QSettings * settings, QFont const& font, QWidget *parent) :
- QWidget(parent),
- settings_ {settings},
- ui(new Ui::MessageAveraging)
-{
- ui->setupUi(this);
- setWindowTitle (QApplication::applicationName () + " - " + tr ("Message Averaging"));
- ui->msgAvgPlainTextEdit->setReadOnly (true);
- changeFont (font);
- read_settings ();
- ui->header_label->setText(" UTC Sync DT Freq ");
-}
-
-MessageAveraging::~MessageAveraging()
-{
- write_settings ();
-}
-
-void MessageAveraging::changeFont (QFont const& font)
-{
- ui->header_label->setStyleSheet (font_as_stylesheet (font));
- ui->msgAvgPlainTextEdit->setStyleSheet (font_as_stylesheet (font));
- setContentFont (font);
- updateGeometry ();
-}
-
-void MessageAveraging::setContentFont(QFont const& font)
-{
- ui->msgAvgPlainTextEdit->setFont (font);
- QTextCharFormat charFormat;
- charFormat.setFont (font);
- ui->msgAvgPlainTextEdit->selectAll ();
- auto cursor = ui->msgAvgPlainTextEdit->textCursor ();
- cursor.mergeCharFormat (charFormat);
- cursor.clearSelection ();
- cursor.movePosition (QTextCursor::End);
-
- // position so viewport scrolled to left
- cursor.movePosition (QTextCursor::Up);
- cursor.movePosition (QTextCursor::StartOfLine);
-
- ui->msgAvgPlainTextEdit->setTextCursor (cursor);
- ui->msgAvgPlainTextEdit->ensureCursorVisible ();
-}
-
-void MessageAveraging::read_settings ()
-{
- SettingsGroup group {settings_, "MessageAveraging"};
- restoreGeometry (settings_->value ("window/geometry").toByteArray ());
-}
-
-void MessageAveraging::write_settings ()
-{
- SettingsGroup group {settings_, "MessageAveraging"};
- settings_->setValue ("window/geometry", saveGeometry ());
-}
-
-void MessageAveraging::displayAvg(QString const& t)
-{
- ui->msgAvgPlainTextEdit->setPlainText(t);
-}
+#include "messageaveraging.h" + +#include <QSettings> +#include <QApplication> +#include <QTextCharFormat> + +#include "SettingsGroup.hpp" +#include "qt_helpers.hpp" +#include "ui_messageaveraging.h" + +#include "moc_messageaveraging.cpp" + +MessageAveraging::MessageAveraging(QSettings * settings, QFont const& font, QWidget *parent) : + QWidget(parent), + settings_ {settings}, + ui(new Ui::MessageAveraging) +{ + ui->setupUi(this); + setWindowTitle (QApplication::applicationName () + " - " + tr ("Message Averaging")); + ui->msgAvgPlainTextEdit->setReadOnly (true); + changeFont (font); + read_settings (); + ui->header_label->setText(" UTC Sync DT Freq "); +} + +MessageAveraging::~MessageAveraging() +{ + write_settings (); +} + +void MessageAveraging::changeFont (QFont const& font) +{ + ui->header_label->setStyleSheet (font_as_stylesheet (font)); + ui->msgAvgPlainTextEdit->setStyleSheet (font_as_stylesheet (font)); + setContentFont (font); + updateGeometry (); +} + +void MessageAveraging::setContentFont(QFont const& font) +{ + ui->msgAvgPlainTextEdit->setFont (font); + QTextCharFormat charFormat; + charFormat.setFont (font); + ui->msgAvgPlainTextEdit->selectAll (); + auto cursor = ui->msgAvgPlainTextEdit->textCursor (); + cursor.mergeCharFormat (charFormat); + cursor.clearSelection (); + cursor.movePosition (QTextCursor::End); + + // position so viewport scrolled to left + cursor.movePosition (QTextCursor::Up); + cursor.movePosition (QTextCursor::StartOfLine); + + ui->msgAvgPlainTextEdit->setTextCursor (cursor); + ui->msgAvgPlainTextEdit->ensureCursorVisible (); +} + +void MessageAveraging::read_settings () +{ + SettingsGroup group {settings_, "MessageAveraging"}; + restoreGeometry (settings_->value ("window/geometry").toByteArray ()); +} + +void MessageAveraging::write_settings () +{ + SettingsGroup group {settings_, "MessageAveraging"}; + settings_->setValue ("window/geometry", saveGeometry ()); +} + +void MessageAveraging::displayAvg(QString const& t) +{ + ui->msgAvgPlainTextEdit->setPlainText(t); +} diff --git a/widgets/messageaveraging.h b/widgets/messageaveraging.h index 6863107c..a5ed7b54 100755..100644 --- a/widgets/messageaveraging.h +++ b/widgets/messageaveraging.h @@ -1,34 +1,34 @@ -// -*- Mode: C++ -*-
-#ifndef MESSAGEAVERAGING_H_
-#define MESSAGEAVERAGING_H_
-
-#include <QWidget>
-
-class QSettings;
-class QFont;
-
-namespace Ui {
- class MessageAveraging;
-}
-
-class MessageAveraging
- : public QWidget
-{
- Q_OBJECT
-
-public:
- explicit MessageAveraging(QSettings *, QFont const&, QWidget * parent = 0);
- ~MessageAveraging();
- void displayAvg(QString const&);
- void changeFont (QFont const&);
-
-private:
- void read_settings ();
- void write_settings ();
- void setContentFont (QFont const&);
- QSettings * settings_;
-
- QScopedPointer<Ui::MessageAveraging> ui;
-};
-
-#endif
+// -*- Mode: C++ -*- +#ifndef MESSAGEAVERAGING_H_ +#define MESSAGEAVERAGING_H_ + +#include <QWidget> + +class QSettings; +class QFont; + +namespace Ui { + class MessageAveraging; +} + +class MessageAveraging + : public QWidget +{ + Q_OBJECT + +public: + explicit MessageAveraging(QSettings *, QFont const&, QWidget * parent = 0); + ~MessageAveraging(); + void displayAvg(QString const&); + void changeFont (QFont const&); + +private: + void read_settings (); + void write_settings (); + void setContentFont (QFont const&); + QSettings * settings_; + + QScopedPointer<Ui::MessageAveraging> ui; +}; + +#endif diff --git a/widgets/messageaveraging.ui b/widgets/messageaveraging.ui index df187fe3..7957e66e 100755..100644 --- a/widgets/messageaveraging.ui +++ b/widgets/messageaveraging.ui @@ -1,42 +1,42 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>MessageAveraging</class>
- <widget class="QWidget" name="MessageAveraging">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>405</width>
- <height>268</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Message Averaging</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <layout class="QGridLayout" name="gridLayout">
- <item row="1" column="0">
- <widget class="QPlainTextEdit" name="msgAvgPlainTextEdit">
- <property name="lineWrapMode">
- <enum>QPlainTextEdit::NoWrap</enum>
- </property>
- </widget>
- </item>
- <item row="0" column="0">
- <widget class="QLabel" name="header_label">
- <property name="text">
- <string> UTC Sync DT Freq </string>
- </property>
- <property name="margin">
- <number>3</number>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
+<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>MessageAveraging</class> + <widget class="QWidget" name="MessageAveraging"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>405</width> + <height>268</height> + </rect> + </property> + <property name="windowTitle"> + <string>Message Averaging</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <layout class="QGridLayout" name="gridLayout"> + <item row="1" column="0"> + <widget class="QPlainTextEdit" name="msgAvgPlainTextEdit"> + <property name="lineWrapMode"> + <enum>QPlainTextEdit::NoWrap</enum> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="header_label"> + <property name="text"> + <string> UTC Sync DT Freq </string> + </property> + <property name="margin"> + <number>3</number> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/widgets/meterwidget.cpp b/widgets/meterwidget.cpp index 2788597a..9e441a15 100755..100644 --- a/widgets/meterwidget.cpp +++ b/widgets/meterwidget.cpp @@ -1,83 +1,83 @@ -// Simple bargraph meter
-// Implemented by Edson Pereira PY2SDR
-
-#include "meterwidget.h"
-
-#include <QPainter>
-#include <QPolygon>
-
-#include "moc_meterwidget.cpp"
-
-#define MAXDB 90
-
-MeterWidget::MeterWidget(QWidget * parent)
- : QWidget {parent}
- , m_signal {0}
- , m_noisePeak {0}
- , m_sigPeak {0}
-{
- for ( int i = 0; i < 10; i++ ) {
- signalQueue.enqueue(0);
- }
-}
-
-void MeterWidget::setValue(int value)
-{
- m_signal = value;
- signalQueue.enqueue(value);
- signalQueue.dequeue();
-
- // Get signal peak
- int tmp = 0;
- for (int i = 0; i < signalQueue.size(); ++i) {
- if (signalQueue.at(i) > tmp)
- tmp = signalQueue.at(i);
- }
- m_noisePeak = tmp;
-
- update();
-}
-
-QSize MeterWidget::sizeHint () const
-{
- return {10, 100};
-}
-
-void MeterWidget::paintEvent (QPaintEvent * event)
-{
- QWidget::paintEvent (event);
-
- // Sanitize
- m_signal = m_signal < 0 ? 0 : m_signal;
- m_signal = m_signal > MAXDB ? MAXDB : m_signal;
-
- QPainter p {this};
- p.setPen (Qt::NoPen);
-
- auto const& target = contentsRect ();
- QRect r {QPoint {target.left (), static_cast<int> (target.top () + target.height () - m_signal / (double)MAXDB * target.height ())}
- , QPoint {target.right (), target.bottom ()}};
- p.setBrush (QColor(85,170,85));
- if (m_sigPeak > 85) {
- p.setBrush(Qt::red);
- }
- else if (m_noisePeak < 15) {
- p.setBrush(QColor(232,81,0));
- }
- p.drawRect (r);
-
- if (m_noisePeak)
- {
- // Draw peak hold indicator
- auto peak = static_cast<int> (target.top () + target.height () - m_noisePeak / (double)MAXDB * target.height ());
- p.setBrush (Qt::black);
- p.translate (target.left (), peak);
- p.drawPolygon (QPolygon {{{0, -4}, {0, 4}, {target.width (), 0}}});
- }
-}
-
-//
-void MeterWidget::set_sigPeak(int value)
-{
- m_sigPeak = value;
-}
+// Simple bargraph meter +// Implemented by Edson Pereira PY2SDR + +#include "meterwidget.h" + +#include <QPainter> +#include <QPolygon> + +#include "moc_meterwidget.cpp" + +#define MAXDB 90 + +MeterWidget::MeterWidget(QWidget * parent) + : QWidget {parent} + , m_signal {0} + , m_noisePeak {0} + , m_sigPeak {0} +{ + for ( int i = 0; i < 10; i++ ) { + signalQueue.enqueue(0); + } +} + +void MeterWidget::setValue(int value) +{ + m_signal = value; + signalQueue.enqueue(value); + signalQueue.dequeue(); + + // Get signal peak + int tmp = 0; + for (int i = 0; i < signalQueue.size(); ++i) { + if (signalQueue.at(i) > tmp) + tmp = signalQueue.at(i); + } + m_noisePeak = tmp; + + update(); +} + +QSize MeterWidget::sizeHint () const +{ + return {10, 100}; +} + +void MeterWidget::paintEvent (QPaintEvent * event) +{ + QWidget::paintEvent (event); + + // Sanitize + m_signal = m_signal < 0 ? 0 : m_signal; + m_signal = m_signal > MAXDB ? MAXDB : m_signal; + + QPainter p {this}; + p.setPen (Qt::NoPen); + + auto const& target = contentsRect (); + QRect r {QPoint {target.left (), static_cast<int> (target.top () + target.height () - m_signal / (double)MAXDB * target.height ())} + , QPoint {target.right (), target.bottom ()}}; + p.setBrush (QColor(85,170,85)); + if (m_sigPeak > 85) { + p.setBrush(Qt::red); + } + else if (m_noisePeak < 15) { + p.setBrush(QColor(232,81,0)); + } + p.drawRect (r); + + if (m_noisePeak) + { + // Draw peak hold indicator + auto peak = static_cast<int> (target.top () + target.height () - m_noisePeak / (double)MAXDB * target.height ()); + p.setBrush (Qt::black); + p.translate (target.left (), peak); + p.drawPolygon (QPolygon {{{0, -4}, {0, 4}, {target.width (), 0}}}); + } +} + +// +void MeterWidget::set_sigPeak(int value) +{ + m_sigPeak = value; +} diff --git a/widgets/meterwidget.h b/widgets/meterwidget.h index 4d48cfc5..08bda6d5 100755..100644 --- a/widgets/meterwidget.h +++ b/widgets/meterwidget.h @@ -1,33 +1,33 @@ -// -*- Mode: C++ -*-
-#ifndef METERWIDGET_H
-#define METERWIDGET_H
-
-#include <QWidget>
-#include <QQueue>
-
-class MeterWidget : public QWidget
-{
- Q_OBJECT
- Q_PROPERTY (int value READ value WRITE setValue)
-
-public:
- explicit MeterWidget (QWidget *parent = 0);
-
- // value property
- int value () const {return m_signal;}
- Q_SLOT void setValue (int value);
-
- // QWidget implementation
- QSize sizeHint () const override;
- void set_sigPeak(int value);
-protected:
- void paintEvent( QPaintEvent * ) override;
-
-private:
- QQueue<int> signalQueue;
- int m_signal;
- int m_noisePeak;
- int m_sigPeak; // peak value for color coding
-};
-
-#endif // METERWIDGET_H
+// -*- Mode: C++ -*- +#ifndef METERWIDGET_H +#define METERWIDGET_H + +#include <QWidget> +#include <QQueue> + +class MeterWidget : public QWidget +{ + Q_OBJECT + Q_PROPERTY (int value READ value WRITE setValue) + +public: + explicit MeterWidget (QWidget *parent = 0); + + // value property + int value () const {return m_signal;} + Q_SLOT void setValue (int value); + + // QWidget implementation + QSize sizeHint () const override; + void set_sigPeak(int value); +protected: + void paintEvent( QPaintEvent * ) override; + +private: + QQueue<int> signalQueue; + int m_signal; + int m_noisePeak; + int m_sigPeak; // peak value for color coding +}; + +#endif // METERWIDGET_H diff --git a/widgets/plotter.cpp b/widgets/plotter.cpp index 92978409..263566d4 100755..100644 --- a/widgets/plotter.cpp +++ b/widgets/plotter.cpp @@ -1,1091 +1,1091 @@ -#include "plotter.h"
-#include <math.h>
-#include <QAction>
-#include <QMenu>
-#include <QPainter>
-#include <QDateTime>
-#include <QPen>
-#include <QMouseEvent>
-#include <QDebug>
-#include "qt_helpers.hpp"
-#include "commons.h"
-#include "moc_plotter.cpp"
-#include <fstream>
-#include <iostream>
-
-#define MAX_SCREENSIZE 8192
-
-extern "C" {
- void flat4_(float swide[], int* iz, int* nflatten);
- void plotsave_(float swide[], int* m_w , int* m_h1, int* irow);
-}
-
-extern dec_data dec_data;
-
-CPlotter::CPlotter(QWidget *parent) : //CPlotter Constructor
- QFrame {parent},
-// m_set_freq_action {new QAction {tr ("&Set Rx && Tx Offset"), this}},
- m_bScaleOK {false},
- m_bReference {false},
- m_bReference0 {false},
- m_fSpan {2000.0},
- m_plotZero {0},
- m_plotGain {0},
- m_plot2dGain {0},
- m_plot2dZero {0},
- m_nSubMode {0},
- m_Running {false},
- m_paintEventBusy {false},
- m_fftBinWidth {1500.0/2048.0},
- m_dialFreq {0.},
- m_sum {},
- m_dBStepSize {10},
- m_FreqUnits {1},
- m_hdivs {HORZ_DIVS},
- m_line {0},
- m_fSample {12000},
- m_nsps {6912},
- m_Percent2DScreen {30}, //percent of screen used for 2D display
- m_Percent2DScreen0 {0},
- m_rxFreq {1020},
- m_txFreq {0},
- m_startFreq {0},
- m_lastMouseX {-1},
- m_lastPaintedX {-1}
-// m_tol {100}
-{
- setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
- setFocusPolicy(Qt::StrongFocus);
- setAttribute(Qt::WA_PaintOnScreen,false);
- setAutoFillBackground(false);
- setAttribute(Qt::WA_OpaquePaintEvent, false);
- setAttribute(Qt::WA_NoSystemBackground, true);
- setMouseTracking(true);
- m_bReplot=false;
-
- // contextual pop up menu
-// setContextMenuPolicy (Qt::CustomContextMenu);
-// connect (this, &QWidget::customContextMenuRequested, [this] (QPoint const& pos) {
-// QMenu menu {this};
-// menu.addAction (m_set_freq_action);
-// auto const& connection = connect (m_set_freq_action, &QAction::triggered, [this, pos] () {
-// int newFreq = FreqfromX (pos.x ()) + .5;
-// emit setFreq1 (newFreq, newFreq);
-// });
-// menu.exec (mapToGlobal (pos));
-// disconnect (connection);
-// });
-}
-
-CPlotter::~CPlotter() { } // Destructor
-
-QSize CPlotter::minimumSizeHint() const
-{
- return QSize(50, 50);
-}
-
-QSize CPlotter::sizeHint() const
-{
- return QSize(180, 180);
-}
-
-void CPlotter::resizeEvent(QResizeEvent* ) //resizeEvent()
-{
- if(!size().isValid()) return;
- if( m_Size != size() or (m_bReference != m_bReference0) or
- m_Percent2DScreen != m_Percent2DScreen0) {
- m_Size = size();
- m_w = m_Size.width();
- m_h = m_Size.height();
- m_h2 = m_Percent2DScreen*m_h/100.0;
- if(m_h2>m_h-30) m_h2=m_h-30;
- if(m_bReference) m_h2=m_h-30;
- if(m_h2<1) m_h2=1;
- m_h1=m_h-m_h2;
-// m_line=0;
- m_DialOverlayPixmap = QPixmap(m_Size.width(), m_h);
- m_DialOverlayPixmap.fill(Qt::transparent);
- m_HoverOverlayPixmap = QPixmap(m_Size.width(), m_h);
- m_HoverOverlayPixmap.fill(Qt::transparent);
- m_2DPixmap = QPixmap(m_Size.width(), m_h2);
- m_2DPixmap.fill(Qt::black);
- m_WaterfallPixmap = QPixmap(m_Size.width(), m_h1);
- m_OverlayPixmap = QPixmap(m_Size.width(), m_h2);
- m_OverlayPixmap.fill(Qt::black);
- m_WaterfallPixmap.fill(Qt::black);
- m_2DPixmap.fill(Qt::black);
- m_ScalePixmap = QPixmap(m_w,30);
- m_ScalePixmap.fill(Qt::white);
- m_Percent2DScreen0 = m_Percent2DScreen;
- m_bResized = true;
- m_vpixperdiv = float(m_h2)/float(VERT_DIVS);
- m_x=0;
- }
- DrawOverlay();
-}
-
-void CPlotter::paintEvent(QPaintEvent *) // paintEvent()
-{
- if(m_paintEventBusy) return;
- m_paintEventBusy=true;
- QPainter painter(this);
- painter.drawPixmap(0,0,m_ScalePixmap);
- painter.drawPixmap(0,30,m_WaterfallPixmap);
- painter.drawPixmap(0,m_h1,m_2DPixmap);
- int x = XfromFreq(m_rxFreq);
- if (m_bars) {
- painter.drawPixmap(0,30,m_DialOverlayPixmap);
- if(m_lastMouseX >= 0 && m_lastMouseX != x){
- painter.drawPixmap(m_lastMouseX, 0, m_HoverOverlayPixmap);
- }
- }
- m_lastPaintedX = m_lastMouseX;
- m_paintEventBusy=false;
-}
-
-void CPlotter::draw(float swide[], bool bScroll, bool bRed)
-{
- if (!m_TRperiod) return; // not ready to plot yet
- int j,j0;
- float y,y2,ymin;
- double fac = sqrt(m_binsPerPixel*m_waterfallAvg/15.0);
- double gain = fac*pow(10.0,0.015*m_plotGain);
- double gain2d = pow(10.0,0.02*(m_plot2dGain));
-
- if(m_bReference != m_bReference0) resizeEvent(NULL);
- m_bReference0=m_bReference;
-
-//move current data down one line (must do this before attaching a QPainter object)
- if(bScroll and !m_bReplot) m_WaterfallPixmap.scroll(0,1,0,0,m_w,m_h1);
- QPainter painter1(&m_WaterfallPixmap);
- if(m_bFirst or bRed or !m_bQ65_Sync or m_mode!=m_mode0
- or m_bResized or m_rxFreq!=m_rxFreq0) {
- m_2DPixmap = m_OverlayPixmap.copy(0,0,m_w,m_h2);
- m_bFirst=false;
- m_bResized=false;
- m_rxFreq0=m_rxFreq;
- }
- m_mode0=m_mode;
- QPainter painter2D(&m_2DPixmap);
- if(!painter2D.isActive()) return;
- QFont Font("Arial");
- Font.setPointSize(12);
- Font.setWeight(QFont::Normal);
- painter2D.setFont(Font);
-
- if(m_bLinearAvg) {
- painter2D.setPen(Qt::yellow);
- } else if(m_bReference) {
- painter2D.setPen(Qt::blue);
- } else {
- painter2D.setPen(Qt::green);
- }
- static QPoint LineBuf[MAX_SCREENSIZE];
- static QPoint LineBuf2[MAX_SCREENSIZE];
- static QPoint LineBuf3[MAX_SCREENSIZE];
- static QPoint LineBuf4[MAX_SCREENSIZE];
- j=0;
- j0=int(m_startFreq/m_fftBinWidth + 0.5);
- int iz=XfromFreq(5000.0);
- int jz=iz*m_binsPerPixel;
- m_fMax=FreqfromX(iz);
- if(bScroll and swide[0]<1.e29) {
- flat4_(swide,&iz,&m_Flatten);
- if(!m_bReplot) flat4_(&dec_data.savg[j0],&jz,&m_Flatten);
- }
-
- ymin=1.e30;
- if(swide[0]>1.e29 and swide[0]< 1.5e30) painter1.setPen(Qt::green);
- if(swide[0]>1.4e30) painter1.setPen(Qt::red);
- if(!m_bReplot) {
- m_j=0;
- int irow=-1;
- plotsave_(swide,&m_w,&m_h1,&irow);
- }
- ymin = 0;
- for(int i=0; i<iz; i++) {
- y=swide[i];
- int y1 = 10.0*gain*y + m_plotZero;
- if (y1<0) y1=0;
- if (y1>254) y1=254;
- if (swide[i]<1.e29) painter1.setPen(g_ColorTbl[y1]);
- painter1.drawPoint(i,m_j);
- }
- m_line++;
-
- float y2min=1.e30;
- float y2max=-1.e30;
- for(int i=0; i<iz; i++) {
- y=swide[i] - ymin;
- y2=0;
- if(m_bCurrent) y2 = gain2d*y + m_plot2dZero; //Current
-
- if(bScroll) {
- float sum=0.0;
- int j=j0+m_binsPerPixel*i;
- for(int k=0; k<m_binsPerPixel; k++) {
- sum+=dec_data.savg[j++];
- }
- m_sum[i]=sum;
- }
- if(m_bCumulative) y2=gain2d*(m_sum[i]/m_binsPerPixel + m_plot2dZero);
- if(m_Flatten==0) y2 += 15; //### could do better! ###
-
- if(m_bLinearAvg) { //Linear Avg (yellow)
- float sum=0.0;
- int j=j0+m_binsPerPixel*i;
- for(int k=0; k<m_binsPerPixel; k++) {
- sum+=spectra_.syellow[j++];
- }
- y2=2.0*gain2d*sum/m_binsPerPixel + m_plot2dZero;
- }
-
- if(m_bReference) { //Reference (red)
- float df_ref=12000.0/6912.0;
- int j=FreqfromX(i)/df_ref + 0.5;
- y2=spectra_.ref[j] + m_plot2dZero;
-// if(gain2d>1.5) y2=spectra_.filter[j] + m_plot2dZero;
-
- }
-
- if(i==iz-1 and !m_bQ65_Sync and !m_bTotalPower) {
- painter2D.drawPolyline(LineBuf,j);
- }
- LineBuf[j].setX(i);
- LineBuf[j].setY(int(0.9*m_h2-y2*m_h2/70.0));
- if(y2<y2min) y2min=y2;
- if(y2>y2max) y2max=y2;
- j++;
- }
- if(m_bReplot and m_mode!="Q65") return;
-
- if(swide[0]>1.0e29) m_line=0;
- if(m_mode=="FT4" and m_line==34) m_line=0;
- if(m_line == painter1.fontMetrics ().height () && m_timestamp!=0) {
- painter1.setPen(Qt::white);
- QString t;
- if(m_nUTC<0) {
- auto start = qt_truncate_date_time_to (QDateTime::currentDateTimeUtc(), m_TRperiod * 1e3)
- .toString (m_TRperiod < 60. ? "hh:mm:ss" : "hh:mm");
- t = QString {"%1 %2"}.arg (start, m_rxBand);
- } else {
- auto hr = m_nUTC / 10000;
- auto start = QTime {hr, (m_nUTC - 10000 * hr) / 100, m_nUTC % 100}
- .toString (m_TRperiod < 60. ? "hh:mm:ss" : "hh:mm");
- t = QString {"%1 %2"}.arg (start).arg (m_rxBand);
- }
- QRect rect{5, -2, m_w-10, painter1.fontMetrics().ascent()};
- QRect boundingRect;
- painter1.drawText(rect, m_timestamp==2?0x0082:0x0081,t, &boundingRect);
- }
-
- if(m_mode=="JT4" or (m_mode=="Q65" and m_nSubMode>=3)) {
- DrawOverlay();
- QPen pen3(Qt::yellow); //Mark freqs of JT4/Q65 single-tone msgs
- painter2D.setPen(pen3);
- Font.setWeight(QFont::Bold);
- painter2D.setFont(Font);
- int x1=XfromFreq(m_rxFreq);
- y=0.25*m_h2;
- painter2D.drawText(x1-4,y,"T");
- x1=XfromFreq(m_rxFreq+250);
- painter2D.drawText(x1-4,y,"M");
- x1=XfromFreq(m_rxFreq+500);
- painter2D.drawText(x1-4,y,"R");
- x1=XfromFreq(m_rxFreq+750);
- painter2D.drawText(x1-4,y,"73");
- }
-
- if(bRed and m_bQ65_Sync) { //Plot the Q65 orange (current) and red (average) sync curves
- int k=0;
- int k2=0;
- std::ifstream f;
- f.open(m_redFile.toLatin1());
- if(f) {
- int x,y;
- float freq,xdt,smin,smax,sync_avg,sync_current;
- f >> xdt >> smin >> smax;
- if(f) {
- for(int i=0; i<99999; i++) {
- f >> freq >> sync_avg >> sync_current;
- if(!f or f.eof() or k>=MAX_SCREENSIZE or k2>=MAX_SCREENSIZE) break;
- x=XfromFreq(freq);
- // Plot the red curve only if we have averaged 2 or more Rx sequences.
- if(sync_avg > -99.0 and (smin!=0.0 or smax != 0.0)) {
- y=m_h2*(0.9 - 0.09*gain2d*gain2d*sync_avg) - m_plot2dZero - 10;
- LineBuf2[k2].setX(x); //Red sync curve
- LineBuf2[k2].setY(y);
- k2++;
- }
- y=m_h2*(0.9 - 0.09*gain2d*gain2d*sync_current) - m_plot2dZero;
- LineBuf3[k].setX(x); //Orange sync curve
- LineBuf3[k].setY(y);
- k++;
- }
- }
- f.close();
- QPen pen0(Qt::red,2);
- painter2D.setPen(pen0);
- if(smin!=0.0 or smax != 0.0) {
- painter2D.drawPolyline(LineBuf2,k2);
- }
- pen0.setColor("orange");
- painter2D.setPen(pen0);
- painter2D.drawPolyline(LineBuf3,k);
- QString t;
- t = t.asprintf("DT = %6.2f",xdt);
- painter2D.setPen(Qt::white);
- Font.setWeight(QFont::Bold);
- painter2D.setFont(Font);
- painter2D.drawText(m_w-100,m_h2/2,t);
- }
- }
-
- if(m_bTotalPower and m_pdB>1.0) {
- painter2D.setPen(Qt::green);
- if(m_x==m_w-1) {
- for (int i=0; i<m_w-1; i++) {
- LineBuf4[i].setY(LineBuf4[i+1].y());
- }
- }
- int yy=m_h2 - 0.1*m_vpixperdiv*(m_pdB-20.0);
- LineBuf4[m_x].setX(m_x);
- LineBuf4[m_x].setY(yy);
- if(LineBuf4[m_w-1].y()==0) LineBuf4[m_w-1].setY(yy);
- painter2D.drawPolyline(LineBuf4,m_x);
- if(m_x < m_w-1) m_x++;
- }
-
- update(); //trigger a new paintEvent
- m_bScaleOK=true;
-}
-
-void CPlotter::drawRed(int ia, int ib, float swide[])
-{
- m_ia=ia;
- m_ib=ib;
- draw(swide,false,true);
-}
-
-void CPlotter::replot()
-{
- resizeEvent(NULL);
- float swide[m_w];
- m_bReplot=true;
- for(int irow=0; irow<m_h1; irow++) {
- m_j=irow;
- plotsave_(swide,&m_w,&m_h1,&irow);
- draw(swide,false,false);
- }
- if(m_mode=="Q65" and m_bQ65_Sync) {
- draw(swide,false,true);
- }
- update(); //trigger a new paintEvent
- m_bReplot=false;
-}
-
-void CPlotter::DrawOverlay() //DrawOverlay()
-{
- if(m_OverlayPixmap.isNull()) return;
- if(m_WaterfallPixmap.isNull()) return;
- int w = m_WaterfallPixmap.width();
- int x,y,x1,x2,x3,x4,x5,x6;
- float pixperdiv;
-
- double df = m_binsPerPixel*m_fftBinWidth;
- QPen penOrange(QColor(255,165,0),3);
- QPen penGreen(QColor(15,153,105), 3); //Mark Tol range or BW with dark green line
- if(m_useDarkStyle) penGreen.setBrush(Qt::green); // lighter green for dark style
- QPen penRed(Qt::red, 3); //Mark Tx freq with red
- QPainter painter(&m_OverlayPixmap);
- painter.setBackground (palette ().brush (backgroundRole ()));
- QLinearGradient gradient(0, 0, 0 ,m_h2); //fill background with gradient
- gradient.setColorAt(1, Qt::black);
- gradient.setColorAt(0, Qt::darkBlue);
- painter.setBrush(gradient);
- painter.drawRect(0, 0, m_w, m_h2);
- painter.setBrush(Qt::SolidPattern);
-
- m_fSpan = w*df;
-// int n=m_fSpan/10;
- m_freqPerDiv=10;
- if(m_fSpan>100) m_freqPerDiv=20;
- if(m_fSpan>250) m_freqPerDiv=50;
- if(m_fSpan>500) m_freqPerDiv=100;
- if(m_fSpan>1000) m_freqPerDiv=200;
- if(m_fSpan>2500) m_freqPerDiv=500;
-
- if(!m_bTotalPower) {
- pixperdiv = m_freqPerDiv/df;
- m_hdivs = w*df/m_freqPerDiv + 1.9999;
- float xx0=float(m_startFreq)/float(m_freqPerDiv);
- xx0=xx0-int(xx0);
- int x0=xx0*pixperdiv+0.5;
- for( int i=1; i<m_hdivs; i++) { //draw vertical grids
- x = (int)((float)i*pixperdiv ) - x0;
- if(x >= 0 and x<=m_w) {
- painter.setPen(QPen(Qt::white, 1,Qt::DotLine));
- painter.drawLine(x, 0, x , m_h2);
- }
- }
- }
-
- painter.setPen(QPen(Qt::white, 1,Qt::DotLine));
- if(m_bTotalPower) painter.setPen(QPen(Qt::white, 1,Qt::DashLine));
- for( int i=1; i<VERT_DIVS; i++) { //draw horizontal grids
- y = int(i*m_vpixperdiv);
- if(m_bTotalPower) {
- painter.drawLine(15, y, w, y);
- } else {
- painter.drawLine(0, y, w, y);
- }
- }
-
- if(m_bTotalPower) {
- painter.setPen(QPen(Qt::white));
- for( int i=1; i<VERT_DIVS; i++) { //draw horizontal grids
- y = int(i*m_vpixperdiv);
- painter.drawText(0,y+5,QString::number(10*(VERT_DIVS-i) + 20));
- }
- }
-
- if(m_bTotalPower and m_h2>100) {
- painter.setPen(QPen(Qt::white, 1,Qt::DotLine));
- for( int i=1; i<5*VERT_DIVS; i++) { //draw horizontal 2 dB grids
- if(i%5 > 0) {
- y = int(0.2*i*m_vpixperdiv);
- painter.drawLine(0, y, w, y);
- }
- }
- }
-
- QRect rect0;
- QPainter painter0(&m_ScalePixmap);
- painter0.setBackground (palette ().brush (backgroundRole ()));
-
- //create Font to use for scales
- QFont Font("Arial");
- Font.setPointSize(12);
- Font.setWeight(QFont::Normal);
- painter0.setFont(Font);
- if (m_useDarkStyle) {
- painter0.setPen(Qt::white);
- } else {
- painter0.setPen(Qt::black);
- }
-
- if(m_binsPerPixel < 1) m_binsPerPixel=1;
- m_hdivs = w*df/m_freqPerDiv + 0.9999;
-
- if (m_useDarkStyle) {
- m_ScalePixmap.fill(Qt::black);
- } else {
- m_ScalePixmap.fill(Qt::white);
- }
- painter0.drawRect(0, 0, w, 30);
- MakeFrequencyStrs();
-
-//draw tick marks on upper scale
- pixperdiv = m_freqPerDiv/df;
- for( int i=0; i<m_hdivs; i++) { //major ticks
- x = (int)((m_xOffset+i)*pixperdiv );
- painter0.drawLine(x,18,x,30);
- }
- int minor=5;
- if(m_freqPerDiv==200) minor=4;
- for( int i=1; i<minor*m_hdivs; i++) { //minor ticks
- x = i*pixperdiv/minor;
- painter0.drawLine(x,24,x,30);
- }
-
- //draw frequency values
- for( int i=0; i<=m_hdivs; i++) {
- x = (int)((m_xOffset+i)*pixperdiv - pixperdiv/2);
- if(int(x+pixperdiv/2) > 70) {
- rect0.setRect(x,0, (int)pixperdiv, 20);
- painter0.drawText(rect0, Qt::AlignHCenter|Qt::AlignVCenter,m_HDivText[i]);
- }
- }
-
- float bw=9.0*12000.0/m_nsps; //JT9
- if(m_mode=="FT4") bw=3*12000.0/576.0; //FT4 ### (3x, or 4x???) ###
- if(m_mode=="FT8") bw=7*12000.0/1920.0; //FT8
- if(m_mode.startsWith("FST4")) {
- int h=int(pow(2.0,m_nSubMode));
- int nsps=800;
- if(m_TRperiod==30) nsps=1680;
- if(m_TRperiod==60) nsps=4000;
- if(m_TRperiod==120) nsps=8400;
- if(m_TRperiod==300) nsps=21504;
- if(m_TRperiod==900) nsps=66560;
- if(m_TRperiod==1800) nsps=134400;
- float baud=12000.0/nsps;
- bw=3.0*h*baud;
- }
- if(m_mode=="JT4") { //JT4
- bw=3*11025.0/2520.0; //Max tone spacing (3/4 of actual BW)
- if(m_nSubMode==1) bw=2*bw;
- if(m_nSubMode==2) bw=4*bw;
- if(m_nSubMode==3) bw=9*bw;
- if(m_nSubMode==4) bw=18*bw;
- if(m_nSubMode==5) bw=36*bw;
- if(m_nSubMode==6) bw=72*bw;
-
- painter0.setPen(penGreen);
- x1=XfromFreq(m_rxFreq-m_tol);
- x2=XfromFreq(m_rxFreq+m_tol);
- painter0.drawLine(x1,29,x2,29);
- for(int i=0; i<4; i++) {
- x1=XfromFreq(m_rxFreq+bw*i/3.0);
- int j=24;
- if(i==0) j=18;
- painter0.drawLine(x1,j,x1,30);
- }
- painter0.setPen(penRed);
- for(int i=0; i<4; i++) {
- x1=XfromFreq(m_txFreq+bw*i/3.0);
- painter0.drawLine(x1,12,x1,18);
- }
- }
-
- if(m_mode=="JT9" and m_nSubMode>0) { //JT9
- bw=8.0*12000.0/m_nsps;
- if(m_nSubMode==1) bw=2*bw; //B
- if(m_nSubMode==2) bw=4*bw; //C
- if(m_nSubMode==3) bw=8*bw; //D
- if(m_nSubMode==4) bw=16*bw; //E
- if(m_nSubMode==5) bw=32*bw; //F
- if(m_nSubMode==6) bw=64*bw; //G
- if(m_nSubMode==7) bw=128*bw; //H
- }
-
- if(m_mode=="Q65") { //Q65
- int h=int(pow(2.0,m_nSubMode));
- int nsps=1800;
- if(m_TRperiod==30) nsps=3600;
- if(m_TRperiod==60) nsps=7200;
- if(m_TRperiod==120) nsps=16000;
- if(m_TRperiod==300) nsps=41472;
- float baud=12000.0/nsps;
- bw=65.0*h*baud;
- }
- if(m_mode=="JT65") { //JT65
- bw=65.0*11025.0/4096.0;
- if(m_nSubMode==1) bw=2*bw; //B
- if(m_nSubMode==2) bw=4*bw; //C
- }
-
- painter0.setPen(penGreen);
- if(m_mode=="WSPR") {
- x1=XfromFreq(1400);
- x2=XfromFreq(1600);
- painter0.drawLine(x1,26,x2,26);
- }
-
- if(m_mode=="FST4W") {
- x1=XfromFreq(m_rxFreq-m_tol);
- x2=XfromFreq(m_rxFreq+m_tol);
- painter0.drawLine(x1,26,x2,26);
- }
-
- if(m_mode=="FreqCal") { //FreqCal
- x1=XfromFreq(m_rxFreq-m_tol);
- x2=XfromFreq(m_rxFreq+m_tol);
- painter0.drawLine(x1,29,x2,29);
- x1=XfromFreq(m_rxFreq);
- painter0.drawLine(x1,24,x1,30);
- }
-
- int yh=5;
- int yTxTop=12;
- int yRxBottom=yTxTop + 2*yh + 4;
- if(m_mode=="JT9" or m_mode=="JT65" or m_mode=="Q65" or m_mode=="FT8"
- or m_mode=="FT4" or m_mode.startsWith("FST4")) {
-
- if(m_mode=="FST4" and !m_bSingleDecode) {
- x1=XfromFreq(m_nfa);
- x2=XfromFreq(m_nfb);
- painter0.drawLine(x1,25,x1+5,30); // Mark FST4 F_Low
- painter0.drawLine(x1,25,x1+5,20);
- painter0.drawLine(x2,25,x2-5,30); // Mark FST4 F_High
- painter0.drawLine(x2,25,x2-5,20);
- }
-
- if(m_mode=="Q65" or (m_mode=="JT65" and m_bVHF) or (m_mode=="FT8" and m_bSuperHound)) {
- painter0.setPen(penGreen);
- x1=XfromFreq(m_rxFreq-m_tol);
- x2=XfromFreq(m_rxFreq+m_tol);
- painter0.drawLine(x1,26,x2,26);
- x1=XfromFreq(m_rxFreq);
- painter0.drawLine(x1,20,x1,26);
-
- if(m_mode=="JT65") {
- painter0.setPen(penOrange);
- x3=XfromFreq(m_rxFreq+20.0*bw/65.0); //RO
- painter0.drawLine(x3,20,x3,26);
- x4=XfromFreq(m_rxFreq+30.0*bw/65.0); //RRR
- painter0.drawLine(x4,20,x4,26);
- x5=XfromFreq(m_rxFreq+40.0*bw/65.0); //73
- painter0.drawLine(x5,20,x5,26);
- }
- painter0.setPen(penGreen);
- x6=XfromFreq(m_rxFreq+bw); //Highest tone
- if(m_mode=="FT8" and m_bSuperHound) x6=XfromFreq(m_rxFreq+1500.0);
- painter0.drawLine(x6,20,x6,26);
-
- } else {
- // Draw the green goal post
- painter0.setPen(penGreen);
- x1=XfromFreq(m_rxFreq);
- x2=XfromFreq(m_rxFreq+bw);
- painter0.drawLine(x1,yRxBottom-yh,x1,yRxBottom);
- painter0.drawLine(x1,yRxBottom,x2,yRxBottom);
- painter0.drawLine(x2,yRxBottom-yh,x2,yRxBottom);
- if(m_mode.startsWith("FST4")) {
- x1=XfromFreq(m_rxFreq-m_tol);
- x2=XfromFreq(m_rxFreq+m_tol);
- painter0.drawLine(x1,26,x2,26); // Mark the Tol range
- }
- }
- }
-
- QPainter overPainter(&m_DialOverlayPixmap);
- if (m_bars) {
- if (!overPainter.isActive()) overPainter.begin(this);
- overPainter.setCompositionMode(QPainter::CompositionMode_Source);
- overPainter.fillRect(0, 0, m_Size.width(), m_h, Qt::transparent);
- }
-
- if(m_mode.startsWith("FT") or m_mode.startsWith("JT") or m_mode=="Q65" or m_mode.startsWith("FST4")) {
- x1=XfromFreq(m_rxFreq);
- if(m_mode=="FT8" and m_bSuperHound) {
- x2=XfromFreq(m_rxFreq+1500);
- } else {
- x2=XfromFreq(m_rxFreq+bw);
- }
- if (m_bars) {
- overPainter.setPen(Qt::green); // Rx bars
- overPainter.drawLine(x1,0,x1,m_h); overPainter.drawLine(x2,0,x2,m_h);
- }
- }
-
- // red bars
- if(m_mode.startsWith("FT") or m_mode.startsWith("JT") or m_mode=="Q65" or m_mode.startsWith("FST4")
- or m_mode.mid(0,4)=="WSPR") {
- x1=XfromFreq(m_txFreq); x2=XfromFreq(m_txFreq+bw);
- if(m_mode=="FT8" and m_bSuperFox) x2=XfromFreq(m_txFreq+1500.0);
- if(m_mode=="WSPR") {
- bw=4*12000.0/8192.0; //WSPR
- x1=XfromFreq(m_txFreq-0.5*bw); x2=XfromFreq(m_txFreq+0.5*bw);
- }
- if (m_bars) {
- overPainter.setPen(Qt::red); // Tx bars
- overPainter.drawLine(x1,0,x1,m_h); overPainter.drawLine(x2,0,x2,m_h);
- }
- }
-
- // red goal post
- if(m_mode=="JT9" or m_mode=="JT65" or m_mode.mid(0,4)=="WSPR" or m_mode=="Q65"
- or m_mode=="FT8" or m_mode=="FT4" or m_mode.startsWith("FST4")) {
- painter0.setPen(penRed);
- x1=XfromFreq(m_txFreq);
- if(m_mode=="FT8" and m_bSuperFox) {
- x2=XfromFreq(m_txFreq+1500.0);
- } else {
- x2=XfromFreq(m_txFreq+bw);
- }
- if(m_mode=="WSPR") {
- bw=4*12000.0/8192.0; //WSPR
- x1=XfromFreq(m_txFreq-0.5*bw);
- x2=XfromFreq(m_txFreq+0.5*bw);
- }
- // Draw the red goal post
- painter0.drawLine(x1,yTxTop,x1,yTxTop+yh);
- painter0.drawLine(x1,yTxTop,x2,yTxTop);
- painter0.drawLine(x2,yTxTop,x2,yTxTop+yh);
- }
-
- QPainter hoverPainter(&m_HoverOverlayPixmap);
- if (m_bars) {
- if (!hoverPainter.isActive()) hoverPainter.begin(this);
-// if(m_mode=="FT8" and m_bSuperHound) bw=1500; // not useful for the white bars
- int fwidth=XfromFreq(m_rxFreq+bw)-XfromFreq(m_rxFreq);;
- hoverPainter.setCompositionMode(QPainter::CompositionMode_Source);
- hoverPainter.fillRect(0, 0, m_Size.width(), m_h, Qt::transparent);
- hoverPainter.setPen(QPen(Qt::white)); // white bars
- hoverPainter.drawLine(0, 30, 0, m_h); // first slot, left line hover
- hoverPainter.drawLine(fwidth, 30, fwidth, m_h); // first slot, right line hover
- }
-
- if(m_dialFreq>10.13 and m_dialFreq< 10.15 and m_mode.mid(0,4)!="WSPR" and m_mode!="FST4W") {
- float f1=1.0e6*(10.1401 - m_dialFreq);
- float f2=f1+200.0;
- x1=XfromFreq(f1);
- x2=XfromFreq(f2);
- if(x1<=m_w and x2>=0) {
- painter0.setPen(penOrange); //Mark WSPR sub-band orange
- painter0.drawLine(x1,9,x2,9);
- }
- }
-}
-
-void CPlotter::MakeFrequencyStrs() //MakeFrequencyStrs
-{
- int f=(m_startFreq+m_freqPerDiv-1)/m_freqPerDiv;
- f*=m_freqPerDiv;
- m_xOffset=float(f-m_startFreq)/m_freqPerDiv;
- for(int i=0; i<=m_hdivs; i++) {
- m_HDivText[i].setNum(f);
- f+=m_freqPerDiv;
- }
-}
-
-int CPlotter::XfromFreq(float f) //XfromFreq()
-{
- int x = int(m_w * (f - m_startFreq)/m_fSpan + 0.5);
- if(x<0 ) return 0;
- if(x>m_w) return m_w;
- return x;
-}
-
-float CPlotter::FreqfromX(int x) //FreqfromX()
-{
- return float(m_startFreq + x*m_binsPerPixel*m_fftBinWidth);
-}
-
-void CPlotter::SetRunningState(bool running) //SetRunningState()
-{
- m_Running = running;
-}
-
-void CPlotter::setPlotZero(int plotZero) //setPlotZero()
-{
- m_plotZero=plotZero;
-}
-
-int CPlotter::plotZero() //PlotZero()
-{
- return m_plotZero;
-}
-
-void CPlotter::setPlotGain(int plotGain) //setPlotGain()
-{
- m_plotGain=plotGain;
-}
-
-int CPlotter::plotGain() //plotGain()
-{
- return m_plotGain;
-}
-
-int CPlotter::plot2dGain() //plot2dGain
-{
- return m_plot2dGain;
-}
-
-void CPlotter::setPlot2dGain(int n) //setPlot2dGain
-{
- m_plot2dGain=n;
- update();
-}
-
-int CPlotter::plot2dZero() //plot2dZero
-{
- return m_plot2dZero;
-}
-
-void CPlotter::setPlot2dZero(int plot2dZero) //setPlot2dZero
-{
- m_plot2dZero=plot2dZero;
-}
-
-void CPlotter::setStartFreq(int f) //SetStartFreq()
-{
- m_startFreq=f;
- m_fMax=FreqfromX(XfromFreq(5000.0));
- resizeEvent(NULL);
- DrawOverlay();
- update();
-}
-
-int CPlotter::startFreq() //startFreq()
-{
- return m_startFreq;
-}
-
-int CPlotter::plotWidth(){return m_WaterfallPixmap.width();} //plotWidth
-void CPlotter::UpdateOverlay() {DrawOverlay();} //UpdateOverlay
-void CPlotter::setDataFromDisk(bool b) {m_dataFromDisk=b;} //setDataFromDisk
-
-void CPlotter::setRxRange(int fMin) //setRxRange
-{
- m_fMin=fMin;
-}
-
-void CPlotter::setBinsPerPixel(int n) //setBinsPerPixel
-{
- m_binsPerPixel = n;
- m_fMax=FreqfromX(XfromFreq(5000.0));
- DrawOverlay(); //Redraw scales and ticks
- update(); //trigger a new paintEvent}
-}
-
-int CPlotter::binsPerPixel() //binsPerPixel
-{
- return m_binsPerPixel;
-}
-
-void CPlotter::setWaterfallAvg(int n) //setNavg
-{
- m_waterfallAvg = n;
-}
-
-void CPlotter::setRxFreq (int x) //setRxFreq
-{
- m_rxFreq = x; // x is freq in Hz
- DrawOverlay();
- update();
-}
-
-int CPlotter::rxFreq() {return m_rxFreq;} //rxFreq
-
-void CPlotter::leaveEvent(QEvent *event)
-{
- m_lastMouseX = -1;
- m_lastPaintedX = -1;
- event->ignore();
-}
-
-void CPlotter::mouseMoveEvent (QMouseEvent * event)
-{
- int x=event->x();
- if(x < 0) x = 0;
- if(x>m_Size.width()) x = m_Size.width();
- if(m_freq) m_pos = event->globalPos();
- m_lastMouseX = x;
- update();
-
- event->ignore();
- if(m_freq) {
- if (!m_bTotalPower){
- QToolTip::showText(event->globalPos(),QString::number(int(FreqfromX(x))));
- } else {
- int y=event->y();
- float pdB=10.0*(m_h-y)/m_vpixperdiv + 20.0;
- if(y<(m_h-m_h2)) {
- QToolTip::showText(event->globalPos(),QString::number(int(FreqfromX(x))));
- } else {
- QString t;
- t=t.asprintf("%4.1f dB",pdB);
- QToolTip::showText(event->globalPos(),t);
- }
- }
- }
- QWidget::mouseMoveEvent(event);
-}
-
-void CPlotter::mouseReleaseEvent (QMouseEvent * event)
-{
- bool rightbutton = (event->button() & Qt::RightButton);
- bool leftbutton = (event->button() & Qt::LeftButton);
- bool shift = (event->modifiers() & Qt::ShiftModifier);
- if (rightbutton) {
- leftbutton = true;
- shift = true;
- }
- if (leftbutton) {
- int x=event->x();
- if(x<0) x=0;
- if(x>m_Size.width()) x=m_Size.width();
- bool ctrl = (event->modifiers() & Qt::ControlModifier);
- if(!shift and m_mode=="FST4W") return;
- int newFreq = int(FreqfromX(x)+0.5);
- int oldTxFreq = m_txFreq;
- int oldRxFreq = m_rxFreq;
- if (ctrl and m_mode!="FST4W") {
- emit setFreq1 (newFreq, newFreq);
- } else if (shift) {
- emit setFreq1 (oldRxFreq, newFreq);
- } else {
- emit setFreq1(newFreq,oldTxFreq);
- }
-
- int n=1;
- if(ctrl) n+=100;
- emit freezeDecode1(n);
- }
- else {
- event->ignore (); // let parent handle
- }
-// replot(); // ### Not needed? ###
-}
-
-void CPlotter::mouseDoubleClickEvent (QMouseEvent * event)
-{
- bool rightbutton = (event->button() & Qt::RightButton);
- bool leftbutton = (event->button() & Qt::LeftButton);
- bool ctrl = (event->modifiers() & Qt::ControlModifier);
- if (leftbutton) {
- int n=2;
- if(ctrl) n+=100;
- emit freezeDecode1(n);
- } else if (rightbutton) {
- int x=event->x();
- if(x<0) x=0;
- if(x>m_Size.width()) x=m_Size.width();
- int newFreq = int(FreqfromX(x)+0.5);
- if (m_mode!="FST4W") emit setFreq1 (newFreq, newFreq);
- int n=1;
- if(ctrl) n+=100;
- emit freezeDecode1(n);
- } else {
- event->ignore (); // let parent handle
- }
-}
-
-void CPlotter::setNsps(double trperiod, int nsps) //setNsps
-{
- m_TRperiod=trperiod;
- m_nsps=nsps;
- m_fftBinWidth=1500.0/2048.0;
- if(m_nsps==15360) m_fftBinWidth=1500.0/2048.0;
- if(m_nsps==40960) m_fftBinWidth=1500.0/6144.0;
- if(m_nsps==82944) m_fftBinWidth=1500.0/12288.0;
- if(m_nsps==252000) m_fftBinWidth=1500.0/32768.0;
- DrawOverlay(); //Redraw scales and ticks
- update(); //trigger a new paintEvent}
-}
-
-void CPlotter::setTxFreq(int n) //setTxFreq
-{
- m_txFreq=n;
- DrawOverlay();
- update();
-}
-
-void CPlotter::setMode(QString mode) //setMode
-{
- m_mode=mode;
-}
-
-void CPlotter::setSubMode(int n) //setSubMode
-{
- m_nSubMode=n;
-}
-
-int CPlotter::Fmax()
-{
- return m_fMax;
-}
-
-void CPlotter::setDialFreq(double d)
-{
- m_dialFreq=d;
- DrawOverlay();
- update();
-}
-
-void CPlotter::setRxBand(QString band)
-{
- m_rxBand=band;
-}
-
-void CPlotter::setFlatten(bool b1, bool b2)
-{
- m_Flatten=0;
- if(b1) m_Flatten=1;
- if(b2) m_Flatten=2;
-}
-
-void CPlotter::setSuperFox(bool b)
-{
- m_bSuperFox=b;
- if(m_bSuperFox) m_bSuperHound=false;
-}
-void CPlotter::setSuperHound(bool b)
-{
- m_bSuperHound=b;
- if(m_bSuperHound) m_bSuperFox=false;
-}
-
-void CPlotter::setTol(int n) //setTol()
-{
- m_tol=n;
- DrawOverlay();
-}
-
-void CPlotter::setFST4_FreqRange(int fLow,int fHigh)
-{
- m_nfa=fLow;
- m_nfb=fHigh;
- DrawOverlay();
- update();
-}
-
-void CPlotter::setSingleDecode(bool b)
-{
- m_bSingleDecode=b;
-}
-
-
-void CPlotter::setColours(QVector<QColor> const& cl)
-{
- g_ColorTbl = cl;
-}
-
-void CPlotter::SetPercent2DScreen(int percent)
-{
- m_Percent2DScreen=percent;
- resizeEvent(NULL);
- update();
-}
-void CPlotter::setVHF(bool bVHF)
-{
- m_bVHF=bVHF;
-}
-
-void CPlotter::setRedFile(QString fRed)
-{
- m_redFile=fRed;
-}
-
-void CPlotter::setDiskUTC(int nutc)
-{
- m_nUTC=nutc;
-}
-
-void CPlotter::drawTotalPower(float pdB)
-{
- m_pdB=pdB;
-}
-
-void CPlotter::restartTotalPower()
-{
- m_x=0;
-}
-
-void CPlotter::setTimestamp(int n)
-{
- m_timestamp=n;
-}
-
-void CPlotter::setBars(bool b)
-{
- setMouseTracking(b || m_freq);
- m_bars=b;
- DrawOverlay();
- update();
-}
-
-void CPlotter::showFreq(bool b)
-{
- setMouseTracking(b || m_bars);
- m_freq=b;
-}
-
-void CPlotter::setDarkStyle (bool b) //set wide filter lines for Hound mode
-{
- m_useDarkStyle=b;
- DrawOverlay();
- update();
-}
+#include "plotter.h" +#include <math.h> +#include <QAction> +#include <QMenu> +#include <QPainter> +#include <QDateTime> +#include <QPen> +#include <QMouseEvent> +#include <QDebug> +#include "qt_helpers.hpp" +#include "commons.h" +#include "moc_plotter.cpp" +#include <fstream> +#include <iostream> + +#define MAX_SCREENSIZE 8192 + +extern "C" { + void flat4_(float swide[], int* iz, int* nflatten); + void plotsave_(float swide[], int* m_w , int* m_h1, int* irow); +} + +extern dec_data dec_data; + +CPlotter::CPlotter(QWidget *parent) : //CPlotter Constructor + QFrame {parent}, +// m_set_freq_action {new QAction {tr ("&Set Rx && Tx Offset"), this}}, + m_bScaleOK {false}, + m_bReference {false}, + m_bReference0 {false}, + m_fSpan {2000.0}, + m_plotZero {0}, + m_plotGain {0}, + m_plot2dGain {0}, + m_plot2dZero {0}, + m_nSubMode {0}, + m_Running {false}, + m_paintEventBusy {false}, + m_fftBinWidth {1500.0/2048.0}, + m_dialFreq {0.}, + m_sum {}, + m_dBStepSize {10}, + m_FreqUnits {1}, + m_hdivs {HORZ_DIVS}, + m_line {0}, + m_fSample {12000}, + m_nsps {6912}, + m_Percent2DScreen {30}, //percent of screen used for 2D display + m_Percent2DScreen0 {0}, + m_rxFreq {1020}, + m_txFreq {0}, + m_startFreq {0}, + m_lastMouseX {-1}, + m_lastPaintedX {-1} +// m_tol {100} +{ + setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + setFocusPolicy(Qt::StrongFocus); + setAttribute(Qt::WA_PaintOnScreen,false); + setAutoFillBackground(false); + setAttribute(Qt::WA_OpaquePaintEvent, false); + setAttribute(Qt::WA_NoSystemBackground, true); + setMouseTracking(true); + m_bReplot=false; + + // contextual pop up menu +// setContextMenuPolicy (Qt::CustomContextMenu); +// connect (this, &QWidget::customContextMenuRequested, [this] (QPoint const& pos) { +// QMenu menu {this}; +// menu.addAction (m_set_freq_action); +// auto const& connection = connect (m_set_freq_action, &QAction::triggered, [this, pos] () { +// int newFreq = FreqfromX (pos.x ()) + .5; +// emit setFreq1 (newFreq, newFreq); +// }); +// menu.exec (mapToGlobal (pos)); +// disconnect (connection); +// }); +} + +CPlotter::~CPlotter() { } // Destructor + +QSize CPlotter::minimumSizeHint() const +{ + return QSize(50, 50); +} + +QSize CPlotter::sizeHint() const +{ + return QSize(180, 180); +} + +void CPlotter::resizeEvent(QResizeEvent* ) //resizeEvent() +{ + if(!size().isValid()) return; + if( m_Size != size() or (m_bReference != m_bReference0) or + m_Percent2DScreen != m_Percent2DScreen0) { + m_Size = size(); + m_w = m_Size.width(); + m_h = m_Size.height(); + m_h2 = m_Percent2DScreen*m_h/100.0; + if(m_h2>m_h-30) m_h2=m_h-30; + if(m_bReference) m_h2=m_h-30; + if(m_h2<1) m_h2=1; + m_h1=m_h-m_h2; +// m_line=0; + m_DialOverlayPixmap = QPixmap(m_Size.width(), m_h); + m_DialOverlayPixmap.fill(Qt::transparent); + m_HoverOverlayPixmap = QPixmap(m_Size.width(), m_h); + m_HoverOverlayPixmap.fill(Qt::transparent); + m_2DPixmap = QPixmap(m_Size.width(), m_h2); + m_2DPixmap.fill(Qt::black); + m_WaterfallPixmap = QPixmap(m_Size.width(), m_h1); + m_OverlayPixmap = QPixmap(m_Size.width(), m_h2); + m_OverlayPixmap.fill(Qt::black); + m_WaterfallPixmap.fill(Qt::black); + m_2DPixmap.fill(Qt::black); + m_ScalePixmap = QPixmap(m_w,30); + m_ScalePixmap.fill(Qt::white); + m_Percent2DScreen0 = m_Percent2DScreen; + m_bResized = true; + m_vpixperdiv = float(m_h2)/float(VERT_DIVS); + m_x=0; + } + DrawOverlay(); +} + +void CPlotter::paintEvent(QPaintEvent *) // paintEvent() +{ + if(m_paintEventBusy) return; + m_paintEventBusy=true; + QPainter painter(this); + painter.drawPixmap(0,0,m_ScalePixmap); + painter.drawPixmap(0,30,m_WaterfallPixmap); + painter.drawPixmap(0,m_h1,m_2DPixmap); + int x = XfromFreq(m_rxFreq); + if (m_bars) { + painter.drawPixmap(0,30,m_DialOverlayPixmap); + if(m_lastMouseX >= 0 && m_lastMouseX != x){ + painter.drawPixmap(m_lastMouseX, 0, m_HoverOverlayPixmap); + } + } + m_lastPaintedX = m_lastMouseX; + m_paintEventBusy=false; +} + +void CPlotter::draw(float swide[], bool bScroll, bool bRed) +{ + if (!m_TRperiod) return; // not ready to plot yet + int j,j0; + float y,y2,ymin; + double fac = sqrt(m_binsPerPixel*m_waterfallAvg/15.0); + double gain = fac*pow(10.0,0.015*m_plotGain); + double gain2d = pow(10.0,0.02*(m_plot2dGain)); + + if(m_bReference != m_bReference0) resizeEvent(NULL); + m_bReference0=m_bReference; + +//move current data down one line (must do this before attaching a QPainter object) + if(bScroll and !m_bReplot) m_WaterfallPixmap.scroll(0,1,0,0,m_w,m_h1); + QPainter painter1(&m_WaterfallPixmap); + if(m_bFirst or bRed or !m_bQ65_Sync or m_mode!=m_mode0 + or m_bResized or m_rxFreq!=m_rxFreq0) { + m_2DPixmap = m_OverlayPixmap.copy(0,0,m_w,m_h2); + m_bFirst=false; + m_bResized=false; + m_rxFreq0=m_rxFreq; + } + m_mode0=m_mode; + QPainter painter2D(&m_2DPixmap); + if(!painter2D.isActive()) return; + QFont Font("Arial"); + Font.setPointSize(12); + Font.setWeight(QFont::Normal); + painter2D.setFont(Font); + + if(m_bLinearAvg) { + painter2D.setPen(Qt::yellow); + } else if(m_bReference) { + painter2D.setPen(Qt::blue); + } else { + painter2D.setPen(Qt::green); + } + static QPoint LineBuf[MAX_SCREENSIZE]; + static QPoint LineBuf2[MAX_SCREENSIZE]; + static QPoint LineBuf3[MAX_SCREENSIZE]; + static QPoint LineBuf4[MAX_SCREENSIZE]; + j=0; + j0=int(m_startFreq/m_fftBinWidth + 0.5); + int iz=XfromFreq(5000.0); + int jz=iz*m_binsPerPixel; + m_fMax=FreqfromX(iz); + if(bScroll and swide[0]<1.e29) { + flat4_(swide,&iz,&m_Flatten); + if(!m_bReplot) flat4_(&dec_data.savg[j0],&jz,&m_Flatten); + } + + ymin=1.e30; + if(swide[0]>1.e29 and swide[0]< 1.5e30) painter1.setPen(Qt::green); + if(swide[0]>1.4e30) painter1.setPen(Qt::red); + if(!m_bReplot) { + m_j=0; + int irow=-1; + plotsave_(swide,&m_w,&m_h1,&irow); + } + ymin = 0; + for(int i=0; i<iz; i++) { + y=swide[i]; + int y1 = 10.0*gain*y + m_plotZero; + if (y1<0) y1=0; + if (y1>254) y1=254; + if (swide[i]<1.e29) painter1.setPen(g_ColorTbl[y1]); + painter1.drawPoint(i,m_j); + } + m_line++; + + float y2min=1.e30; + float y2max=-1.e30; + for(int i=0; i<iz; i++) { + y=swide[i] - ymin; + y2=0; + if(m_bCurrent) y2 = gain2d*y + m_plot2dZero; //Current + + if(bScroll) { + float sum=0.0; + int j=j0+m_binsPerPixel*i; + for(int k=0; k<m_binsPerPixel; k++) { + sum+=dec_data.savg[j++]; + } + m_sum[i]=sum; + } + if(m_bCumulative) y2=gain2d*(m_sum[i]/m_binsPerPixel + m_plot2dZero); + if(m_Flatten==0) y2 += 15; //### could do better! ### + + if(m_bLinearAvg) { //Linear Avg (yellow) + float sum=0.0; + int j=j0+m_binsPerPixel*i; + for(int k=0; k<m_binsPerPixel; k++) { + sum+=spectra_.syellow[j++]; + } + y2=2.0*gain2d*sum/m_binsPerPixel + m_plot2dZero; + } + + if(m_bReference) { //Reference (red) + float df_ref=12000.0/6912.0; + int j=FreqfromX(i)/df_ref + 0.5; + y2=spectra_.ref[j] + m_plot2dZero; +// if(gain2d>1.5) y2=spectra_.filter[j] + m_plot2dZero; + + } + + if(i==iz-1 and !m_bQ65_Sync and !m_bTotalPower) { + painter2D.drawPolyline(LineBuf,j); + } + LineBuf[j].setX(i); + LineBuf[j].setY(int(0.9*m_h2-y2*m_h2/70.0)); + if(y2<y2min) y2min=y2; + if(y2>y2max) y2max=y2; + j++; + } + if(m_bReplot and m_mode!="Q65") return; + + if(swide[0]>1.0e29) m_line=0; + if(m_mode=="FT4" and m_line==34) m_line=0; + if(m_line == painter1.fontMetrics ().height () && m_timestamp!=0) { + painter1.setPen(Qt::white); + QString t; + if(m_nUTC<0) { + auto start = qt_truncate_date_time_to (QDateTime::currentDateTimeUtc(), m_TRperiod * 1e3) + .toString (m_TRperiod < 60. ? "hh:mm:ss" : "hh:mm"); + t = QString {"%1 %2"}.arg (start, m_rxBand); + } else { + auto hr = m_nUTC / 10000; + auto start = QTime {hr, (m_nUTC - 10000 * hr) / 100, m_nUTC % 100} + .toString (m_TRperiod < 60. ? "hh:mm:ss" : "hh:mm"); + t = QString {"%1 %2"}.arg (start).arg (m_rxBand); + } + QRect rect{5, -2, m_w-10, painter1.fontMetrics().ascent()}; + QRect boundingRect; + painter1.drawText(rect, m_timestamp==2?0x0082:0x0081,t, &boundingRect); + } + + if(m_mode=="JT4" or (m_mode=="Q65" and m_nSubMode>=3)) { + DrawOverlay(); + QPen pen3(Qt::yellow); //Mark freqs of JT4/Q65 single-tone msgs + painter2D.setPen(pen3); + Font.setWeight(QFont::Bold); + painter2D.setFont(Font); + int x1=XfromFreq(m_rxFreq); + y=0.25*m_h2; + painter2D.drawText(x1-4,y,"T"); + x1=XfromFreq(m_rxFreq+250); + painter2D.drawText(x1-4,y,"M"); + x1=XfromFreq(m_rxFreq+500); + painter2D.drawText(x1-4,y,"R"); + x1=XfromFreq(m_rxFreq+750); + painter2D.drawText(x1-4,y,"73"); + } + + if(bRed and m_bQ65_Sync) { //Plot the Q65 orange (current) and red (average) sync curves + int k=0; + int k2=0; + std::ifstream f; + f.open(m_redFile.toLatin1()); + if(f) { + int x,y; + float freq,xdt,smin,smax,sync_avg,sync_current; + f >> xdt >> smin >> smax; + if(f) { + for(int i=0; i<99999; i++) { + f >> freq >> sync_avg >> sync_current; + if(!f or f.eof() or k>=MAX_SCREENSIZE or k2>=MAX_SCREENSIZE) break; + x=XfromFreq(freq); + // Plot the red curve only if we have averaged 2 or more Rx sequences. + if(sync_avg > -99.0 and (smin!=0.0 or smax != 0.0)) { + y=m_h2*(0.9 - 0.09*gain2d*gain2d*sync_avg) - m_plot2dZero - 10; + LineBuf2[k2].setX(x); //Red sync curve + LineBuf2[k2].setY(y); + k2++; + } + y=m_h2*(0.9 - 0.09*gain2d*gain2d*sync_current) - m_plot2dZero; + LineBuf3[k].setX(x); //Orange sync curve + LineBuf3[k].setY(y); + k++; + } + } + f.close(); + QPen pen0(Qt::red,2); + painter2D.setPen(pen0); + if(smin!=0.0 or smax != 0.0) { + painter2D.drawPolyline(LineBuf2,k2); + } + pen0.setColor("orange"); + painter2D.setPen(pen0); + painter2D.drawPolyline(LineBuf3,k); + QString t; + t = t.asprintf("DT = %6.2f",xdt); + painter2D.setPen(Qt::white); + Font.setWeight(QFont::Bold); + painter2D.setFont(Font); + painter2D.drawText(m_w-100,m_h2/2,t); + } + } + + if(m_bTotalPower and m_pdB>1.0) { + painter2D.setPen(Qt::green); + if(m_x==m_w-1) { + for (int i=0; i<m_w-1; i++) { + LineBuf4[i].setY(LineBuf4[i+1].y()); + } + } + int yy=m_h2 - 0.1*m_vpixperdiv*(m_pdB-20.0); + LineBuf4[m_x].setX(m_x); + LineBuf4[m_x].setY(yy); + if(LineBuf4[m_w-1].y()==0) LineBuf4[m_w-1].setY(yy); + painter2D.drawPolyline(LineBuf4,m_x); + if(m_x < m_w-1) m_x++; + } + + update(); //trigger a new paintEvent + m_bScaleOK=true; +} + +void CPlotter::drawRed(int ia, int ib, float swide[]) +{ + m_ia=ia; + m_ib=ib; + draw(swide,false,true); +} + +void CPlotter::replot() +{ + resizeEvent(NULL); + float swide[m_w]; + m_bReplot=true; + for(int irow=0; irow<m_h1; irow++) { + m_j=irow; + plotsave_(swide,&m_w,&m_h1,&irow); + draw(swide,false,false); + } + if(m_mode=="Q65" and m_bQ65_Sync) { + draw(swide,false,true); + } + update(); //trigger a new paintEvent + m_bReplot=false; +} + +void CPlotter::DrawOverlay() //DrawOverlay() +{ + if(m_OverlayPixmap.isNull()) return; + if(m_WaterfallPixmap.isNull()) return; + int w = m_WaterfallPixmap.width(); + int x,y,x1,x2,x3,x4,x5,x6; + float pixperdiv; + + double df = m_binsPerPixel*m_fftBinWidth; + QPen penOrange(QColor(255,165,0),3); + QPen penGreen(QColor(15,153,105), 3); //Mark Tol range or BW with dark green line + if(m_useDarkStyle) penGreen.setBrush(Qt::green); // lighter green for dark style + QPen penRed(Qt::red, 3); //Mark Tx freq with red + QPainter painter(&m_OverlayPixmap); + painter.setBackground (palette ().brush (backgroundRole ())); + QLinearGradient gradient(0, 0, 0 ,m_h2); //fill background with gradient + gradient.setColorAt(1, Qt::black); + gradient.setColorAt(0, Qt::darkBlue); + painter.setBrush(gradient); + painter.drawRect(0, 0, m_w, m_h2); + painter.setBrush(Qt::SolidPattern); + + m_fSpan = w*df; +// int n=m_fSpan/10; + m_freqPerDiv=10; + if(m_fSpan>100) m_freqPerDiv=20; + if(m_fSpan>250) m_freqPerDiv=50; + if(m_fSpan>500) m_freqPerDiv=100; + if(m_fSpan>1000) m_freqPerDiv=200; + if(m_fSpan>2500) m_freqPerDiv=500; + + if(!m_bTotalPower) { + pixperdiv = m_freqPerDiv/df; + m_hdivs = w*df/m_freqPerDiv + 1.9999; + float xx0=float(m_startFreq)/float(m_freqPerDiv); + xx0=xx0-int(xx0); + int x0=xx0*pixperdiv+0.5; + for( int i=1; i<m_hdivs; i++) { //draw vertical grids + x = (int)((float)i*pixperdiv ) - x0; + if(x >= 0 and x<=m_w) { + painter.setPen(QPen(Qt::white, 1,Qt::DotLine)); + painter.drawLine(x, 0, x , m_h2); + } + } + } + + painter.setPen(QPen(Qt::white, 1,Qt::DotLine)); + if(m_bTotalPower) painter.setPen(QPen(Qt::white, 1,Qt::DashLine)); + for( int i=1; i<VERT_DIVS; i++) { //draw horizontal grids + y = int(i*m_vpixperdiv); + if(m_bTotalPower) { + painter.drawLine(15, y, w, y); + } else { + painter.drawLine(0, y, w, y); + } + } + + if(m_bTotalPower) { + painter.setPen(QPen(Qt::white)); + for( int i=1; i<VERT_DIVS; i++) { //draw horizontal grids + y = int(i*m_vpixperdiv); + painter.drawText(0,y+5,QString::number(10*(VERT_DIVS-i) + 20)); + } + } + + if(m_bTotalPower and m_h2>100) { + painter.setPen(QPen(Qt::white, 1,Qt::DotLine)); + for( int i=1; i<5*VERT_DIVS; i++) { //draw horizontal 2 dB grids + if(i%5 > 0) { + y = int(0.2*i*m_vpixperdiv); + painter.drawLine(0, y, w, y); + } + } + } + + QRect rect0; + QPainter painter0(&m_ScalePixmap); + painter0.setBackground (palette ().brush (backgroundRole ())); + + //create Font to use for scales + QFont Font("Arial"); + Font.setPointSize(12); + Font.setWeight(QFont::Normal); + painter0.setFont(Font); + if (m_useDarkStyle) { + painter0.setPen(Qt::white); + } else { + painter0.setPen(Qt::black); + } + + if(m_binsPerPixel < 1) m_binsPerPixel=1; + m_hdivs = w*df/m_freqPerDiv + 0.9999; + + if (m_useDarkStyle) { + m_ScalePixmap.fill(Qt::black); + } else { + m_ScalePixmap.fill(Qt::white); + } + painter0.drawRect(0, 0, w, 30); + MakeFrequencyStrs(); + +//draw tick marks on upper scale + pixperdiv = m_freqPerDiv/df; + for( int i=0; i<m_hdivs; i++) { //major ticks + x = (int)((m_xOffset+i)*pixperdiv ); + painter0.drawLine(x,18,x,30); + } + int minor=5; + if(m_freqPerDiv==200) minor=4; + for( int i=1; i<minor*m_hdivs; i++) { //minor ticks + x = i*pixperdiv/minor; + painter0.drawLine(x,24,x,30); + } + + //draw frequency values + for( int i=0; i<=m_hdivs; i++) { + x = (int)((m_xOffset+i)*pixperdiv - pixperdiv/2); + if(int(x+pixperdiv/2) > 70) { + rect0.setRect(x,0, (int)pixperdiv, 20); + painter0.drawText(rect0, Qt::AlignHCenter|Qt::AlignVCenter,m_HDivText[i]); + } + } + + float bw=9.0*12000.0/m_nsps; //JT9 + if(m_mode=="FT4") bw=3*12000.0/576.0; //FT4 ### (3x, or 4x???) ### + if(m_mode=="FT8") bw=7*12000.0/1920.0; //FT8 + if(m_mode.startsWith("FST4")) { + int h=int(pow(2.0,m_nSubMode)); + int nsps=800; + if(m_TRperiod==30) nsps=1680; + if(m_TRperiod==60) nsps=4000; + if(m_TRperiod==120) nsps=8400; + if(m_TRperiod==300) nsps=21504; + if(m_TRperiod==900) nsps=66560; + if(m_TRperiod==1800) nsps=134400; + float baud=12000.0/nsps; + bw=3.0*h*baud; + } + if(m_mode=="JT4") { //JT4 + bw=3*11025.0/2520.0; //Max tone spacing (3/4 of actual BW) + if(m_nSubMode==1) bw=2*bw; + if(m_nSubMode==2) bw=4*bw; + if(m_nSubMode==3) bw=9*bw; + if(m_nSubMode==4) bw=18*bw; + if(m_nSubMode==5) bw=36*bw; + if(m_nSubMode==6) bw=72*bw; + + painter0.setPen(penGreen); + x1=XfromFreq(m_rxFreq-m_tol); + x2=XfromFreq(m_rxFreq+m_tol); + painter0.drawLine(x1,29,x2,29); + for(int i=0; i<4; i++) { + x1=XfromFreq(m_rxFreq+bw*i/3.0); + int j=24; + if(i==0) j=18; + painter0.drawLine(x1,j,x1,30); + } + painter0.setPen(penRed); + for(int i=0; i<4; i++) { + x1=XfromFreq(m_txFreq+bw*i/3.0); + painter0.drawLine(x1,12,x1,18); + } + } + + if(m_mode=="JT9" and m_nSubMode>0) { //JT9 + bw=8.0*12000.0/m_nsps; + if(m_nSubMode==1) bw=2*bw; //B + if(m_nSubMode==2) bw=4*bw; //C + if(m_nSubMode==3) bw=8*bw; //D + if(m_nSubMode==4) bw=16*bw; //E + if(m_nSubMode==5) bw=32*bw; //F + if(m_nSubMode==6) bw=64*bw; //G + if(m_nSubMode==7) bw=128*bw; //H + } + + if(m_mode=="Q65") { //Q65 + int h=int(pow(2.0,m_nSubMode)); + int nsps=1800; + if(m_TRperiod==30) nsps=3600; + if(m_TRperiod==60) nsps=7200; + if(m_TRperiod==120) nsps=16000; + if(m_TRperiod==300) nsps=41472; + float baud=12000.0/nsps; + bw=65.0*h*baud; + } + if(m_mode=="JT65") { //JT65 + bw=65.0*11025.0/4096.0; + if(m_nSubMode==1) bw=2*bw; //B + if(m_nSubMode==2) bw=4*bw; //C + } + + painter0.setPen(penGreen); + if(m_mode=="WSPR") { + x1=XfromFreq(1400); + x2=XfromFreq(1600); + painter0.drawLine(x1,26,x2,26); + } + + if(m_mode=="FST4W") { + x1=XfromFreq(m_rxFreq-m_tol); + x2=XfromFreq(m_rxFreq+m_tol); + painter0.drawLine(x1,26,x2,26); + } + + if(m_mode=="FreqCal") { //FreqCal + x1=XfromFreq(m_rxFreq-m_tol); + x2=XfromFreq(m_rxFreq+m_tol); + painter0.drawLine(x1,29,x2,29); + x1=XfromFreq(m_rxFreq); + painter0.drawLine(x1,24,x1,30); + } + + int yh=5; + int yTxTop=12; + int yRxBottom=yTxTop + 2*yh + 4; + if(m_mode=="JT9" or m_mode=="JT65" or m_mode=="Q65" or m_mode=="FT8" + or m_mode=="FT4" or m_mode.startsWith("FST4")) { + + if(m_mode=="FST4" and !m_bSingleDecode) { + x1=XfromFreq(m_nfa); + x2=XfromFreq(m_nfb); + painter0.drawLine(x1,25,x1+5,30); // Mark FST4 F_Low + painter0.drawLine(x1,25,x1+5,20); + painter0.drawLine(x2,25,x2-5,30); // Mark FST4 F_High + painter0.drawLine(x2,25,x2-5,20); + } + + if(m_mode=="Q65" or (m_mode=="JT65" and m_bVHF) or (m_mode=="FT8" and m_bSuperHound)) { + painter0.setPen(penGreen); + x1=XfromFreq(m_rxFreq-m_tol); + x2=XfromFreq(m_rxFreq+m_tol); + painter0.drawLine(x1,26,x2,26); + x1=XfromFreq(m_rxFreq); + painter0.drawLine(x1,20,x1,26); + + if(m_mode=="JT65") { + painter0.setPen(penOrange); + x3=XfromFreq(m_rxFreq+20.0*bw/65.0); //RO + painter0.drawLine(x3,20,x3,26); + x4=XfromFreq(m_rxFreq+30.0*bw/65.0); //RRR + painter0.drawLine(x4,20,x4,26); + x5=XfromFreq(m_rxFreq+40.0*bw/65.0); //73 + painter0.drawLine(x5,20,x5,26); + } + painter0.setPen(penGreen); + x6=XfromFreq(m_rxFreq+bw); //Highest tone + if(m_mode=="FT8" and m_bSuperHound) x6=XfromFreq(m_rxFreq+1500.0); + painter0.drawLine(x6,20,x6,26); + + } else { + // Draw the green goal post + painter0.setPen(penGreen); + x1=XfromFreq(m_rxFreq); + x2=XfromFreq(m_rxFreq+bw); + painter0.drawLine(x1,yRxBottom-yh,x1,yRxBottom); + painter0.drawLine(x1,yRxBottom,x2,yRxBottom); + painter0.drawLine(x2,yRxBottom-yh,x2,yRxBottom); + if(m_mode.startsWith("FST4")) { + x1=XfromFreq(m_rxFreq-m_tol); + x2=XfromFreq(m_rxFreq+m_tol); + painter0.drawLine(x1,26,x2,26); // Mark the Tol range + } + } + } + + QPainter overPainter(&m_DialOverlayPixmap); + if (m_bars) { + if (!overPainter.isActive()) overPainter.begin(this); + overPainter.setCompositionMode(QPainter::CompositionMode_Source); + overPainter.fillRect(0, 0, m_Size.width(), m_h, Qt::transparent); + } + + if(m_mode.startsWith("FT") or m_mode.startsWith("JT") or m_mode=="Q65" or m_mode.startsWith("FST4")) { + x1=XfromFreq(m_rxFreq); + if(m_mode=="FT8" and m_bSuperHound) { + x2=XfromFreq(m_rxFreq+1500); + } else { + x2=XfromFreq(m_rxFreq+bw); + } + if (m_bars) { + overPainter.setPen(Qt::green); // Rx bars + overPainter.drawLine(x1,0,x1,m_h); overPainter.drawLine(x2,0,x2,m_h); + } + } + + // red bars + if(m_mode.startsWith("FT") or m_mode.startsWith("JT") or m_mode=="Q65" or m_mode.startsWith("FST4") + or m_mode.mid(0,4)=="WSPR") { + x1=XfromFreq(m_txFreq); x2=XfromFreq(m_txFreq+bw); + if(m_mode=="FT8" and m_bSuperFox) x2=XfromFreq(m_txFreq+1500.0); + if(m_mode=="WSPR") { + bw=4*12000.0/8192.0; //WSPR + x1=XfromFreq(m_txFreq-0.5*bw); x2=XfromFreq(m_txFreq+0.5*bw); + } + if (m_bars) { + overPainter.setPen(Qt::red); // Tx bars + overPainter.drawLine(x1,0,x1,m_h); overPainter.drawLine(x2,0,x2,m_h); + } + } + + // red goal post + if(m_mode=="JT9" or m_mode=="JT65" or m_mode.mid(0,4)=="WSPR" or m_mode=="Q65" + or m_mode=="FT8" or m_mode=="FT4" or m_mode.startsWith("FST4")) { + painter0.setPen(penRed); + x1=XfromFreq(m_txFreq); + if(m_mode=="FT8" and m_bSuperFox) { + x2=XfromFreq(m_txFreq+1500.0); + } else { + x2=XfromFreq(m_txFreq+bw); + } + if(m_mode=="WSPR") { + bw=4*12000.0/8192.0; //WSPR + x1=XfromFreq(m_txFreq-0.5*bw); + x2=XfromFreq(m_txFreq+0.5*bw); + } + // Draw the red goal post + painter0.drawLine(x1,yTxTop,x1,yTxTop+yh); + painter0.drawLine(x1,yTxTop,x2,yTxTop); + painter0.drawLine(x2,yTxTop,x2,yTxTop+yh); + } + + QPainter hoverPainter(&m_HoverOverlayPixmap); + if (m_bars) { + if (!hoverPainter.isActive()) hoverPainter.begin(this); +// if(m_mode=="FT8" and m_bSuperHound) bw=1500; // not useful for the white bars + int fwidth=XfromFreq(m_rxFreq+bw)-XfromFreq(m_rxFreq);; + hoverPainter.setCompositionMode(QPainter::CompositionMode_Source); + hoverPainter.fillRect(0, 0, m_Size.width(), m_h, Qt::transparent); + hoverPainter.setPen(QPen(Qt::white)); // white bars + hoverPainter.drawLine(0, 30, 0, m_h); // first slot, left line hover + hoverPainter.drawLine(fwidth, 30, fwidth, m_h); // first slot, right line hover + } + + if(m_dialFreq>10.13 and m_dialFreq< 10.15 and m_mode.mid(0,4)!="WSPR" and m_mode!="FST4W") { + float f1=1.0e6*(10.1401 - m_dialFreq); + float f2=f1+200.0; + x1=XfromFreq(f1); + x2=XfromFreq(f2); + if(x1<=m_w and x2>=0) { + painter0.setPen(penOrange); //Mark WSPR sub-band orange + painter0.drawLine(x1,9,x2,9); + } + } +} + +void CPlotter::MakeFrequencyStrs() //MakeFrequencyStrs +{ + int f=(m_startFreq+m_freqPerDiv-1)/m_freqPerDiv; + f*=m_freqPerDiv; + m_xOffset=float(f-m_startFreq)/m_freqPerDiv; + for(int i=0; i<=m_hdivs; i++) { + m_HDivText[i].setNum(f); + f+=m_freqPerDiv; + } +} + +int CPlotter::XfromFreq(float f) //XfromFreq() +{ + int x = int(m_w * (f - m_startFreq)/m_fSpan + 0.5); + if(x<0 ) return 0; + if(x>m_w) return m_w; + return x; +} + +float CPlotter::FreqfromX(int x) //FreqfromX() +{ + return float(m_startFreq + x*m_binsPerPixel*m_fftBinWidth); +} + +void CPlotter::SetRunningState(bool running) //SetRunningState() +{ + m_Running = running; +} + +void CPlotter::setPlotZero(int plotZero) //setPlotZero() +{ + m_plotZero=plotZero; +} + +int CPlotter::plotZero() //PlotZero() +{ + return m_plotZero; +} + +void CPlotter::setPlotGain(int plotGain) //setPlotGain() +{ + m_plotGain=plotGain; +} + +int CPlotter::plotGain() //plotGain() +{ + return m_plotGain; +} + +int CPlotter::plot2dGain() //plot2dGain +{ + return m_plot2dGain; +} + +void CPlotter::setPlot2dGain(int n) //setPlot2dGain +{ + m_plot2dGain=n; + update(); +} + +int CPlotter::plot2dZero() //plot2dZero +{ + return m_plot2dZero; +} + +void CPlotter::setPlot2dZero(int plot2dZero) //setPlot2dZero +{ + m_plot2dZero=plot2dZero; +} + +void CPlotter::setStartFreq(int f) //SetStartFreq() +{ + m_startFreq=f; + m_fMax=FreqfromX(XfromFreq(5000.0)); + resizeEvent(NULL); + DrawOverlay(); + update(); +} + +int CPlotter::startFreq() //startFreq() +{ + return m_startFreq; +} + +int CPlotter::plotWidth(){return m_WaterfallPixmap.width();} //plotWidth +void CPlotter::UpdateOverlay() {DrawOverlay();} //UpdateOverlay +void CPlotter::setDataFromDisk(bool b) {m_dataFromDisk=b;} //setDataFromDisk + +void CPlotter::setRxRange(int fMin) //setRxRange +{ + m_fMin=fMin; +} + +void CPlotter::setBinsPerPixel(int n) //setBinsPerPixel +{ + m_binsPerPixel = n; + m_fMax=FreqfromX(XfromFreq(5000.0)); + DrawOverlay(); //Redraw scales and ticks + update(); //trigger a new paintEvent} +} + +int CPlotter::binsPerPixel() //binsPerPixel +{ + return m_binsPerPixel; +} + +void CPlotter::setWaterfallAvg(int n) //setNavg +{ + m_waterfallAvg = n; +} + +void CPlotter::setRxFreq (int x) //setRxFreq +{ + m_rxFreq = x; // x is freq in Hz + DrawOverlay(); + update(); +} + +int CPlotter::rxFreq() {return m_rxFreq;} //rxFreq + +void CPlotter::leaveEvent(QEvent *event) +{ + m_lastMouseX = -1; + m_lastPaintedX = -1; + event->ignore(); +} + +void CPlotter::mouseMoveEvent (QMouseEvent * event) +{ + int x=event->x(); + if(x < 0) x = 0; + if(x>m_Size.width()) x = m_Size.width(); + if(m_freq) m_pos = event->globalPos(); + m_lastMouseX = x; + update(); + + event->ignore(); + if(m_freq) { + if (!m_bTotalPower){ + QToolTip::showText(event->globalPos(),QString::number(int(FreqfromX(x)))); + } else { + int y=event->y(); + float pdB=10.0*(m_h-y)/m_vpixperdiv + 20.0; + if(y<(m_h-m_h2)) { + QToolTip::showText(event->globalPos(),QString::number(int(FreqfromX(x)))); + } else { + QString t; + t=t.asprintf("%4.1f dB",pdB); + QToolTip::showText(event->globalPos(),t); + } + } + } + QWidget::mouseMoveEvent(event); +} + +void CPlotter::mouseReleaseEvent (QMouseEvent * event) +{ + bool rightbutton = (event->button() & Qt::RightButton); + bool leftbutton = (event->button() & Qt::LeftButton); + bool shift = (event->modifiers() & Qt::ShiftModifier); + if (rightbutton) { + leftbutton = true; + shift = true; + } + if (leftbutton) { + int x=event->x(); + if(x<0) x=0; + if(x>m_Size.width()) x=m_Size.width(); + bool ctrl = (event->modifiers() & Qt::ControlModifier); + if(!shift and m_mode=="FST4W") return; + int newFreq = int(FreqfromX(x)+0.5); + int oldTxFreq = m_txFreq; + int oldRxFreq = m_rxFreq; + if (ctrl and m_mode!="FST4W") { + emit setFreq1 (newFreq, newFreq); + } else if (shift) { + emit setFreq1 (oldRxFreq, newFreq); + } else { + emit setFreq1(newFreq,oldTxFreq); + } + + int n=1; + if(ctrl) n+=100; + emit freezeDecode1(n); + } + else { + event->ignore (); // let parent handle + } +// replot(); // ### Not needed? ### +} + +void CPlotter::mouseDoubleClickEvent (QMouseEvent * event) +{ + bool rightbutton = (event->button() & Qt::RightButton); + bool leftbutton = (event->button() & Qt::LeftButton); + bool ctrl = (event->modifiers() & Qt::ControlModifier); + if (leftbutton) { + int n=2; + if(ctrl) n+=100; + emit freezeDecode1(n); + } else if (rightbutton) { + int x=event->x(); + if(x<0) x=0; + if(x>m_Size.width()) x=m_Size.width(); + int newFreq = int(FreqfromX(x)+0.5); + if (m_mode!="FST4W") emit setFreq1 (newFreq, newFreq); + int n=1; + if(ctrl) n+=100; + emit freezeDecode1(n); + } else { + event->ignore (); // let parent handle + } +} + +void CPlotter::setNsps(double trperiod, int nsps) //setNsps +{ + m_TRperiod=trperiod; + m_nsps=nsps; + m_fftBinWidth=1500.0/2048.0; + if(m_nsps==15360) m_fftBinWidth=1500.0/2048.0; + if(m_nsps==40960) m_fftBinWidth=1500.0/6144.0; + if(m_nsps==82944) m_fftBinWidth=1500.0/12288.0; + if(m_nsps==252000) m_fftBinWidth=1500.0/32768.0; + DrawOverlay(); //Redraw scales and ticks + update(); //trigger a new paintEvent} +} + +void CPlotter::setTxFreq(int n) //setTxFreq +{ + m_txFreq=n; + DrawOverlay(); + update(); +} + +void CPlotter::setMode(QString mode) //setMode +{ + m_mode=mode; +} + +void CPlotter::setSubMode(int n) //setSubMode +{ + m_nSubMode=n; +} + +int CPlotter::Fmax() +{ + return m_fMax; +} + +void CPlotter::setDialFreq(double d) +{ + m_dialFreq=d; + DrawOverlay(); + update(); +} + +void CPlotter::setRxBand(QString band) +{ + m_rxBand=band; +} + +void CPlotter::setFlatten(bool b1, bool b2) +{ + m_Flatten=0; + if(b1) m_Flatten=1; + if(b2) m_Flatten=2; +} + +void CPlotter::setSuperFox(bool b) +{ + m_bSuperFox=b; + if(m_bSuperFox) m_bSuperHound=false; +} +void CPlotter::setSuperHound(bool b) +{ + m_bSuperHound=b; + if(m_bSuperHound) m_bSuperFox=false; +} + +void CPlotter::setTol(int n) //setTol() +{ + m_tol=n; + DrawOverlay(); +} + +void CPlotter::setFST4_FreqRange(int fLow,int fHigh) +{ + m_nfa=fLow; + m_nfb=fHigh; + DrawOverlay(); + update(); +} + +void CPlotter::setSingleDecode(bool b) +{ + m_bSingleDecode=b; +} + + +void CPlotter::setColours(QVector<QColor> const& cl) +{ + g_ColorTbl = cl; +} + +void CPlotter::SetPercent2DScreen(int percent) +{ + m_Percent2DScreen=percent; + resizeEvent(NULL); + update(); +} +void CPlotter::setVHF(bool bVHF) +{ + m_bVHF=bVHF; +} + +void CPlotter::setRedFile(QString fRed) +{ + m_redFile=fRed; +} + +void CPlotter::setDiskUTC(int nutc) +{ + m_nUTC=nutc; +} + +void CPlotter::drawTotalPower(float pdB) +{ + m_pdB=pdB; +} + +void CPlotter::restartTotalPower() +{ + m_x=0; +} + +void CPlotter::setTimestamp(int n) +{ + m_timestamp=n; +} + +void CPlotter::setBars(bool b) +{ + setMouseTracking(b || m_freq); + m_bars=b; + DrawOverlay(); + update(); +} + +void CPlotter::showFreq(bool b) +{ + setMouseTracking(b || m_bars); + m_freq=b; +} + +void CPlotter::setDarkStyle (bool b) //set wide filter lines for Hound mode +{ + m_useDarkStyle=b; + DrawOverlay(); + update(); +} diff --git a/widgets/plotter.h b/widgets/plotter.h index 42dc7428..1f3b8c42 100755..100644 --- a/widgets/plotter.h +++ b/widgets/plotter.h @@ -1,219 +1,219 @@ -// -*- Mode: C++ -*-
-///////////////////////////////////////////////////////////////////////////
-// Some code in this file and accompanying files is based on work by
-// Moe Wheatley, AE4Y, released under the "Simplified BSD License".
-// For more details see the accompanying file LICENSE_WHEATLEY.TXT
-///////////////////////////////////////////////////////////////////////////
-
-#ifndef PLOTTER_H_
-#define PLOTTER_H_
-
-#include <QFrame>
-#include <QSize>
-#include <QImage>
-#include <QVector>
-#include <QColor>
-#include <QToolTip>
-
-#define VERT_DIVS 7 //specify grid screen divisions
-#define HORZ_DIVS 20
-
-extern bool g_single_decode;
-
-class QAction;
-
-class CPlotter : public QFrame
-{
- Q_OBJECT
-
-public:
- explicit CPlotter(QWidget *parent = 0);
- ~CPlotter();
-
- QSize minimumSizeHint() const Q_DECL_OVERRIDE;
- QSize sizeHint() const Q_DECL_OVERRIDE;
-
- void draw(float swide[], bool bScroll, bool bRed); //Update the waterfall
- void drawTotalPower(float pdB);
- void replot();
- void SetRunningState(bool running);
- void setPlotZero(int plotZero);
- int plotZero();
- void setPlotGain(int plotGain);
- int plotGain();
- int plot2dGain();
- void setPlot2dGain(int n);
- int plot2dZero();
- void setPlot2dZero(int plot2dZero);
- void setStartFreq(int f);
- int startFreq();
- int plotWidth();
- void UpdateOverlay();
- void setDataFromDisk(bool b);
- void setRxRange(int fMin);
- void setBinsPerPixel(int n);
- int binsPerPixel();
- void setWaterfallAvg(int n);
- void setRxFreq(int n);
- void DrawOverlay();
- int rxFreq();
- void setFsample(int n);
- void setNsps(double trperiod, int nsps);
- void setTxFreq(int n);
- void setMode(QString mode);
- void setSubMode(int n);
- void SetPercent2DScreen(int percent);
- int Fmax();
- void setDialFreq(double d);
- void setCurrent(bool b) {m_bCurrent = b;}
- bool current() const {return m_bCurrent;}
- void setCumulative(bool b) {m_bCumulative = b;}
- bool cumulative() const {return m_bCumulative;}
- void setLinearAvg(bool b) {m_bLinearAvg = b;}
- bool linearAvg() const {return m_bLinearAvg;}
- void setBreadth(qint32 w) {m_w = w;}
- qint32 breadth() const {return m_w;}
- float fSpan() const {return m_fSpan;}
- void setColours(QVector<QColor> const& cl);
- void setTimestamp(int n);
- void setBars(bool b);
- void showFreq(bool b);
- void setFlatten(bool b1, bool b2);
- void setTol(int n);
- void setSuperFox(bool b);
- void setSuperHound(bool b);
- void setRxBand(QString band);
- void setReference(bool b) {m_bReference = b;}
- bool Reference() const {return m_bReference;}
- void setQ65_Sync(bool b) {m_bQ65_Sync = b;}
- bool Q65_Sync() const {return m_bQ65_Sync;}
- void setTotalPower(bool b) {m_bTotalPower = b;}
- bool TotalPower() const {return m_bTotalPower;}
- void drawRed(int ia, int ib, float swide[]);
- void setVHF(bool bVHF);
- void setRedFile(QString fRed);
- void setFST4_FreqRange(int fLow,int fHigh);
- void setSingleDecode(bool b);
- void setDiskUTC(int nutc);
- void restartTotalPower();
- bool scaleOK () const {return m_bScaleOK;}
- void setDarkStyle(bool b);
-
-signals:
- void freezeDecode1(int n);
- void setFreq1(int rxFreq, int txFreq);
-
-protected:
- //re-implemented widget event handlers
- void paintEvent(QPaintEvent *event) override;
- void resizeEvent(QResizeEvent* event) override;
- void mouseMoveEvent(QMouseEvent * event) override;
- void mouseReleaseEvent (QMouseEvent * event) override;
- void mouseDoubleClickEvent (QMouseEvent * event) override;
-
-private:
-
- void MakeFrequencyStrs();
- int XfromFreq(float f);
- float FreqfromX(int x);
-
- QAction * m_set_freq_action;
-
- bool m_bScaleOK;
- bool m_bCurrent;
- bool m_bCumulative;
- bool m_bLinearAvg;
- bool m_bReference;
- bool m_bReference0;
- bool m_bQ65_Sync;
- bool m_bTotalPower;
- bool m_bVHF;
- bool m_bSingleDecode;
- bool m_bFirst=true;
- bool m_bResized;
- bool m_bSuperFox=false;
- bool m_bSuperHound=false;
- bool m_bars;
- bool m_freq;
- float m_fSpan;
- float m_pdB=0.0;
- float m_vpixperdiv;
- bool m_useDarkStyle=false;
-
- qint32 m_plotZero;
- qint32 m_plotGain;
- qint32 m_plot2dGain;
- qint32 m_plot2dZero;
- qint32 m_binsPerPixel;
- qint32 m_waterfallAvg;
- qint32 m_w;
- qint32 m_Flatten;
- qint32 m_nSubMode;
- qint32 m_ia;
- qint32 m_ib;
- qint32 m_nfa;
- qint32 m_nfb;
- qint32 m_nUTC;
- qint32 m_x=0;
- qint32 m_timestamp;
-
- QPixmap m_DialOverlayPixmap;
- QPixmap m_HoverOverlayPixmap;
- QPixmap m_WaterfallPixmap;
- QPixmap m_2DPixmap;
- QPixmap m_ScalePixmap;
- QPixmap m_OverlayPixmap;
- QPoint m_pos;
- QSize m_Size;
- QString m_Str;
- QString m_HDivText[483];
- QString m_mode;
- QString m_mode0;
- QString m_rxBand;
- QString m_redFile;
-
- bool m_Running;
- bool m_paintEventBusy;
- bool m_dataFromDisk;
- bool m_bReplot;
-
- double m_fftBinWidth;
- double m_dialFreq;
- double m_xOffset;
- double m_TRperiod;
-
- float m_sum[2048];
-
- qint32 m_dBStepSize;
- qint32 m_FreqUnits;
- qint32 m_hdivs;
- qint32 m_line;
- qint32 m_fSample;
- qint32 m_xClick;
- qint32 m_freqPerDiv;
- qint32 m_nsps;
- qint32 m_Percent2DScreen;
- qint32 m_Percent2DScreen0;
- qint32 m_h;
- qint32 m_h1;
- qint32 m_h2;
- qint32 m_rxFreq;
- qint32 m_rxFreq0=0;
- qint32 m_txFreq;
- qint32 m_fMin;
- qint32 m_fMax;
- qint32 m_startFreq;
- qint32 m_tol;
- qint32 m_lastMouseX;
- qint32 m_lastPaintedX;
- qint32 m_j;
- char m_sutc[6];
-
-private slots:
- void leaveEvent(QEvent *event) override;
-
-};
-
-extern QVector<QColor> g_ColorTbl;
-
-#endif // PLOTTER_H
+// -*- Mode: C++ -*- +/////////////////////////////////////////////////////////////////////////// +// Some code in this file and accompanying files is based on work by +// Moe Wheatley, AE4Y, released under the "Simplified BSD License". +// For more details see the accompanying file LICENSE_WHEATLEY.TXT +/////////////////////////////////////////////////////////////////////////// + +#ifndef PLOTTER_H_ +#define PLOTTER_H_ + +#include <QFrame> +#include <QSize> +#include <QImage> +#include <QVector> +#include <QColor> +#include <QToolTip> + +#define VERT_DIVS 7 //specify grid screen divisions +#define HORZ_DIVS 20 + +extern bool g_single_decode; + +class QAction; + +class CPlotter : public QFrame +{ + Q_OBJECT + +public: + explicit CPlotter(QWidget *parent = 0); + ~CPlotter(); + + QSize minimumSizeHint() const Q_DECL_OVERRIDE; + QSize sizeHint() const Q_DECL_OVERRIDE; + + void draw(float swide[], bool bScroll, bool bRed); //Update the waterfall + void drawTotalPower(float pdB); + void replot(); + void SetRunningState(bool running); + void setPlotZero(int plotZero); + int plotZero(); + void setPlotGain(int plotGain); + int plotGain(); + int plot2dGain(); + void setPlot2dGain(int n); + int plot2dZero(); + void setPlot2dZero(int plot2dZero); + void setStartFreq(int f); + int startFreq(); + int plotWidth(); + void UpdateOverlay(); + void setDataFromDisk(bool b); + void setRxRange(int fMin); + void setBinsPerPixel(int n); + int binsPerPixel(); + void setWaterfallAvg(int n); + void setRxFreq(int n); + void DrawOverlay(); + int rxFreq(); + void setFsample(int n); + void setNsps(double trperiod, int nsps); + void setTxFreq(int n); + void setMode(QString mode); + void setSubMode(int n); + void SetPercent2DScreen(int percent); + int Fmax(); + void setDialFreq(double d); + void setCurrent(bool b) {m_bCurrent = b;} + bool current() const {return m_bCurrent;} + void setCumulative(bool b) {m_bCumulative = b;} + bool cumulative() const {return m_bCumulative;} + void setLinearAvg(bool b) {m_bLinearAvg = b;} + bool linearAvg() const {return m_bLinearAvg;} + void setBreadth(qint32 w) {m_w = w;} + qint32 breadth() const {return m_w;} + float fSpan() const {return m_fSpan;} + void setColours(QVector<QColor> const& cl); + void setTimestamp(int n); + void setBars(bool b); + void showFreq(bool b); + void setFlatten(bool b1, bool b2); + void setTol(int n); + void setSuperFox(bool b); + void setSuperHound(bool b); + void setRxBand(QString band); + void setReference(bool b) {m_bReference = b;} + bool Reference() const {return m_bReference;} + void setQ65_Sync(bool b) {m_bQ65_Sync = b;} + bool Q65_Sync() const {return m_bQ65_Sync;} + void setTotalPower(bool b) {m_bTotalPower = b;} + bool TotalPower() const {return m_bTotalPower;} + void drawRed(int ia, int ib, float swide[]); + void setVHF(bool bVHF); + void setRedFile(QString fRed); + void setFST4_FreqRange(int fLow,int fHigh); + void setSingleDecode(bool b); + void setDiskUTC(int nutc); + void restartTotalPower(); + bool scaleOK () const {return m_bScaleOK;} + void setDarkStyle(bool b); + +signals: + void freezeDecode1(int n); + void setFreq1(int rxFreq, int txFreq); + +protected: + //re-implemented widget event handlers + void paintEvent(QPaintEvent *event) override; + void resizeEvent(QResizeEvent* event) override; + void mouseMoveEvent(QMouseEvent * event) override; + void mouseReleaseEvent (QMouseEvent * event) override; + void mouseDoubleClickEvent (QMouseEvent * event) override; + +private: + + void MakeFrequencyStrs(); + int XfromFreq(float f); + float FreqfromX(int x); + + QAction * m_set_freq_action; + + bool m_bScaleOK; + bool m_bCurrent; + bool m_bCumulative; + bool m_bLinearAvg; + bool m_bReference; + bool m_bReference0; + bool m_bQ65_Sync; + bool m_bTotalPower; + bool m_bVHF; + bool m_bSingleDecode; + bool m_bFirst=true; + bool m_bResized; + bool m_bSuperFox=false; + bool m_bSuperHound=false; + bool m_bars; + bool m_freq; + float m_fSpan; + float m_pdB=0.0; + float m_vpixperdiv; + bool m_useDarkStyle=false; + + qint32 m_plotZero; + qint32 m_plotGain; + qint32 m_plot2dGain; + qint32 m_plot2dZero; + qint32 m_binsPerPixel; + qint32 m_waterfallAvg; + qint32 m_w; + qint32 m_Flatten; + qint32 m_nSubMode; + qint32 m_ia; + qint32 m_ib; + qint32 m_nfa; + qint32 m_nfb; + qint32 m_nUTC; + qint32 m_x=0; + qint32 m_timestamp; + + QPixmap m_DialOverlayPixmap; + QPixmap m_HoverOverlayPixmap; + QPixmap m_WaterfallPixmap; + QPixmap m_2DPixmap; + QPixmap m_ScalePixmap; + QPixmap m_OverlayPixmap; + QPoint m_pos; + QSize m_Size; + QString m_Str; + QString m_HDivText[483]; + QString m_mode; + QString m_mode0; + QString m_rxBand; + QString m_redFile; + + bool m_Running; + bool m_paintEventBusy; + bool m_dataFromDisk; + bool m_bReplot; + + double m_fftBinWidth; + double m_dialFreq; + double m_xOffset; + double m_TRperiod; + + float m_sum[2048]; + + qint32 m_dBStepSize; + qint32 m_FreqUnits; + qint32 m_hdivs; + qint32 m_line; + qint32 m_fSample; + qint32 m_xClick; + qint32 m_freqPerDiv; + qint32 m_nsps; + qint32 m_Percent2DScreen; + qint32 m_Percent2DScreen0; + qint32 m_h; + qint32 m_h1; + qint32 m_h2; + qint32 m_rxFreq; + qint32 m_rxFreq0=0; + qint32 m_txFreq; + qint32 m_fMin; + qint32 m_fMax; + qint32 m_startFreq; + qint32 m_tol; + qint32 m_lastMouseX; + qint32 m_lastPaintedX; + qint32 m_j; + char m_sutc[6]; + +private slots: + void leaveEvent(QEvent *event) override; + +}; + +extern QVector<QColor> g_ColorTbl; + +#endif // PLOTTER_H diff --git a/widgets/qsymonitor.cpp b/widgets/qsymonitor.cpp index 7e72f7e8..efe9181a 100755..100644 --- a/widgets/qsymonitor.cpp +++ b/widgets/qsymonitor.cpp @@ -1,347 +1,347 @@ -#include "qsymonitor.h"
-#include "ui_qsymonitor.h"
-#include "SettingsGroup.hpp"
-#include "Configuration.hpp"
-#include "qt_helpers.hpp"
-#include "commons.h"
-#include <QSettings>
-#include <QObject>
-#include <QCloseEvent>
-#include <QThread>
-#include <QLabel>
-#include <QWidget>
-#include <QMessageBox>
-#include <QStringList>
-
-QSYMonitor::QSYMonitor(QSettings * settings, QFont const& font, Configuration const * configuration, QWidget *parent)
- : QWidget(parent),
- settings_ {settings},
- configuration_ {configuration},
- ui(new Ui::QSYMonitor)
-{
- ui->setupUi(this);
- setWindowTitle (QApplication::applicationName () + " - " + tr ("QSY Monitor"));
- ui->QSYMonitorTextBrowser->setReadOnly (true);
- changeFont (font);
- read_settings ();
- ui->qsyMonitorLabel->setText(" UTC Call Freq Mode");
-}
-
-QSYMonitor::~QSYMonitor()
-{
- delete ui;
-}
-
-void QSYMonitor::getQSYData(QString value)
-{
- createQSYLine(value);
-}
-
-void QSYMonitor::read_settings ()
-{
- SettingsGroup g (settings_, "QSYMonitor");
- move (settings_->value ("window/pos", pos ()).toPoint ());
- restoreGeometry(settings_->value("geometry").toByteArray());
-}
-
-void QSYMonitor::write_settings ()
-{
- SettingsGroup g (settings_, "QSYMonitor");
- settings_->setValue ("window/pos", pos ());
- settings_->setValue ("geometry", saveGeometry());
-}
-
-void QSYMonitor::changeFont (QFont const& font)
-{
- ui->qsyMonitorLabel->setStyleSheet (font_as_stylesheet (font));
- ui->QSYMonitorTextBrowser->setStyleSheet (font_as_stylesheet (font));
- updateGeometry ();
-}
-
-void QSYMonitor::closeEvent (QCloseEvent * e)
-{
- write_settings();
- e->accept(); // was ignore
-}
-
-void QSYMonitor::on_clearButton_clicked()
-{
- ui->QSYMonitorTextBrowser->clear();
-}
-
-void QSYMonitor::createQSYLine(QString value)
-{
- QStringList qsySpot = value.split(' ');
- if(qsySpot.length() == 3) {
- QString theTime = qsySpot[0];
- QString theCall = qsySpot[1];
- getBandModeFreq(theTime, theCall, qsySpot[2]);
- }
-}
-
-void QSYMonitor::getBandModeFreq(QString theTime, QString theCall, QString value)
-{
- if(value.at(0).isLetter() || value.at(0) == '9' || value.at(0) == '4' || value.at(0) == '7') {
- QString bandParam = "";
- QString modeParam = value.at(0);
- QString freqParam = "";
- bandParam = value.mid(0,1);
- modeParam = value.at(1);
- freqParam = value.mid(2, 3);
- QString band = "";
- QString mode = "";
- QString freq = "";
-
- if (bandParam == "A") {
- if (modeParam.at(0).isLetter()) {
- freq = "50.";
- } else {
- if (modeParam =="0") {
- freq = "50.";
- } else if (modeParam =="1") {
- freq = "51.";
- } else if (modeParam =="2") {
- freq = "52.";
- } else if (modeParam =="3") {
- freq = "53.";
- }
- }
- }
- else if (bandParam == "B") {
- if (modeParam.at(0).isLetter()) {
- freq = "144.";
- } else {
- if (modeParam =="4") {
- freq = "144.";
- } else if (modeParam =="5") {
- freq = "145.";
- } else if (modeParam =="6") {
- freq = "146.";
- } else if (modeParam =="7") {
- freq = "147.";
- }
- }
- }
- else if (bandParam == "C") {
- if (modeParam.at(0).isLetter()) {
- freq = "222.";
- } else {
- if (modeParam =="2") {
- freq = "222.";
- } else if (modeParam =="3") {
- freq = "223.";
- }
- }
- }
- else if (bandParam == "D") {
- if (modeParam.at(0).isLetter()) {
- freq = "432.";
- } else {
- if (configuration_->region()==2) {
- if (modeParam =="0") {
- freq = "440.";
- } else if (modeParam =="1") {
- freq = "441.";
- } else if (modeParam =="2") {
- freq = "442.";
- } else if (modeParam =="3") {
- freq = "443.";
- } else if (modeParam =="4") {
- freq = "444.";
- } else if (modeParam =="5") {
- freq = "445.";
- } else if (modeParam =="6") {
- freq = "446.";
- } else if (modeParam =="7") {
- freq = "447.";
- } else if (modeParam =="8") {
- freq = "448.";
- } else if (modeParam =="9") {
- freq = "449.";
- }
- }
- else { //not region 2
- if (modeParam =="0") {
- freq = "430.";
- } else if (modeParam =="1") {
- freq = "431.";
- } else if (modeParam =="2") {
- freq = "432.";
- } else if (modeParam =="3") {
- freq = "433.";
- } else if (modeParam =="4") {
- freq = "434.";
- } else if (modeParam =="5") {
- freq = "435.";
- } else if (modeParam =="6") {
- freq = "436.";
- } else if (modeParam =="7") {
- freq = "437.";
- } else if (modeParam =="8") {
- freq = "438.";
- } else if (modeParam =="9") {
- freq = "439.";
- }
- }
- }
- }
- else if (bandParam == "E") {
- if (modeParam.at(0).isLetter()) {
- freq = "1296.";
- } else {
- if (modeParam =="0") {
- freq = "1290.";
- } else if (modeParam =="1") {
- freq = "1291.";
- } else if (modeParam =="2") {
- freq = "1292.";
- } else if (modeParam =="3") {
- freq = "1293.";
- } else if (modeParam =="4") {
- freq = "1294.";
- } else if (modeParam =="5") {
- freq = "1295.";
- } else if (modeParam =="6") {
- freq = "1296.";
- } else if (modeParam =="7") {
- freq = "1297.";
- } else if (modeParam =="8") {
- freq = "1298.";
- } else if (modeParam =="9") {
- freq = "1299.";
- }
- }
- }
- else if (bandParam == "F") {
- freq = "2304.";
- }
- else if (bandParam == "G") {
- freq = "3400.";
- }
- else if (bandParam == "H") {
- freq = "5760.";
- }
- else if (bandParam == "I") {
- freq = "10368.";
- }
- else if (bandParam == "J") {
- if (configuration_->region()==2) {
- freq = "24192.";
- } else {
- freq = "24048.";
- }
- }
- else if (bandParam == "9") {
- freq = "902.";
- }
- else if (bandParam == "K") {
- freq = "903.";
- }
- else if (bandParam == "J") {
- freq = "24192.";
- }
- else if (bandParam == "X") {
- freq = "24048.";
- }
- else if (bandParam == "4") {
- freq = "40.";
- }
- else if (bandParam == "7") {
- freq = "70.";
- }
- else if (bandParam == "L") {
- freq = "0.";
- }
- else if (bandParam == "M") {
- freq = "1.";
- }
- else if (bandParam == "N") {
- freq = "3.";
- }
- else if (bandParam == "O") {
- freq = "5.";
- }
- else if (bandParam == "P") {
- freq = "7.";
- }
- else if (bandParam == "Q") {
- freq = "10.";
- }
- else if (bandParam == "R") {
- freq = "14.";
- }
- else if (bandParam == "S") {
- freq = "18.";
- }
- else if (bandParam == "T") {
- freq = "21.";
- }
- else if (bandParam == "U") {
- freq = "24.";
- }
- else if (bandParam == "V") {
- freq = "28.";
- }
- else if (bandParam == "W") {
- freq = "29.";
- } else {
- freq = "";
- }
-
- freq = freq + freqParam;
- if(!modeParam.at(0).isLetter()) {
- mode = "FM";
- }
- else if (modeParam == 'V') {
- mode = "SSB";
- }
- else if (modeParam == 'J') {
- mode = "FT4";
- }
- else if (modeParam == 'L') {
- mode = "FT8";
- }
- else if (modeParam == 'K') {
- mode = "MSK144";
- }
- else if (modeParam == 'W') {
- mode = "CW";
- }
- else if (modeParam == 'A') {
- mode = "JT9";
- }
- else if (modeParam == 'B') {
- mode = "JT65";
- }
- else if (modeParam == 'C') {
- mode = "FST4";
- }
- else if (modeParam == 'D') {
- mode = "Q65-30B";
- }
- else if (modeParam == 'E') {
- mode = "Q65-60C";
- }
- else if (modeParam == 'F') {
- mode = "Q65-60D";
- }
- else if (modeParam == 'G') {
- mode = "Q65-60E";
- }
- else if (modeParam == 'H') {
- mode = "Q65-120D";
- }
- else {
- mode = "";
- }
- int numSpaces1 = 2;
- int numSpaces2 = 10 - theCall.length();
- int numSpaces3 = 11 - freq.length();
- QString spaces1_theCall = QString(numSpaces1, ' ').append(theCall);
- QString spaces2_theFreq = QString(numSpaces2, ' ').append(freq);
- QString spaces3_theMode = QString(numSpaces3, ' ').append(mode);
- QString qsyMessageString = theTime + spaces1_theCall + spaces2_theFreq + spaces3_theMode;
- ui->QSYMonitorTextBrowser->append(qsyMessageString);
- }
-}
-
+#include "qsymonitor.h" +#include "ui_qsymonitor.h" +#include "SettingsGroup.hpp" +#include "Configuration.hpp" +#include "qt_helpers.hpp" +#include "commons.h" +#include <QSettings> +#include <QObject> +#include <QCloseEvent> +#include <QThread> +#include <QLabel> +#include <QWidget> +#include <QMessageBox> +#include <QStringList> + +QSYMonitor::QSYMonitor(QSettings * settings, QFont const& font, Configuration const * configuration, QWidget *parent) + : QWidget(parent), + settings_ {settings}, + configuration_ {configuration}, + ui(new Ui::QSYMonitor) +{ + ui->setupUi(this); + setWindowTitle (QApplication::applicationName () + " - " + tr ("QSY Monitor")); + ui->QSYMonitorTextBrowser->setReadOnly (true); + changeFont (font); + read_settings (); + ui->qsyMonitorLabel->setText(" UTC Call Freq Mode"); +} + +QSYMonitor::~QSYMonitor() +{ + delete ui; +} + +void QSYMonitor::getQSYData(QString value) +{ + createQSYLine(value); +} + +void QSYMonitor::read_settings () +{ + SettingsGroup g (settings_, "QSYMonitor"); + move (settings_->value ("window/pos", pos ()).toPoint ()); + restoreGeometry(settings_->value("geometry").toByteArray()); +} + +void QSYMonitor::write_settings () +{ + SettingsGroup g (settings_, "QSYMonitor"); + settings_->setValue ("window/pos", pos ()); + settings_->setValue ("geometry", saveGeometry()); +} + +void QSYMonitor::changeFont (QFont const& font) +{ + ui->qsyMonitorLabel->setStyleSheet (font_as_stylesheet (font)); + ui->QSYMonitorTextBrowser->setStyleSheet (font_as_stylesheet (font)); + updateGeometry (); +} + +void QSYMonitor::closeEvent (QCloseEvent * e) +{ + write_settings(); + e->accept(); // was ignore +} + +void QSYMonitor::on_clearButton_clicked() +{ + ui->QSYMonitorTextBrowser->clear(); +} + +void QSYMonitor::createQSYLine(QString value) +{ + QStringList qsySpot = value.split(' '); + if(qsySpot.length() == 3) { + QString theTime = qsySpot[0]; + QString theCall = qsySpot[1]; + getBandModeFreq(theTime, theCall, qsySpot[2]); + } +} + +void QSYMonitor::getBandModeFreq(QString theTime, QString theCall, QString value) +{ + if(value.at(0).isLetter() || value.at(0) == '9' || value.at(0) == '4' || value.at(0) == '7') { + QString bandParam = ""; + QString modeParam = value.at(0); + QString freqParam = ""; + bandParam = value.mid(0,1); + modeParam = value.at(1); + freqParam = value.mid(2, 3); + QString band = ""; + QString mode = ""; + QString freq = ""; + + if (bandParam == "A") { + if (modeParam.at(0).isLetter()) { + freq = "50."; + } else { + if (modeParam =="0") { + freq = "50."; + } else if (modeParam =="1") { + freq = "51."; + } else if (modeParam =="2") { + freq = "52."; + } else if (modeParam =="3") { + freq = "53."; + } + } + } + else if (bandParam == "B") { + if (modeParam.at(0).isLetter()) { + freq = "144."; + } else { + if (modeParam =="4") { + freq = "144."; + } else if (modeParam =="5") { + freq = "145."; + } else if (modeParam =="6") { + freq = "146."; + } else if (modeParam =="7") { + freq = "147."; + } + } + } + else if (bandParam == "C") { + if (modeParam.at(0).isLetter()) { + freq = "222."; + } else { + if (modeParam =="2") { + freq = "222."; + } else if (modeParam =="3") { + freq = "223."; + } + } + } + else if (bandParam == "D") { + if (modeParam.at(0).isLetter()) { + freq = "432."; + } else { + if (configuration_->region()==2) { + if (modeParam =="0") { + freq = "440."; + } else if (modeParam =="1") { + freq = "441."; + } else if (modeParam =="2") { + freq = "442."; + } else if (modeParam =="3") { + freq = "443."; + } else if (modeParam =="4") { + freq = "444."; + } else if (modeParam =="5") { + freq = "445."; + } else if (modeParam =="6") { + freq = "446."; + } else if (modeParam =="7") { + freq = "447."; + } else if (modeParam =="8") { + freq = "448."; + } else if (modeParam =="9") { + freq = "449."; + } + } + else { //not region 2 + if (modeParam =="0") { + freq = "430."; + } else if (modeParam =="1") { + freq = "431."; + } else if (modeParam =="2") { + freq = "432."; + } else if (modeParam =="3") { + freq = "433."; + } else if (modeParam =="4") { + freq = "434."; + } else if (modeParam =="5") { + freq = "435."; + } else if (modeParam =="6") { + freq = "436."; + } else if (modeParam =="7") { + freq = "437."; + } else if (modeParam =="8") { + freq = "438."; + } else if (modeParam =="9") { + freq = "439."; + } + } + } + } + else if (bandParam == "E") { + if (modeParam.at(0).isLetter()) { + freq = "1296."; + } else { + if (modeParam =="0") { + freq = "1290."; + } else if (modeParam =="1") { + freq = "1291."; + } else if (modeParam =="2") { + freq = "1292."; + } else if (modeParam =="3") { + freq = "1293."; + } else if (modeParam =="4") { + freq = "1294."; + } else if (modeParam =="5") { + freq = "1295."; + } else if (modeParam =="6") { + freq = "1296."; + } else if (modeParam =="7") { + freq = "1297."; + } else if (modeParam =="8") { + freq = "1298."; + } else if (modeParam =="9") { + freq = "1299."; + } + } + } + else if (bandParam == "F") { + freq = "2304."; + } + else if (bandParam == "G") { + freq = "3400."; + } + else if (bandParam == "H") { + freq = "5760."; + } + else if (bandParam == "I") { + freq = "10368."; + } + else if (bandParam == "J") { + if (configuration_->region()==2) { + freq = "24192."; + } else { + freq = "24048."; + } + } + else if (bandParam == "9") { + freq = "902."; + } + else if (bandParam == "K") { + freq = "903."; + } + else if (bandParam == "J") { + freq = "24192."; + } + else if (bandParam == "X") { + freq = "24048."; + } + else if (bandParam == "4") { + freq = "40."; + } + else if (bandParam == "7") { + freq = "70."; + } + else if (bandParam == "L") { + freq = "0."; + } + else if (bandParam == "M") { + freq = "1."; + } + else if (bandParam == "N") { + freq = "3."; + } + else if (bandParam == "O") { + freq = "5."; + } + else if (bandParam == "P") { + freq = "7."; + } + else if (bandParam == "Q") { + freq = "10."; + } + else if (bandParam == "R") { + freq = "14."; + } + else if (bandParam == "S") { + freq = "18."; + } + else if (bandParam == "T") { + freq = "21."; + } + else if (bandParam == "U") { + freq = "24."; + } + else if (bandParam == "V") { + freq = "28."; + } + else if (bandParam == "W") { + freq = "29."; + } else { + freq = ""; + } + + freq = freq + freqParam; + if(!modeParam.at(0).isLetter()) { + mode = "FM"; + } + else if (modeParam == 'V') { + mode = "SSB"; + } + else if (modeParam == 'J') { + mode = "FT4"; + } + else if (modeParam == 'L') { + mode = "FT8"; + } + else if (modeParam == 'K') { + mode = "MSK144"; + } + else if (modeParam == 'W') { + mode = "CW"; + } + else if (modeParam == 'A') { + mode = "JT9"; + } + else if (modeParam == 'B') { + mode = "JT65"; + } + else if (modeParam == 'C') { + mode = "FST4"; + } + else if (modeParam == 'D') { + mode = "Q65-30B"; + } + else if (modeParam == 'E') { + mode = "Q65-60C"; + } + else if (modeParam == 'F') { + mode = "Q65-60D"; + } + else if (modeParam == 'G') { + mode = "Q65-60E"; + } + else if (modeParam == 'H') { + mode = "Q65-120D"; + } + else { + mode = ""; + } + int numSpaces1 = 2; + int numSpaces2 = 10 - theCall.length(); + int numSpaces3 = 11 - freq.length(); + QString spaces1_theCall = QString(numSpaces1, ' ').append(theCall); + QString spaces2_theFreq = QString(numSpaces2, ' ').append(freq); + QString spaces3_theMode = QString(numSpaces3, ' ').append(mode); + QString qsyMessageString = theTime + spaces1_theCall + spaces2_theFreq + spaces3_theMode; + ui->QSYMonitorTextBrowser->append(qsyMessageString); + } +} + diff --git a/widgets/qsymonitor.h b/widgets/qsymonitor.h index 40af3875..30055d1f 100755..100644 --- a/widgets/qsymonitor.h +++ b/widgets/qsymonitor.h @@ -1,41 +1,41 @@ -#ifndef QSYMONITOR_H
-#define QSYMONITOR_H
-
-#include <QWidget>
-
-class QSettings;
-class Configuration;
-class QFont;
-
-namespace Ui {
-class QSYMonitor;
-}
-
-class QSYMonitor : public QWidget
-{
- Q_OBJECT
-
-public:
- explicit QSYMonitor(QSettings *, QFont const&, Configuration const * configuration, QWidget *parent = nullptr);
- ~QSYMonitor();
- void changeFont (QFont const&);
- Q_SLOT void getQSYData(QString value);
- void getBandModeFreq(QString theTime, QString theCall, QString value);
-
-protected:
- void closeEvent(QCloseEvent *event) override;
-
-private:
- QSettings * settings_;
- Configuration const * configuration_;
- Ui::QSYMonitor *ui;
- void read_settings ();
- void write_settings ();
- void createQSYLine (QString value);
-
-
-private slots:
- void on_clearButton_clicked();
-};
-
-#endif // QSYMONITOR_H
+#ifndef QSYMONITOR_H +#define QSYMONITOR_H + +#include <QWidget> + +class QSettings; +class Configuration; +class QFont; + +namespace Ui { +class QSYMonitor; +} + +class QSYMonitor : public QWidget +{ + Q_OBJECT + +public: + explicit QSYMonitor(QSettings *, QFont const&, Configuration const * configuration, QWidget *parent = nullptr); + ~QSYMonitor(); + void changeFont (QFont const&); + Q_SLOT void getQSYData(QString value); + void getBandModeFreq(QString theTime, QString theCall, QString value); + +protected: + void closeEvent(QCloseEvent *event) override; + +private: + QSettings * settings_; + Configuration const * configuration_; + Ui::QSYMonitor *ui; + void read_settings (); + void write_settings (); + void createQSYLine (QString value); + + +private slots: + void on_clearButton_clicked(); +}; + +#endif // QSYMONITOR_H diff --git a/widgets/qsymonitor.ui b/widgets/qsymonitor.ui index 0d15ad97..dafcebe9 100755..100644 --- a/widgets/qsymonitor.ui +++ b/widgets/qsymonitor.ui @@ -1,70 +1,70 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>QSYMonitor</class>
- <widget class="QWidget" name="QSYMonitor">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>380</width>
- <height>300</height>
- </rect>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>380</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="windowTitle">
- <string>QSYMonitor</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <item>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QLabel" name="qsyMonitorLabel">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QTextBrowser" name="QSYMonitorTextBrowser">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="verticalScrollBarPolicy">
- <enum>Qt::ScrollBarAlwaysOn</enum>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="clearButton">
- <property name="text">
- <string>Clear</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
+<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>QSYMonitor</class> + <widget class="QWidget" name="QSYMonitor"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>380</width> + <height>300</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>380</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + <property name="windowTitle"> + <string>QSYMonitor</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <item> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QLabel" name="qsyMonitorLabel"> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item> + <widget class="QTextBrowser" name="QSYMonitorTextBrowser"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="verticalScrollBarPolicy"> + <enum>Qt::ScrollBarAlwaysOn</enum> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="clearButton"> + <property name="text"> + <string>Clear</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/widgets/signalmeter.cpp b/widgets/signalmeter.cpp index a8c837f5..1010a7a2 100755..100644 --- a/widgets/signalmeter.cpp +++ b/widgets/signalmeter.cpp @@ -1,107 +1,107 @@ -// Simple bargraph dB meter
-// Implemented by Edson Pereira PY2SDR
-//
-
-#include "signalmeter.h"
-
-#include <QVBoxLayout>
-#include <QHBoxLayout>
-#include <QLabel>
-#include <QPainter>
-#include <QFontMetrics>
-#include <QDebug>
-
-#include "meterwidget.h"
-
-#include "moc_signalmeter.cpp"
-
-#define MAXDB 90
-
-class Scale final
- : public QWidget
-{
-public:
- explicit Scale (QWidget * parent = 0)
- : QWidget {parent}
- {
- setSizePolicy (QSizePolicy::Minimum, QSizePolicy::MinimumExpanding);
- }
-
- QSize sizeHint () const override
- {
- return minimumSizeHint ();
- }
-
- QSize minimumSizeHint () const override
- {
- QFontMetrics font_metrics {font (), nullptr};
- return {tick_length + text_indent + font_metrics.boundingRect ("00+").width (), (font_metrics.height () + line_spacing) * range};
- }
-
-protected:
- void paintEvent (QPaintEvent * event) override
- {
- QWidget::paintEvent (event);
-
- QPainter p {this};
- auto const& target = contentsRect ();
- QFontMetrics font_metrics {p.font (), this};
- auto font_offset = font_metrics.ascent () / 2;
- p.drawLine (target.left (), target.top () + font_offset, target.left (), target.bottom () - font_offset - font_metrics.descent ());
- for (int i = 0; i <= range; ++i)
- {
- p.save ();
- p.translate (target.left ()
- , target.top () + font_offset + i * (target.height () - font_metrics.ascent () - font_metrics.descent ()) / range);
- p.drawLine (0, 0, tick_length, 0);
- if((i%2==1)) {
- auto text = QString::number ((range - i) * scale);
- p.drawText (tick_length + text_indent, font_offset, text);
- }
- p.restore ();
- }
- }
-
-private:
- static int constexpr tick_length {4};
- static int constexpr text_indent {2};
- static int constexpr line_spacing {0};
- static int constexpr range {MAXDB/10};
- static int constexpr scale {10};
-};
-
-SignalMeter::SignalMeter (QWidget * parent)
- : QFrame {parent}
-{
- auto outer_layout = new QVBoxLayout;
- outer_layout->setSpacing (0);
-
- auto inner_layout = new QHBoxLayout;
- inner_layout->setContentsMargins (0, 0, 0, 0);
- inner_layout->setSpacing (0);
-
- m_meter = new MeterWidget;
- m_meter->setSizePolicy (QSizePolicy::Minimum, QSizePolicy::Minimum);
- inner_layout->addWidget (m_meter);
-
- m_scale = new Scale;
- inner_layout->addWidget (m_scale);
-
- m_reading = new QLabel(this);
-
- outer_layout->addLayout (inner_layout);
- outer_layout->addWidget (m_reading);
- setLayout (outer_layout);
-}
-
-void SignalMeter::setValue(float value, float valueMax)
-{
- if(value<0) value=0;
- QFontMetrics font_metrics {m_scale->font (), nullptr};
- m_meter->setContentsMargins (0, font_metrics.ascent () / 2, 0, font_metrics.ascent () / 2 + font_metrics.descent ());
- m_meter->setValue(int(value));
- m_meter->set_sigPeak(valueMax);
- QString t;
- t = t.asprintf("%d dB",int(value+0.5));
- m_reading->setText(t);
-}
+// Simple bargraph dB meter +// Implemented by Edson Pereira PY2SDR +// + +#include "signalmeter.h" + +#include <QVBoxLayout> +#include <QHBoxLayout> +#include <QLabel> +#include <QPainter> +#include <QFontMetrics> +#include <QDebug> + +#include "meterwidget.h" + +#include "moc_signalmeter.cpp" + +#define MAXDB 90 + +class Scale final + : public QWidget +{ +public: + explicit Scale (QWidget * parent = 0) + : QWidget {parent} + { + setSizePolicy (QSizePolicy::Minimum, QSizePolicy::MinimumExpanding); + } + + QSize sizeHint () const override + { + return minimumSizeHint (); + } + + QSize minimumSizeHint () const override + { + QFontMetrics font_metrics {font (), nullptr}; + return {tick_length + text_indent + font_metrics.boundingRect ("00+").width (), (font_metrics.height () + line_spacing) * range}; + } + +protected: + void paintEvent (QPaintEvent * event) override + { + QWidget::paintEvent (event); + + QPainter p {this}; + auto const& target = contentsRect (); + QFontMetrics font_metrics {p.font (), this}; + auto font_offset = font_metrics.ascent () / 2; + p.drawLine (target.left (), target.top () + font_offset, target.left (), target.bottom () - font_offset - font_metrics.descent ()); + for (int i = 0; i <= range; ++i) + { + p.save (); + p.translate (target.left () + , target.top () + font_offset + i * (target.height () - font_metrics.ascent () - font_metrics.descent ()) / range); + p.drawLine (0, 0, tick_length, 0); + if((i%2==1)) { + auto text = QString::number ((range - i) * scale); + p.drawText (tick_length + text_indent, font_offset, text); + } + p.restore (); + } + } + +private: + static int constexpr tick_length {4}; + static int constexpr text_indent {2}; + static int constexpr line_spacing {0}; + static int constexpr range {MAXDB/10}; + static int constexpr scale {10}; +}; + +SignalMeter::SignalMeter (QWidget * parent) + : QFrame {parent} +{ + auto outer_layout = new QVBoxLayout; + outer_layout->setSpacing (0); + + auto inner_layout = new QHBoxLayout; + inner_layout->setContentsMargins (0, 0, 0, 0); + inner_layout->setSpacing (0); + + m_meter = new MeterWidget; + m_meter->setSizePolicy (QSizePolicy::Minimum, QSizePolicy::Minimum); + inner_layout->addWidget (m_meter); + + m_scale = new Scale; + inner_layout->addWidget (m_scale); + + m_reading = new QLabel(this); + + outer_layout->addLayout (inner_layout); + outer_layout->addWidget (m_reading); + setLayout (outer_layout); +} + +void SignalMeter::setValue(float value, float valueMax) +{ + if(value<0) value=0; + QFontMetrics font_metrics {m_scale->font (), nullptr}; + m_meter->setContentsMargins (0, font_metrics.ascent () / 2, 0, font_metrics.ascent () / 2 + font_metrics.descent ()); + m_meter->setValue(int(value)); + m_meter->set_sigPeak(valueMax); + QString t; + t = t.asprintf("%d dB",int(value+0.5)); + m_reading->setText(t); +} diff --git a/widgets/signalmeter.h b/widgets/signalmeter.h index 3cbe856e..bf277ebd 100755..100644 --- a/widgets/signalmeter.h +++ b/widgets/signalmeter.h @@ -1,27 +1,27 @@ -// -*- Mode: C++ -*-
-#ifndef SIGNALMETER_H
-#define SIGNALMETER_H
-
-#include <QFrame>
-
-class QLabel;
-class MeterWidget;
-
-class SignalMeter final
- : public QFrame
-{
- Q_OBJECT
-
-public:
- explicit SignalMeter (QWidget * parent = nullptr);
-
-public slots:
- void setValue (float value, float valueMax);
-
-private:
- MeterWidget * m_meter;
- QWidget * m_scale;
- QLabel * m_reading;
-};
-
-#endif // SIGNALMETER_H
+// -*- Mode: C++ -*- +#ifndef SIGNALMETER_H +#define SIGNALMETER_H + +#include <QFrame> + +class QLabel; +class MeterWidget; + +class SignalMeter final + : public QFrame +{ + Q_OBJECT + +public: + explicit SignalMeter (QWidget * parent = nullptr); + +public slots: + void setValue (float value, float valueMax); + +private: + MeterWidget * m_meter; + QWidget * m_scale; + QLabel * m_reading; +}; + +#endif // SIGNALMETER_H diff --git a/widgets/widegraph.cpp b/widgets/widegraph.cpp index 512ffd18..2bdef6bd 100755..100644 --- a/widgets/widegraph.cpp +++ b/widgets/widegraph.cpp @@ -1,608 +1,608 @@ -#include "widegraph.h"
-
-#include <algorithm>
-#include <QApplication>
-#include <QSettings>
-#include <QDateTime>
-#include <QKeyEvent>
-#include <math.h>
-#include "ui_widegraph.h"
-#include "commons.h"
-#include "Configuration.hpp"
-#include "MessageBox.hpp"
-#include "SettingsGroup.hpp"
-#include "moc_widegraph.cpp"
-
-WideGraph::WideGraph(QSettings * settings, QWidget *parent) :
- QDialog(parent),
- ui(new Ui::WideGraph),
- m_settings (settings),
- m_palettes_path {":/Palettes"},
- m_tr0 {0.0},
- m_n {0},
- m_bHaveTransmitted {false},
- m_user_defined {tr ("User Defined")}
-{
- ui->setupUi(this);
-
- setWindowTitle (QApplication::applicationName () + " - " + tr ("Wide Graph"));
- setWindowFlags (Qt::WindowCloseButtonHint | Qt::WindowMinimizeButtonHint);
- setMaximumWidth (MAX_SCREENSIZE);
- setMaximumHeight (880);
-
- ui->widePlot->setCursor(Qt::CrossCursor);
- ui->widePlot->setMaximumHeight(800);
- ui->widePlot->setCurrent(false);
- ui->cbControls->setCursor(Qt::ArrowCursor);
- ui->cbBars->setCursor(Qt::ArrowCursor);
-
- connect(ui->widePlot, SIGNAL(freezeDecode1(int)),this,
- SLOT(wideFreezeDecode(int)));
-
- connect(ui->widePlot, SIGNAL(setFreq1(int,int)),this,
- SLOT(setFreq2(int,int)));
-
- {
- //Restore user's settings
- SettingsGroup g {m_settings, "WideGraph"};
- restoreGeometry (m_settings->value ("geometry", saveGeometry ()).toByteArray ());
- ui->widePlot->setPlotZero(m_settings->value("PlotZero", 0).toInt());
- ui->widePlot->setPlotGain(m_settings->value("PlotGain", 0).toInt());
- ui->widePlot->setPlot2dGain(m_settings->value("Plot2dGain", 0).toInt());
- ui->widePlot->setPlot2dZero(m_settings->value("Plot2dZero", 0).toInt());
- ui->zeroSlider->setValue(ui->widePlot->plotZero());
- ui->gainSlider->setValue(ui->widePlot->plotGain());
- ui->gain2dSlider->setValue(ui->widePlot->plot2dGain());
- ui->zero2dSlider->setValue(ui->widePlot->plot2dZero());
- m_timestamp = 1; int itstamp=m_settings->value("Timestamp",1).toInt();
- QString ststamp=m_settings->value("Timestamp","1").toString();
- if(ststamp == "0" || ststamp == "1" || ststamp == "2") m_timestamp = itstamp;
- ui->timestampComboBox->setCurrentIndex(m_timestamp); ui->widePlot->setTimestamp(m_timestamp);
- m_bars=m_settings->value("Bars",true).toBool();
- ui->cbBars->setChecked(m_bars);
- ui->widePlot->setBars(m_bars);
- m_freq=m_settings->value("Freq",true).toBool();
- ui->cbFreq->setChecked(m_freq);
- ui->widePlot->showFreq(m_freq);
- int n = m_settings->value("BinsPerPixel",5).toInt();
- m_bFlatten=m_settings->value("Flatten",true).toBool();
- m_bRef=m_settings->value("UseRef",false).toBool();
- ui->cbFlatten->setChecked(m_bFlatten);
- ui->widePlot->setFlatten(m_bFlatten,m_bRef);
- ui->cbRef->setChecked(m_bRef);
- ui->widePlot->setBreadth(m_settings->value("PlotWidth",1000).toInt());
- ui->bppSpinBox->setValue(n);
- m_nsmo=m_settings->value("SmoothYellow",1).toInt();
- ui->smoSpinBox->setValue(m_nsmo);
- m_Percent2DScreen=m_settings->value("Percent2D",30).toInt();
- m_waterfallAvg = m_settings->value("WaterfallAvg",2).toInt();
- ui->waterfallAvgSpinBox->setValue(m_waterfallAvg);
- ui->widePlot->setWaterfallAvg(m_waterfallAvg);
- ui->widePlot->setCurrent(m_settings->value("Current",false).toBool());
- ui->widePlot->setCumulative(m_settings->value("Cumulative",true).toBool());
- ui->widePlot->setLinearAvg(m_settings->value("LinearAvg",false).toBool());
- ui->widePlot->setReference(m_settings->value("Reference",false).toBool());
- ui->widePlot->setQ65_Sync(m_settings->value("Q65_Sync",false).toBool());
- ui->widePlot->setTotalPower(m_settings->value("TotalPower",false).toBool());
- if(ui->widePlot->current()) ui->spec2dComboBox->setCurrentIndex(0);
- if(ui->widePlot->cumulative()) ui->spec2dComboBox->setCurrentIndex(1);
- if(ui->widePlot->linearAvg()) ui->spec2dComboBox->setCurrentIndex(2);
- if(ui->widePlot->Reference()) ui->spec2dComboBox->setCurrentIndex(3);
- if(ui->widePlot->Q65_Sync()) ui->spec2dComboBox->setCurrentIndex(4);
- if(ui->widePlot->TotalPower()) ui->spec2dComboBox->setCurrentIndex(5);
- int nbpp=m_settings->value("BinsPerPixel",4).toInt();
- ui->widePlot->setBinsPerPixel(nbpp);
- ui->sbPercent2dPlot->setValue(m_Percent2DScreen);
- ui->widePlot->setStartFreq(m_settings->value("StartFreq",0).toInt());
- ui->fStartSpinBox->setValue(ui->widePlot->startFreq());
- m_waterfallPalette=m_settings->value("WaterfallPalette","Default").toString();
- m_userPalette = WFPalette {m_settings->value("UserPalette").value<WFPalette::Colours> ()};
- m_fMinPerBand = m_settings->value ("FminPerBand").toHash ();
- setRxRange ();
- ui->controls_widget->setVisible(!m_settings->value("HideControls",false).toBool());
- ui->cbControls->setChecked(!m_settings->value("HideControls",false).toBool());
- }
-
- int index=0;
- for (QString const& file:
- m_palettes_path.entryList(QDir::NoDotAndDotDot |
- QDir::System | QDir::Hidden |
- QDir::AllDirs | QDir::Files,
- QDir::DirsFirst)) {
- QString t=file.mid(0,file.length()-4);
- ui->paletteComboBox->addItem(t);
- if(t==m_waterfallPalette) ui->paletteComboBox->setCurrentIndex(index);
- index++;
- }
- ui->paletteComboBox->addItem (m_user_defined);
- if (m_user_defined == m_waterfallPalette) ui->paletteComboBox->setCurrentIndex(index);
- readPalette ();
-}
-
-WideGraph::~WideGraph ()
-{
-}
-
-void WideGraph::closeEvent (QCloseEvent * e)
-{
- saveSettings ();
- QDialog::closeEvent (e);
-}
-
-void WideGraph::saveSettings() //saveSettings
-{
- SettingsGroup g {m_settings, "WideGraph"};
- m_settings->setValue ("geometry", saveGeometry ());
- m_settings->setValue ("PlotZero", ui->widePlot->plotZero());
- m_settings->setValue ("PlotGain", ui->widePlot->plotGain());
- m_settings->setValue ("Plot2dGain", ui->widePlot->plot2dGain());
- m_settings->setValue ("Plot2dZero", ui->widePlot->plot2dZero());
- m_settings->setValue ("PlotWidth", ui->widePlot->plotWidth ());
- m_settings->setValue ("BinsPerPixel", ui->bppSpinBox->value ());
- m_settings->setValue ("SmoothYellow", ui->smoSpinBox->value ());
- m_settings->setValue ("Percent2D",m_Percent2DScreen);
- m_settings->setValue ("WaterfallAvg", ui->waterfallAvgSpinBox->value ());
- m_settings->setValue ("Current", ui->widePlot->current());
- m_settings->setValue ("Cumulative", ui->widePlot->cumulative());
- m_settings->setValue ("LinearAvg", ui->widePlot->linearAvg());
- m_settings->setValue ("Reference", ui->widePlot->Reference());
- m_settings->setValue ("Q65_Sync", ui->widePlot->Q65_Sync());
- m_settings->setValue ("TotalPower", ui->widePlot->TotalPower());
- m_settings->setValue ("BinsPerPixel", ui->widePlot->binsPerPixel ());
- m_settings->setValue ("StartFreq", ui->widePlot->startFreq ());
- m_settings->setValue ("WaterfallPalette", m_waterfallPalette);
- m_settings->setValue ("UserPalette", QVariant::fromValue (m_userPalette.colours ()));
- m_settings->setValue("Flatten",m_bFlatten);
- m_settings->setValue("UseRef",m_bRef);
- m_settings->setValue ("HideControls", ui->controls_widget->isHidden ());
- m_settings->setValue ("Timestamp",m_timestamp);
- m_settings->setValue ("Bars", m_bars);
- m_settings->setValue ("Freq", m_freq);
- m_settings->setValue ("FminPerBand", m_fMinPerBand);
-}
-
-void WideGraph::drawRed(int ia, int ib)
-{
- ui->widePlot->drawRed(ia,ib,m_swide);
-}
-
-void WideGraph::dataSink2(float s[], float df3, int ihsym, int ndiskdata, float pdB) //dataSink2
-{
- static float splot[NSMAX];
- int nbpp = ui->widePlot->binsPerPixel();
-
- if(ui->widePlot->TotalPower()) ui->widePlot->drawTotalPower(pdB);
-//Average spectra over specified number, m_waterfallAvg
- if (m_n==0) {
- for (int i=0; i<NSMAX; i++)
- splot[i]=s[i];
- } else {
- for (int i=0; i<NSMAX; i++)
- splot[i] += s[i];
- }
- m_n++;
-
- if (m_n>=m_waterfallAvg) {
- for (int i=0; i<NSMAX; i++)
- splot[i] /= m_n; //Normalize the average
- m_n=0;
- int i=int(ui->widePlot->startFreq()/df3 + 0.5);
- int jz=5000.0/(nbpp*df3);
- if(jz>MAX_SCREENSIZE) jz=MAX_SCREENSIZE;
- m_jz=jz;
- for (int j=0; j<jz; j++) {
- float ss=0.0;
- float smax=0;
- for (int k=0; k<nbpp; k++) {
- float sp=splot[i++];
- ss += sp;
- smax=qMax(smax,sp);
- }
-// m_swide[j]=nbpp*smax;
- m_swide[j]=nbpp*ss;
- }
-
-// Time according to this computer
- qint64 ms = QDateTime::currentMSecsSinceEpoch() % 86400000;
- double tr = fmod(0.001*ms,m_TRperiod);
- if((ndiskdata && ihsym <= m_waterfallAvg) || (!ndiskdata && (tr<m_tr0))) {
- float flagValue=1.0e30;
- if(m_bHaveTransmitted) flagValue=2.0e30;
- for(int i=0; i<MAX_SCREENSIZE; i++) {
- m_swide[i] = flagValue;
- }
- for(int i=0; i<NSMAX; i++) {
- splot[i] = flagValue;
- }
- m_bHaveTransmitted=false;
- }
- m_tr0=tr;
- ui->widePlot->draw(m_swide,true,false);
- }
-}
-
-void WideGraph::on_bppSpinBox_valueChanged(int n) //bpp
-{
- ui->widePlot->setBinsPerPixel(n);
-}
-
-void WideGraph::on_waterfallAvgSpinBox_valueChanged(int n) //Navg
-{
- m_waterfallAvg = n;
- ui->widePlot->setWaterfallAvg(n);
-}
-
-void WideGraph::keyPressEvent(QKeyEvent *e) //F11, F12
-{
- switch(e->key())
- {
- int n;
- case Qt::Key_F11:
- n=11;
- if(e->modifiers() & Qt::ControlModifier) n+=100;
- emit f11f12(n);
- break;
- case Qt::Key_F12:
- n=12;
- if(e->modifiers() & Qt::ControlModifier) n+=100;
- emit f11f12(n);
- break;
- default:
- QDialog::keyPressEvent (e);
- }
-}
-
-void WideGraph::setRxFreq(int n) //setRxFreq
-{
- ui->widePlot->setRxFreq(n);
- if(m_mode!="Q65") ui->widePlot->draw(m_swide,false,false);
-}
-
-int WideGraph::rxFreq() //rxFreq
-{
- return ui->widePlot->rxFreq();
-}
-
-int WideGraph::nStartFreq() //nStartFreq
-{
- return ui->widePlot->startFreq();
-}
-
-void WideGraph::wideFreezeDecode(int n) //wideFreezeDecode
-{
- emit freezeDecode2(n);
-}
-
-void WideGraph::setRxRange ()
-{
- ui->widePlot->setRxRange (Fmin ());
- ui->widePlot->DrawOverlay();
- ui->widePlot->update();
-}
-
-int WideGraph::Fmin() //Fmin
-{
- return "60m" == m_rxBand ? 0 : m_fMinPerBand.value (m_rxBand, 2500).toUInt ();
-}
-
-int WideGraph::Fmax() //Fmax
-{
- return std::min(5000,ui->widePlot->Fmax());
-}
-
-int WideGraph::fSpan()
-{
- return ui->widePlot->fSpan ();
-}
-
-void WideGraph::setPeriod(double trperiod, int nsps) //SetPeriod
-{
- m_TRperiod=trperiod;
- m_nsps=nsps;
- ui->widePlot->setNsps(trperiod, nsps);
-}
-
-void WideGraph::setTxFreq(int n) //setTxFreq
-{
- emit setXIT2(n);
- ui->widePlot->setTxFreq(n);
-}
-
-void WideGraph::setMode(QString mode) //setMode
-{
- m_mode=mode;
- ui->fSplitSpinBox->setVisible(m_mode.startsWith("FST4"));
- ui->fSplitSpinBox->setEnabled(m_mode.startsWith("FST4"));
- ui->labTime->setVisible(!m_mode.startsWith("FST4"));
- ui->timestampComboBox->setVisible(!m_mode.startsWith("FST4"));
- ui->widePlot->setMode(mode);
- ui->widePlot->DrawOverlay();
- ui->widePlot->update();
-}
-
-void WideGraph::setSubMode(int n) //setSubMode
-{
- m_nSubMode=n;
- ui->widePlot->setSubMode(n);
- ui->widePlot->DrawOverlay();
- ui->widePlot->update();
-}
-
-void WideGraph::on_spec2dComboBox_currentIndexChanged(int index)
-{
- ui->widePlot->setCurrent(false);
- ui->widePlot->setCumulative(false);
- ui->widePlot->setLinearAvg(false);
- ui->widePlot->setReference(false);
- ui->widePlot->setQ65_Sync(false);
- ui->widePlot->setTotalPower(false);
- ui->smoSpinBox->setEnabled(false);
- switch (index)
- {
- case 0: // Current
- ui->widePlot->setCurrent(true);
- break;
- case 1: // Cumulative
- ui->widePlot->setCumulative(true);
- break;
- case 2: // Linear Avg
- ui->widePlot->setLinearAvg(true);
- ui->smoSpinBox->setEnabled(true);
- break;
- case 3: // Reference
- ui->widePlot->setReference(true);
- break;
- case 4:
- ui->widePlot->setQ65_Sync(true);
- break;
- case 5:
- ui->widePlot->setTotalPower(true);
- break;
- }
- replot();
-}
-
-void WideGraph::on_fSplitSpinBox_valueChanged(int n) //fSplit
-{
- if (m_rxBand != "60m") m_fMinPerBand[m_rxBand] = n;
- setRxRange ();
-}
-
-void WideGraph::setFreq2(int rxFreq, int txFreq) //setFreq2
-{
- emit setFreq3(rxFreq,txFreq);
-}
-
-void WideGraph::setDialFreq(double d) //setDialFreq
-{
- ui->widePlot->setDialFreq(d);
-}
-
-void WideGraph::setRxBand (QString const& band)
-{
- m_rxBand = band;
- if ("60m" == m_rxBand)
- {
- ui->fSplitSpinBox->setEnabled (false);
- ui->fSplitSpinBox->setValue (0);
- }
- else
- {
- ui->fSplitSpinBox->setValue (m_fMinPerBand.value (band, 2500).toUInt ());
- ui->fSplitSpinBox->setEnabled (m_mode.startsWith("FST4"));
- }
- ui->widePlot->setRxBand(band);
- setRxRange ();
-}
-
-
-void WideGraph::on_fStartSpinBox_valueChanged(int n) //fStart
-{
- ui->widePlot->setStartFreq(n);
-}
-
-void WideGraph::readPalette () //readPalette
-{
- try
- {
- if (m_user_defined == m_waterfallPalette)
- {
- ui->widePlot->setColours (WFPalette {m_userPalette}.interpolate ());
- }
- else
- {
- ui->widePlot->setColours (WFPalette {m_palettes_path.absoluteFilePath (m_waterfallPalette + ".pal")}.interpolate());
- }
- }
- catch (std::exception const& e)
- {
- MessageBox::warning_message (this, tr ("Read Palette"), e.what ());
- }
-}
-
-void WideGraph::on_paletteComboBox_activated (QString const& palette) //palette selector
-{
- m_waterfallPalette = palette;
- readPalette();
- replot();
-}
-
-void WideGraph::on_cbFlatten_toggled(bool b) //Flatten On/Off
-{
- m_bFlatten=b;
- if(m_bRef and m_bFlatten) {
- m_bRef=false;
- ui->cbRef->setChecked(false);
- }
- ui->widePlot->setFlatten(m_bFlatten,m_bRef);
-}
-
-void WideGraph::on_cbRef_toggled(bool b)
-{
- m_bRef=b;
- if(m_bRef and m_bFlatten) {
- m_bFlatten=false;
- ui->cbFlatten->setChecked(false);
- }
- ui->widePlot->setFlatten(m_bFlatten,m_bRef);
-}
-
-void WideGraph::on_cbControls_toggled(bool b)
-{
- ui->controls_widget->setVisible(b);
-}
-
-void WideGraph::on_timestampComboBox_currentIndexChanged(int n)
-{
- m_timestamp = n;
- ui->widePlot->setTimestamp(n);
-}
-
-void WideGraph::on_cbBars_toggled(bool b)
-{
- m_bars = b;
- ui->widePlot->setBars(m_bars);
-}
-
-void WideGraph::on_cbFreq_toggled(bool b)
-{
- m_freq = b;
- ui->widePlot->showFreq(m_freq);
-}
-
-void WideGraph::on_adjust_palette_push_button_clicked (bool) //Adjust Palette
-{
- try
- {
- if (m_userPalette.design ())
- {
- m_waterfallPalette = m_user_defined;
- ui->paletteComboBox->setCurrentText (m_waterfallPalette);
- readPalette ();
- }
- }
- catch (std::exception const& e)
- {
- MessageBox::warning_message (this, tr ("Read Palette"), e.what ());
- }
-}
-
-bool WideGraph::flatten() //Flatten
-{
- return m_bFlatten;
-}
-
-bool WideGraph::useRef() //Flatten
-{
- return m_bRef;
-}
-
-void WideGraph::replot()
-{
- if(ui->widePlot->scaleOK()) ui->widePlot->replot();
-}
-
-void WideGraph::on_gainSlider_valueChanged(int value) //Gain
-{
- ui->widePlot->setPlotGain(value);
- replot();
-}
-
-void WideGraph::on_zeroSlider_valueChanged(int value) //Zero
-{
- ui->widePlot->setPlotZero(value);
- replot();
-}
-
-void WideGraph::on_gain2dSlider_valueChanged(int value) //Gain2
-{
- ui->widePlot->setPlot2dGain(value);
- if(ui->widePlot->TotalPower()) return;
- if(ui->widePlot->scaleOK ()) {
- ui->widePlot->draw(m_swide,false,false);
- if(m_mode=="Q65") ui->widePlot->draw(m_swide,false,true);
- }
-}
-
-void WideGraph::on_zero2dSlider_valueChanged(int value) //Zero2
-{
- ui->widePlot->setPlot2dZero(value);
- if(ui->widePlot->TotalPower()) return;
- if(ui->widePlot->scaleOK ()) {
- ui->widePlot->draw(m_swide,false,false);
- if(m_mode=="Q65") ui->widePlot->draw(m_swide,false,true);
- }
-}
-
-void WideGraph::setSuperFox(bool b)
-{
- ui->widePlot->setSuperFox(b);
-}
-
-void WideGraph::setSuperHound(bool b)
-{
- ui->widePlot->setSuperHound(b);
-}
-
-void WideGraph::setTol(int n) //setTol
-{
- ui->widePlot->setTol(n);
- ui->widePlot->DrawOverlay();
- ui->widePlot->update();
-}
-
-void WideGraph::setFST4_FreqRange(int fLow,int fHigh)
-{
- ui->widePlot->setFST4_FreqRange(fLow,fHigh);
-}
-
-void WideGraph::setSingleDecode(bool b)
-{
- ui->widePlot->setSingleDecode(b);
-}
-
-void WideGraph::on_smoSpinBox_valueChanged(int n)
-{
- m_nsmo=n;
-}
-
-int WideGraph::smoothYellow()
-{
- return m_nsmo;
-}
-
-void WideGraph::setWSPRtransmitted()
-{
- m_bHaveTransmitted=true;
-}
-
-void WideGraph::setVHF(bool bVHF)
-{
- ui->widePlot->setVHF(bVHF);
-}
-
-void WideGraph::on_sbPercent2dPlot_valueChanged(int n)
-{
- m_Percent2DScreen=n;
- ui->widePlot->SetPercent2DScreen(n);
-}
-
-void WideGraph::setRedFile(QString fRed)
-{
- ui->widePlot->setRedFile(fRed);
-}
-
-void WideGraph::setDiskUTC(int nutc)
-{
- ui->widePlot->setDiskUTC(nutc);
-}
-
-void WideGraph::setDarkStyle(bool b)
-{
- ui->widePlot->setDarkStyle(b);
-}
-
-void WideGraph::restartTotalPower()
-{
- ui->widePlot->restartTotalPower();
-}
+#include "widegraph.h" + +#include <algorithm> +#include <QApplication> +#include <QSettings> +#include <QDateTime> +#include <QKeyEvent> +#include <math.h> +#include "ui_widegraph.h" +#include "commons.h" +#include "Configuration.hpp" +#include "MessageBox.hpp" +#include "SettingsGroup.hpp" +#include "moc_widegraph.cpp" + +WideGraph::WideGraph(QSettings * settings, QWidget *parent) : + QDialog(parent), + ui(new Ui::WideGraph), + m_settings (settings), + m_palettes_path {":/Palettes"}, + m_tr0 {0.0}, + m_n {0}, + m_bHaveTransmitted {false}, + m_user_defined {tr ("User Defined")} +{ + ui->setupUi(this); + + setWindowTitle (QApplication::applicationName () + " - " + tr ("Wide Graph")); + setWindowFlags (Qt::WindowCloseButtonHint | Qt::WindowMinimizeButtonHint); + setMaximumWidth (MAX_SCREENSIZE); + setMaximumHeight (880); + + ui->widePlot->setCursor(Qt::CrossCursor); + ui->widePlot->setMaximumHeight(800); + ui->widePlot->setCurrent(false); + ui->cbControls->setCursor(Qt::ArrowCursor); + ui->cbBars->setCursor(Qt::ArrowCursor); + + connect(ui->widePlot, SIGNAL(freezeDecode1(int)),this, + SLOT(wideFreezeDecode(int))); + + connect(ui->widePlot, SIGNAL(setFreq1(int,int)),this, + SLOT(setFreq2(int,int))); + + { + //Restore user's settings + SettingsGroup g {m_settings, "WideGraph"}; + restoreGeometry (m_settings->value ("geometry", saveGeometry ()).toByteArray ()); + ui->widePlot->setPlotZero(m_settings->value("PlotZero", 0).toInt()); + ui->widePlot->setPlotGain(m_settings->value("PlotGain", 0).toInt()); + ui->widePlot->setPlot2dGain(m_settings->value("Plot2dGain", 0).toInt()); + ui->widePlot->setPlot2dZero(m_settings->value("Plot2dZero", 0).toInt()); + ui->zeroSlider->setValue(ui->widePlot->plotZero()); + ui->gainSlider->setValue(ui->widePlot->plotGain()); + ui->gain2dSlider->setValue(ui->widePlot->plot2dGain()); + ui->zero2dSlider->setValue(ui->widePlot->plot2dZero()); + m_timestamp = 1; int itstamp=m_settings->value("Timestamp",1).toInt(); + QString ststamp=m_settings->value("Timestamp","1").toString(); + if(ststamp == "0" || ststamp == "1" || ststamp == "2") m_timestamp = itstamp; + ui->timestampComboBox->setCurrentIndex(m_timestamp); ui->widePlot->setTimestamp(m_timestamp); + m_bars=m_settings->value("Bars",true).toBool(); + ui->cbBars->setChecked(m_bars); + ui->widePlot->setBars(m_bars); + m_freq=m_settings->value("Freq",true).toBool(); + ui->cbFreq->setChecked(m_freq); + ui->widePlot->showFreq(m_freq); + int n = m_settings->value("BinsPerPixel",5).toInt(); + m_bFlatten=m_settings->value("Flatten",true).toBool(); + m_bRef=m_settings->value("UseRef",false).toBool(); + ui->cbFlatten->setChecked(m_bFlatten); + ui->widePlot->setFlatten(m_bFlatten,m_bRef); + ui->cbRef->setChecked(m_bRef); + ui->widePlot->setBreadth(m_settings->value("PlotWidth",1000).toInt()); + ui->bppSpinBox->setValue(n); + m_nsmo=m_settings->value("SmoothYellow",1).toInt(); + ui->smoSpinBox->setValue(m_nsmo); + m_Percent2DScreen=m_settings->value("Percent2D",30).toInt(); + m_waterfallAvg = m_settings->value("WaterfallAvg",2).toInt(); + ui->waterfallAvgSpinBox->setValue(m_waterfallAvg); + ui->widePlot->setWaterfallAvg(m_waterfallAvg); + ui->widePlot->setCurrent(m_settings->value("Current",false).toBool()); + ui->widePlot->setCumulative(m_settings->value("Cumulative",true).toBool()); + ui->widePlot->setLinearAvg(m_settings->value("LinearAvg",false).toBool()); + ui->widePlot->setReference(m_settings->value("Reference",false).toBool()); + ui->widePlot->setQ65_Sync(m_settings->value("Q65_Sync",false).toBool()); + ui->widePlot->setTotalPower(m_settings->value("TotalPower",false).toBool()); + if(ui->widePlot->current()) ui->spec2dComboBox->setCurrentIndex(0); + if(ui->widePlot->cumulative()) ui->spec2dComboBox->setCurrentIndex(1); + if(ui->widePlot->linearAvg()) ui->spec2dComboBox->setCurrentIndex(2); + if(ui->widePlot->Reference()) ui->spec2dComboBox->setCurrentIndex(3); + if(ui->widePlot->Q65_Sync()) ui->spec2dComboBox->setCurrentIndex(4); + if(ui->widePlot->TotalPower()) ui->spec2dComboBox->setCurrentIndex(5); + int nbpp=m_settings->value("BinsPerPixel",4).toInt(); + ui->widePlot->setBinsPerPixel(nbpp); + ui->sbPercent2dPlot->setValue(m_Percent2DScreen); + ui->widePlot->setStartFreq(m_settings->value("StartFreq",0).toInt()); + ui->fStartSpinBox->setValue(ui->widePlot->startFreq()); + m_waterfallPalette=m_settings->value("WaterfallPalette","Default").toString(); + m_userPalette = WFPalette {m_settings->value("UserPalette").value<WFPalette::Colours> ()}; + m_fMinPerBand = m_settings->value ("FminPerBand").toHash (); + setRxRange (); + ui->controls_widget->setVisible(!m_settings->value("HideControls",false).toBool()); + ui->cbControls->setChecked(!m_settings->value("HideControls",false).toBool()); + } + + int index=0; + for (QString const& file: + m_palettes_path.entryList(QDir::NoDotAndDotDot | + QDir::System | QDir::Hidden | + QDir::AllDirs | QDir::Files, + QDir::DirsFirst)) { + QString t=file.mid(0,file.length()-4); + ui->paletteComboBox->addItem(t); + if(t==m_waterfallPalette) ui->paletteComboBox->setCurrentIndex(index); + index++; + } + ui->paletteComboBox->addItem (m_user_defined); + if (m_user_defined == m_waterfallPalette) ui->paletteComboBox->setCurrentIndex(index); + readPalette (); +} + +WideGraph::~WideGraph () +{ +} + +void WideGraph::closeEvent (QCloseEvent * e) +{ + saveSettings (); + QDialog::closeEvent (e); +} + +void WideGraph::saveSettings() //saveSettings +{ + SettingsGroup g {m_settings, "WideGraph"}; + m_settings->setValue ("geometry", saveGeometry ()); + m_settings->setValue ("PlotZero", ui->widePlot->plotZero()); + m_settings->setValue ("PlotGain", ui->widePlot->plotGain()); + m_settings->setValue ("Plot2dGain", ui->widePlot->plot2dGain()); + m_settings->setValue ("Plot2dZero", ui->widePlot->plot2dZero()); + m_settings->setValue ("PlotWidth", ui->widePlot->plotWidth ()); + m_settings->setValue ("BinsPerPixel", ui->bppSpinBox->value ()); + m_settings->setValue ("SmoothYellow", ui->smoSpinBox->value ()); + m_settings->setValue ("Percent2D",m_Percent2DScreen); + m_settings->setValue ("WaterfallAvg", ui->waterfallAvgSpinBox->value ()); + m_settings->setValue ("Current", ui->widePlot->current()); + m_settings->setValue ("Cumulative", ui->widePlot->cumulative()); + m_settings->setValue ("LinearAvg", ui->widePlot->linearAvg()); + m_settings->setValue ("Reference", ui->widePlot->Reference()); + m_settings->setValue ("Q65_Sync", ui->widePlot->Q65_Sync()); + m_settings->setValue ("TotalPower", ui->widePlot->TotalPower()); + m_settings->setValue ("BinsPerPixel", ui->widePlot->binsPerPixel ()); + m_settings->setValue ("StartFreq", ui->widePlot->startFreq ()); + m_settings->setValue ("WaterfallPalette", m_waterfallPalette); + m_settings->setValue ("UserPalette", QVariant::fromValue (m_userPalette.colours ())); + m_settings->setValue("Flatten",m_bFlatten); + m_settings->setValue("UseRef",m_bRef); + m_settings->setValue ("HideControls", ui->controls_widget->isHidden ()); + m_settings->setValue ("Timestamp",m_timestamp); + m_settings->setValue ("Bars", m_bars); + m_settings->setValue ("Freq", m_freq); + m_settings->setValue ("FminPerBand", m_fMinPerBand); +} + +void WideGraph::drawRed(int ia, int ib) +{ + ui->widePlot->drawRed(ia,ib,m_swide); +} + +void WideGraph::dataSink2(float s[], float df3, int ihsym, int ndiskdata, float pdB) //dataSink2 +{ + static float splot[NSMAX]; + int nbpp = ui->widePlot->binsPerPixel(); + + if(ui->widePlot->TotalPower()) ui->widePlot->drawTotalPower(pdB); +//Average spectra over specified number, m_waterfallAvg + if (m_n==0) { + for (int i=0; i<NSMAX; i++) + splot[i]=s[i]; + } else { + for (int i=0; i<NSMAX; i++) + splot[i] += s[i]; + } + m_n++; + + if (m_n>=m_waterfallAvg) { + for (int i=0; i<NSMAX; i++) + splot[i] /= m_n; //Normalize the average + m_n=0; + int i=int(ui->widePlot->startFreq()/df3 + 0.5); + int jz=5000.0/(nbpp*df3); + if(jz>MAX_SCREENSIZE) jz=MAX_SCREENSIZE; + m_jz=jz; + for (int j=0; j<jz; j++) { + float ss=0.0; + float smax=0; + for (int k=0; k<nbpp; k++) { + float sp=splot[i++]; + ss += sp; + smax=qMax(smax,sp); + } +// m_swide[j]=nbpp*smax; + m_swide[j]=nbpp*ss; + } + +// Time according to this computer + qint64 ms = QDateTime::currentMSecsSinceEpoch() % 86400000; + double tr = fmod(0.001*ms,m_TRperiod); + if((ndiskdata && ihsym <= m_waterfallAvg) || (!ndiskdata && (tr<m_tr0))) { + float flagValue=1.0e30; + if(m_bHaveTransmitted) flagValue=2.0e30; + for(int i=0; i<MAX_SCREENSIZE; i++) { + m_swide[i] = flagValue; + } + for(int i=0; i<NSMAX; i++) { + splot[i] = flagValue; + } + m_bHaveTransmitted=false; + } + m_tr0=tr; + ui->widePlot->draw(m_swide,true,false); + } +} + +void WideGraph::on_bppSpinBox_valueChanged(int n) //bpp +{ + ui->widePlot->setBinsPerPixel(n); +} + +void WideGraph::on_waterfallAvgSpinBox_valueChanged(int n) //Navg +{ + m_waterfallAvg = n; + ui->widePlot->setWaterfallAvg(n); +} + +void WideGraph::keyPressEvent(QKeyEvent *e) //F11, F12 +{ + switch(e->key()) + { + int n; + case Qt::Key_F11: + n=11; + if(e->modifiers() & Qt::ControlModifier) n+=100; + emit f11f12(n); + break; + case Qt::Key_F12: + n=12; + if(e->modifiers() & Qt::ControlModifier) n+=100; + emit f11f12(n); + break; + default: + QDialog::keyPressEvent (e); + } +} + +void WideGraph::setRxFreq(int n) //setRxFreq +{ + ui->widePlot->setRxFreq(n); + if(m_mode!="Q65") ui->widePlot->draw(m_swide,false,false); +} + +int WideGraph::rxFreq() //rxFreq +{ + return ui->widePlot->rxFreq(); +} + +int WideGraph::nStartFreq() //nStartFreq +{ + return ui->widePlot->startFreq(); +} + +void WideGraph::wideFreezeDecode(int n) //wideFreezeDecode +{ + emit freezeDecode2(n); +} + +void WideGraph::setRxRange () +{ + ui->widePlot->setRxRange (Fmin ()); + ui->widePlot->DrawOverlay(); + ui->widePlot->update(); +} + +int WideGraph::Fmin() //Fmin +{ + return "60m" == m_rxBand ? 0 : m_fMinPerBand.value (m_rxBand, 2500).toUInt (); +} + +int WideGraph::Fmax() //Fmax +{ + return std::min(5000,ui->widePlot->Fmax()); +} + +int WideGraph::fSpan() +{ + return ui->widePlot->fSpan (); +} + +void WideGraph::setPeriod(double trperiod, int nsps) //SetPeriod +{ + m_TRperiod=trperiod; + m_nsps=nsps; + ui->widePlot->setNsps(trperiod, nsps); +} + +void WideGraph::setTxFreq(int n) //setTxFreq +{ + emit setXIT2(n); + ui->widePlot->setTxFreq(n); +} + +void WideGraph::setMode(QString mode) //setMode +{ + m_mode=mode; + ui->fSplitSpinBox->setVisible(m_mode.startsWith("FST4")); + ui->fSplitSpinBox->setEnabled(m_mode.startsWith("FST4")); + ui->labTime->setVisible(!m_mode.startsWith("FST4")); + ui->timestampComboBox->setVisible(!m_mode.startsWith("FST4")); + ui->widePlot->setMode(mode); + ui->widePlot->DrawOverlay(); + ui->widePlot->update(); +} + +void WideGraph::setSubMode(int n) //setSubMode +{ + m_nSubMode=n; + ui->widePlot->setSubMode(n); + ui->widePlot->DrawOverlay(); + ui->widePlot->update(); +} + +void WideGraph::on_spec2dComboBox_currentIndexChanged(int index) +{ + ui->widePlot->setCurrent(false); + ui->widePlot->setCumulative(false); + ui->widePlot->setLinearAvg(false); + ui->widePlot->setReference(false); + ui->widePlot->setQ65_Sync(false); + ui->widePlot->setTotalPower(false); + ui->smoSpinBox->setEnabled(false); + switch (index) + { + case 0: // Current + ui->widePlot->setCurrent(true); + break; + case 1: // Cumulative + ui->widePlot->setCumulative(true); + break; + case 2: // Linear Avg + ui->widePlot->setLinearAvg(true); + ui->smoSpinBox->setEnabled(true); + break; + case 3: // Reference + ui->widePlot->setReference(true); + break; + case 4: + ui->widePlot->setQ65_Sync(true); + break; + case 5: + ui->widePlot->setTotalPower(true); + break; + } + replot(); +} + +void WideGraph::on_fSplitSpinBox_valueChanged(int n) //fSplit +{ + if (m_rxBand != "60m") m_fMinPerBand[m_rxBand] = n; + setRxRange (); +} + +void WideGraph::setFreq2(int rxFreq, int txFreq) //setFreq2 +{ + emit setFreq3(rxFreq,txFreq); +} + +void WideGraph::setDialFreq(double d) //setDialFreq +{ + ui->widePlot->setDialFreq(d); +} + +void WideGraph::setRxBand (QString const& band) +{ + m_rxBand = band; + if ("60m" == m_rxBand) + { + ui->fSplitSpinBox->setEnabled (false); + ui->fSplitSpinBox->setValue (0); + } + else + { + ui->fSplitSpinBox->setValue (m_fMinPerBand.value (band, 2500).toUInt ()); + ui->fSplitSpinBox->setEnabled (m_mode.startsWith("FST4")); + } + ui->widePlot->setRxBand(band); + setRxRange (); +} + + +void WideGraph::on_fStartSpinBox_valueChanged(int n) //fStart +{ + ui->widePlot->setStartFreq(n); +} + +void WideGraph::readPalette () //readPalette +{ + try + { + if (m_user_defined == m_waterfallPalette) + { + ui->widePlot->setColours (WFPalette {m_userPalette}.interpolate ()); + } + else + { + ui->widePlot->setColours (WFPalette {m_palettes_path.absoluteFilePath (m_waterfallPalette + ".pal")}.interpolate()); + } + } + catch (std::exception const& e) + { + MessageBox::warning_message (this, tr ("Read Palette"), e.what ()); + } +} + +void WideGraph::on_paletteComboBox_activated (QString const& palette) //palette selector +{ + m_waterfallPalette = palette; + readPalette(); + replot(); +} + +void WideGraph::on_cbFlatten_toggled(bool b) //Flatten On/Off +{ + m_bFlatten=b; + if(m_bRef and m_bFlatten) { + m_bRef=false; + ui->cbRef->setChecked(false); + } + ui->widePlot->setFlatten(m_bFlatten,m_bRef); +} + +void WideGraph::on_cbRef_toggled(bool b) +{ + m_bRef=b; + if(m_bRef and m_bFlatten) { + m_bFlatten=false; + ui->cbFlatten->setChecked(false); + } + ui->widePlot->setFlatten(m_bFlatten,m_bRef); +} + +void WideGraph::on_cbControls_toggled(bool b) +{ + ui->controls_widget->setVisible(b); +} + +void WideGraph::on_timestampComboBox_currentIndexChanged(int n) +{ + m_timestamp = n; + ui->widePlot->setTimestamp(n); +} + +void WideGraph::on_cbBars_toggled(bool b) +{ + m_bars = b; + ui->widePlot->setBars(m_bars); +} + +void WideGraph::on_cbFreq_toggled(bool b) +{ + m_freq = b; + ui->widePlot->showFreq(m_freq); +} + +void WideGraph::on_adjust_palette_push_button_clicked (bool) //Adjust Palette +{ + try + { + if (m_userPalette.design ()) + { + m_waterfallPalette = m_user_defined; + ui->paletteComboBox->setCurrentText (m_waterfallPalette); + readPalette (); + } + } + catch (std::exception const& e) + { + MessageBox::warning_message (this, tr ("Read Palette"), e.what ()); + } +} + +bool WideGraph::flatten() //Flatten +{ + return m_bFlatten; +} + +bool WideGraph::useRef() //Flatten +{ + return m_bRef; +} + +void WideGraph::replot() +{ + if(ui->widePlot->scaleOK()) ui->widePlot->replot(); +} + +void WideGraph::on_gainSlider_valueChanged(int value) //Gain +{ + ui->widePlot->setPlotGain(value); + replot(); +} + +void WideGraph::on_zeroSlider_valueChanged(int value) //Zero +{ + ui->widePlot->setPlotZero(value); + replot(); +} + +void WideGraph::on_gain2dSlider_valueChanged(int value) //Gain2 +{ + ui->widePlot->setPlot2dGain(value); + if(ui->widePlot->TotalPower()) return; + if(ui->widePlot->scaleOK ()) { + ui->widePlot->draw(m_swide,false,false); + if(m_mode=="Q65") ui->widePlot->draw(m_swide,false,true); + } +} + +void WideGraph::on_zero2dSlider_valueChanged(int value) //Zero2 +{ + ui->widePlot->setPlot2dZero(value); + if(ui->widePlot->TotalPower()) return; + if(ui->widePlot->scaleOK ()) { + ui->widePlot->draw(m_swide,false,false); + if(m_mode=="Q65") ui->widePlot->draw(m_swide,false,true); + } +} + +void WideGraph::setSuperFox(bool b) +{ + ui->widePlot->setSuperFox(b); +} + +void WideGraph::setSuperHound(bool b) +{ + ui->widePlot->setSuperHound(b); +} + +void WideGraph::setTol(int n) //setTol +{ + ui->widePlot->setTol(n); + ui->widePlot->DrawOverlay(); + ui->widePlot->update(); +} + +void WideGraph::setFST4_FreqRange(int fLow,int fHigh) +{ + ui->widePlot->setFST4_FreqRange(fLow,fHigh); +} + +void WideGraph::setSingleDecode(bool b) +{ + ui->widePlot->setSingleDecode(b); +} + +void WideGraph::on_smoSpinBox_valueChanged(int n) +{ + m_nsmo=n; +} + +int WideGraph::smoothYellow() +{ + return m_nsmo; +} + +void WideGraph::setWSPRtransmitted() +{ + m_bHaveTransmitted=true; +} + +void WideGraph::setVHF(bool bVHF) +{ + ui->widePlot->setVHF(bVHF); +} + +void WideGraph::on_sbPercent2dPlot_valueChanged(int n) +{ + m_Percent2DScreen=n; + ui->widePlot->SetPercent2DScreen(n); +} + +void WideGraph::setRedFile(QString fRed) +{ + ui->widePlot->setRedFile(fRed); +} + +void WideGraph::setDiskUTC(int nutc) +{ + ui->widePlot->setDiskUTC(nutc); +} + +void WideGraph::setDarkStyle(bool b) +{ + ui->widePlot->setDarkStyle(b); +} + +void WideGraph::restartTotalPower() +{ + ui->widePlot->restartTotalPower(); +} diff --git a/widgets/widegraph.h b/widgets/widegraph.h index 58237089..2b19dc98 100755..100644 --- a/widgets/widegraph.h +++ b/widgets/widegraph.h @@ -1,133 +1,133 @@ -// -*- Mode: C++ -*-
-#ifndef WIDEGRAPH_H_
-#define WIDEGRAPH_H_
-
-#include <QDialog>
-#include <QScopedPointer>
-#include <QDir>
-#include <QHash>
-#include <QVariant>
-#include "WFPalette.hpp"
-
-#define MAX_SCREENSIZE 2048
-
-namespace Ui {
- class WideGraph;
-}
-
-class QSettings;
-class Configuration;
-
-class WideGraph : public QDialog
-{
- Q_OBJECT
-
-public:
- explicit WideGraph(QSettings *, QWidget *parent = 0);
- ~WideGraph ();
-
- void dataSink2(float s[], float df3, int ihsym, int ndiskdata, float pdB);
- void setRxFreq(int n);
- int rxFreq();
- int nStartFreq();
- int Fmin();
- int Fmax();
- int fSpan();
- void saveSettings();
- void setFsample(int n);
- void setPeriod(double trperiod, int nsps);
- void setTxFreq(int n);
- void setMode(QString mode);
- void setSubMode(int n);
- bool flatten();
- bool useRef();
- void setTol(int n);
- void setSuperFox(bool b);
- void setSuperHound(bool b);
- int smoothYellow();
- void setRxBand (QString const& band);
- void setWSPRtransmitted();
- void drawRed(int ia, int ib);
- void setVHF(bool bVHF);
- void setRedFile(QString fRed);
- void setFST4_FreqRange(int fLow,int fHigh);
- void setSingleDecode(bool b);
- void setDiskUTC(int nutc);
- void restartTotalPower();
- void setDarkStyle(bool b);
-
-signals:
- void freezeDecode2(int n);
- void f11f12(int n);
- void setXIT2(int n);
- void setFreq3(int rxFreq, int txFreq);
-
-public slots:
- void wideFreezeDecode(int n);
- void setFreq2(int rxFreq, int txFreq);
- void setDialFreq(double d);
-
-protected:
- void keyPressEvent (QKeyEvent *e) override;
- void closeEvent (QCloseEvent *) override;
-
-private slots:
- void on_waterfallAvgSpinBox_valueChanged(int arg1);
- void on_bppSpinBox_valueChanged(int arg1);
- void on_spec2dComboBox_currentIndexChanged(int);
- void on_fSplitSpinBox_valueChanged(int n);
- void on_fStartSpinBox_valueChanged(int n);
- void on_paletteComboBox_activated(const QString &palette);
- void on_timestampComboBox_currentIndexChanged(int n);
- void on_cbFlatten_toggled(bool b);
- void on_cbRef_toggled(bool b);
- void on_cbControls_toggled(bool b);
- void on_cbBars_toggled(bool b);
- void on_cbFreq_toggled(bool b);
- void on_adjust_palette_push_button_clicked (bool);
- void on_gainSlider_valueChanged(int value);
- void on_zeroSlider_valueChanged(int value);
- void on_gain2dSlider_valueChanged(int value);
- void on_zero2dSlider_valueChanged(int value);
- void on_smoSpinBox_valueChanged(int n);
- void on_sbPercent2dPlot_valueChanged(int n);
-
-private:
- void readPalette ();
- void setRxRange ();
- void replot();
-
- QScopedPointer<Ui::WideGraph> ui;
-
- QSettings * m_settings;
- QDir m_palettes_path;
- WFPalette m_userPalette;
- QHash<QString, QVariant> m_fMinPerBand;
-
- double m_tr0;
- double m_TRperiod;
-
- qint32 m_waterfallAvg;
- qint32 m_nsps;
- qint32 m_fMax;
- qint32 m_nSubMode;
- qint32 m_nsmo;
- qint32 m_Percent2DScreen;
- qint32 m_jz=MAX_SCREENSIZE;
- qint32 m_n;
- qint32 m_timestamp;
-
- bool m_bars;
- bool m_freq;
- bool m_bFlatten;
- bool m_bRef;
- bool m_bHaveTransmitted; //Set true at end of a WSPR or FT4 transmission
-
- QString m_rxBand;
- QString m_mode;
- QString m_waterfallPalette;
- float m_swide[MAX_SCREENSIZE];
- QString m_user_defined;
-};
-
-#endif // WIDEGRAPH_H
+// -*- Mode: C++ -*- +#ifndef WIDEGRAPH_H_ +#define WIDEGRAPH_H_ + +#include <QDialog> +#include <QScopedPointer> +#include <QDir> +#include <QHash> +#include <QVariant> +#include "WFPalette.hpp" + +#define MAX_SCREENSIZE 2048 + +namespace Ui { + class WideGraph; +} + +class QSettings; +class Configuration; + +class WideGraph : public QDialog +{ + Q_OBJECT + +public: + explicit WideGraph(QSettings *, QWidget *parent = 0); + ~WideGraph (); + + void dataSink2(float s[], float df3, int ihsym, int ndiskdata, float pdB); + void setRxFreq(int n); + int rxFreq(); + int nStartFreq(); + int Fmin(); + int Fmax(); + int fSpan(); + void saveSettings(); + void setFsample(int n); + void setPeriod(double trperiod, int nsps); + void setTxFreq(int n); + void setMode(QString mode); + void setSubMode(int n); + bool flatten(); + bool useRef(); + void setTol(int n); + void setSuperFox(bool b); + void setSuperHound(bool b); + int smoothYellow(); + void setRxBand (QString const& band); + void setWSPRtransmitted(); + void drawRed(int ia, int ib); + void setVHF(bool bVHF); + void setRedFile(QString fRed); + void setFST4_FreqRange(int fLow,int fHigh); + void setSingleDecode(bool b); + void setDiskUTC(int nutc); + void restartTotalPower(); + void setDarkStyle(bool b); + +signals: + void freezeDecode2(int n); + void f11f12(int n); + void setXIT2(int n); + void setFreq3(int rxFreq, int txFreq); + +public slots: + void wideFreezeDecode(int n); + void setFreq2(int rxFreq, int txFreq); + void setDialFreq(double d); + +protected: + void keyPressEvent (QKeyEvent *e) override; + void closeEvent (QCloseEvent *) override; + +private slots: + void on_waterfallAvgSpinBox_valueChanged(int arg1); + void on_bppSpinBox_valueChanged(int arg1); + void on_spec2dComboBox_currentIndexChanged(int); + void on_fSplitSpinBox_valueChanged(int n); + void on_fStartSpinBox_valueChanged(int n); + void on_paletteComboBox_activated(const QString &palette); + void on_timestampComboBox_currentIndexChanged(int n); + void on_cbFlatten_toggled(bool b); + void on_cbRef_toggled(bool b); + void on_cbControls_toggled(bool b); + void on_cbBars_toggled(bool b); + void on_cbFreq_toggled(bool b); + void on_adjust_palette_push_button_clicked (bool); + void on_gainSlider_valueChanged(int value); + void on_zeroSlider_valueChanged(int value); + void on_gain2dSlider_valueChanged(int value); + void on_zero2dSlider_valueChanged(int value); + void on_smoSpinBox_valueChanged(int n); + void on_sbPercent2dPlot_valueChanged(int n); + +private: + void readPalette (); + void setRxRange (); + void replot(); + + QScopedPointer<Ui::WideGraph> ui; + + QSettings * m_settings; + QDir m_palettes_path; + WFPalette m_userPalette; + QHash<QString, QVariant> m_fMinPerBand; + + double m_tr0; + double m_TRperiod; + + qint32 m_waterfallAvg; + qint32 m_nsps; + qint32 m_fMax; + qint32 m_nSubMode; + qint32 m_nsmo; + qint32 m_Percent2DScreen; + qint32 m_jz=MAX_SCREENSIZE; + qint32 m_n; + qint32 m_timestamp; + + bool m_bars; + bool m_freq; + bool m_bFlatten; + bool m_bRef; + bool m_bHaveTransmitted; //Set true at end of a WSPR or FT4 transmission + + QString m_rxBand; + QString m_mode; + QString m_waterfallPalette; + float m_swide[MAX_SCREENSIZE]; + QString m_user_defined; +}; + +#endif // WIDEGRAPH_H diff --git a/widgets/widegraph.ui b/widgets/widegraph.ui index 205dc26a..0f8b374e 100755..100644 --- a/widgets/widegraph.ui +++ b/widgets/widegraph.ui @@ -1,708 +1,708 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>WideGraph</class>
- <widget class="QDialog" name="WideGraph">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>845</width>
- <height>245</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Dialog</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <property name="spacing">
- <number>1</number>
- </property>
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
- <number>0</number>
- </property>
- <item>
- <widget class="CPlotter" name="widePlot">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>400</width>
- <height>100</height>
- </size>
- </property>
- <property name="frameShape">
- <enum>QFrame::NoFrame</enum>
- </property>
- <property name="frameShadow">
- <enum>QFrame::Plain</enum>
- </property>
- <property name="lineWidth">
- <number>1</number>
- </property>
- <widget class="QCheckBox" name="cbControls">
- <property name="geometry">
- <rect>
- <x>2</x>
- <y>1</y>
- <width>18</width>
- <height>17</height>
- </rect>
- </property>
- <property name="maximumSize">
- <size>
- <width>18</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string><html><head/><body><p>Controls</p></body></html></string>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </widget>
- </item>
- <item>
- <widget class="QWidget" name="controls_widget" native="true">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <layout class="QGridLayout" name="gridLayout">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
- <number>0</number>
- </property>
- <property name="horizontalSpacing">
- <number>5</number>
- </property>
- <property name="verticalSpacing">
- <number>0</number>
- </property>
- <item row="0" column="6" rowspan="3">
- <widget class="Line" name="line">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- </widget>
- </item>
- <item row="0" column="9" rowspan="3">
- <widget class="Line" name="line_2">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- </widget>
- </item>
- <item row="0" column="4" rowspan="3">
- <layout class="QVBoxLayout" name="verticalLayout_4">
- <property name="spacing">
- <number>0</number>
- </property>
- <item>
- <widget class="QSpinBox" name="fStartSpinBox">
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>0</height>
- </size>
- </property>
- <property name="toolTip">
- <string><html><head/><body><p>Frequency at left edge of waterfall</p></body></html></string>
- </property>
- <property name="suffix">
- <string> Hz</string>
- </property>
- <property name="prefix">
- <string>Start </string>
- </property>
- <property name="maximum">
- <number>4900</number>
- </property>
- <property name="singleStep">
- <number>100</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QSpinBox" name="waterfallAvgSpinBox">
- <property name="toolTip">
- <string>Number of FFTs averaged (controls waterfall scrolling rate)</string>
- </property>
- <property name="prefix">
- <string>N Avg </string>
- </property>
- <property name="minimum">
- <number>1</number>
- </property>
- <property name="maximum">
- <number>500</number>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="0" column="0" rowspan="3">
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>5</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="0" column="3" rowspan="3">
- <layout class="QVBoxLayout" name="verticalLayout_3">
- <property name="spacing">
- <number>0</number>
- </property>
- <item>
- <widget class="QSpinBox" name="bppSpinBox">
- <property name="minimumSize">
- <size>
- <width>100</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string>Compression factor for frequency scale</string>
- </property>
- <property name="suffix">
- <string/>
- </property>
- <property name="prefix">
- <string>Bins/Pixel </string>
- </property>
- <property name="minimum">
- <number>1</number>
- </property>
- <property name="maximum">
- <number>1000</number>
- </property>
- <property name="singleStep">
- <number>1</number>
- </property>
- <property name="value">
- <number>2</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QSpinBox" name="fSplitSpinBox">
- <property name="minimumSize">
- <size>
- <width>100</width>
- <height>0</height>
- </size>
- </property>
- <property name="toolTip">
- <string><html><head/><body><p>Decode JT9 only above this frequency</p></body></html></string>
- </property>
- <property name="suffix">
- <string> Hz</string>
- </property>
- <property name="prefix">
- <string>Split </string>
- </property>
- <property name="maximum">
- <number>5000</number>
- </property>
- <property name="singleStep">
- <number>100</number>
- </property>
- <property name="value">
- <number>3000</number>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <item>
- <widget class="QLabel" name="labTime">
- <property name="toolTip">
- <string><html><head/><body><p>Position of time stamp above each interval line</p></body></html></string>
- </property>
- <property name="text">
- <string>Time stamp </string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QComboBox" name="timestampComboBox">
- <property name="toolTip">
- <string><html><head/><body><p>Position of time stamp above each interval line</p></body></html></string>
- </property>
- <property name="currentText">
- <string>Off</string>
- </property>
- <item>
- <property name="text">
- <string>Off</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Left</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Right</string>
- </property>
- </item>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </item>
- <item row="0" column="7" rowspan="3">
- <layout class="QVBoxLayout" name="verticalLayout_6">
- <property name="spacing">
- <number>0</number>
- </property>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QLabel" name="labPalette">
- <property name="text">
- <string> Palette </string>
- </property>
- <property name="alignment">
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="adjust_palette_push_button">
- <property name="maximumSize">
- <size>
- <width>65</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string><html><head/><body><p>Enter definition for a new color palette.</p></body></html></string>
- </property>
- <property name="text">
- <string>Adjust...</string>
- </property>
- <property name="autoDefault">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QComboBox" name="paletteComboBox">
- <property name="toolTip">
- <string>Select waterfall palette</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="0" column="17" rowspan="3">
- <spacer name="horizontalSpacer_2">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>5</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="0" column="2" rowspan="3">
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <property name="spacing">
- <number>0</number>
- </property>
- <item>
- <widget class="QCheckBox" name="cbBars">
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="text">
- <string>Bars</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="cbFreq">
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="text">
- <string>Freq</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="0" column="10" rowspan="3">
- <layout class="QVBoxLayout" name="verticalLayout_7">
- <property name="spacing">
- <number>0</number>
- </property>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_3">
- <item>
- <widget class="QCheckBox" name="cbFlatten">
- <property name="toolTip">
- <string><html><head/><body><p>Flatten spectral baseline over the full displayed interval.</p></body></html></string>
- </property>
- <property name="text">
- <string>Flatten</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="cbRef">
- <property name="toolTip">
- <string><html><head/><body><p>Compute and save a reference spectrum. (Not yet fully implemented.)</p></body></html></string>
- </property>
- <property name="text">
- <string>Ref Spec</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QComboBox" name="spec2dComboBox">
- <property name="toolTip">
- <string><html><head/><body><p>Select data for spectral display</p></body></html></string>
- </property>
- <property name="currentIndex">
- <number>0</number>
- </property>
- <item>
- <property name="text">
- <string>Current</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Cumulative</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Linear Avg</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Reference</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Q65_Sync</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Total power (dB)</string>
- </property>
- </item>
- </widget>
- </item>
- </layout>
- </item>
- <item row="0" column="11" rowspan="3">
- <layout class="QVBoxLayout" name="verticalLayout_8">
- <property name="spacing">
- <number>0</number>
- </property>
- <item>
- <widget class="QSlider" name="gainSlider">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>1</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>80</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>200</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string>Waterfall gain</string>
- </property>
- <property name="minimum">
- <number>-50</number>
- </property>
- <property name="maximum">
- <number>50</number>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="tickPosition">
- <enum>QSlider::TicksAbove</enum>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QSlider" name="gain2dSlider">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>1</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>80</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>200</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string>Spectrum gain</string>
- </property>
- <property name="minimum">
- <number>-50</number>
- </property>
- <property name="maximum">
- <number>50</number>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="tickPosition">
- <enum>QSlider::TicksAbove</enum>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="0" column="12" rowspan="3">
- <layout class="QVBoxLayout" name="verticalLayout_9">
- <property name="spacing">
- <number>0</number>
- </property>
- <item>
- <widget class="QSlider" name="zeroSlider">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>1</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>80</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>200</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string>Waterfall zero</string>
- </property>
- <property name="minimum">
- <number>-50</number>
- </property>
- <property name="maximum">
- <number>50</number>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="tickPosition">
- <enum>QSlider::TicksAbove</enum>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QSlider" name="zero2dSlider">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>1</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>80</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>200</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string>Spectrum zero</string>
- </property>
- <property name="minimum">
- <number>-50</number>
- </property>
- <property name="maximum">
- <number>50</number>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="tickPosition">
- <enum>QSlider::TicksAbove</enum>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="0" column="13" rowspan="3">
- <layout class="QVBoxLayout" name="verticalLayout_10">
- <property name="spacing">
- <number>0</number>
- </property>
- <item>
- <widget class="QSpinBox" name="sbPercent2dPlot">
- <property name="minimumSize">
- <size>
- <width>75</width>
- <height>0</height>
- </size>
- </property>
- <property name="toolTip">
- <string><html><head/><body><p>Set fractional size of spectrum in this window.</p></body></html></string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <property name="suffix">
- <string> %</string>
- </property>
- <property name="prefix">
- <string>Spec </string>
- </property>
- <property name="maximum">
- <number>100</number>
- </property>
- <property name="singleStep">
- <number>5</number>
- </property>
- <property name="value">
- <number>30</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QSpinBox" name="smoSpinBox">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="toolTip">
- <string>Smoothing of Linear Average spectrum</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <property name="suffix">
- <string/>
- </property>
- <property name="prefix">
- <string>Smooth </string>
- </property>
- <property name="minimum">
- <number>1</number>
- </property>
- <property name="maximum">
- <number>7</number>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </widget>
- <customwidgets>
- <customwidget>
- <class>CPlotter</class>
- <extends>QFrame</extends>
- <header>widgets/plotter.h</header>
- <container>1</container>
- </customwidget>
- </customwidgets>
- <tabstops>
- <tabstop>cbControls</tabstop>
- <tabstop>adjust_palette_push_button</tabstop>
- <tabstop>cbFlatten</tabstop>
- <tabstop>cbRef</tabstop>
- </tabstops>
- <resources/>
- <connections/>
-</ui>
+<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>WideGraph</class> + <widget class="QDialog" name="WideGraph"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>845</width> + <height>245</height> + </rect> + </property> + <property name="windowTitle"> + <string>Dialog</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <property name="spacing"> + <number>1</number> + </property> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="CPlotter" name="widePlot"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>400</width> + <height>100</height> + </size> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Plain</enum> + </property> + <property name="lineWidth"> + <number>1</number> + </property> + <widget class="QCheckBox" name="cbControls"> + <property name="geometry"> + <rect> + <x>2</x> + <y>1</y> + <width>18</width> + <height>17</height> + </rect> + </property> + <property name="maximumSize"> + <size> + <width>18</width> + <height>16777215</height> + </size> + </property> + <property name="toolTip"> + <string><html><head/><body><p>Controls</p></body></html></string> + </property> + <property name="text"> + <string/> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </widget> + </item> + <item> + <widget class="QWidget" name="controls_widget" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <layout class="QGridLayout" name="gridLayout"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <property name="horizontalSpacing"> + <number>5</number> + </property> + <property name="verticalSpacing"> + <number>0</number> + </property> + <item row="0" column="6" rowspan="3"> + <widget class="Line" name="line"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + </widget> + </item> + <item row="0" column="9" rowspan="3"> + <widget class="Line" name="line_2"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + </widget> + </item> + <item row="0" column="4" rowspan="3"> + <layout class="QVBoxLayout" name="verticalLayout_4"> + <property name="spacing"> + <number>0</number> + </property> + <item> + <widget class="QSpinBox" name="fStartSpinBox"> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="toolTip"> + <string><html><head/><body><p>Frequency at left edge of waterfall</p></body></html></string> + </property> + <property name="suffix"> + <string> Hz</string> + </property> + <property name="prefix"> + <string>Start </string> + </property> + <property name="maximum"> + <number>4900</number> + </property> + <property name="singleStep"> + <number>100</number> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="waterfallAvgSpinBox"> + <property name="toolTip"> + <string>Number of FFTs averaged (controls waterfall scrolling rate)</string> + </property> + <property name="prefix"> + <string>N Avg </string> + </property> + <property name="minimum"> + <number>1</number> + </property> + <property name="maximum"> + <number>500</number> + </property> + </widget> + </item> + </layout> + </item> + <item row="0" column="0" rowspan="3"> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>5</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="0" column="3" rowspan="3"> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <property name="spacing"> + <number>0</number> + </property> + <item> + <widget class="QSpinBox" name="bppSpinBox"> + <property name="minimumSize"> + <size> + <width>100</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + <property name="toolTip"> + <string>Compression factor for frequency scale</string> + </property> + <property name="suffix"> + <string/> + </property> + <property name="prefix"> + <string>Bins/Pixel </string> + </property> + <property name="minimum"> + <number>1</number> + </property> + <property name="maximum"> + <number>1000</number> + </property> + <property name="singleStep"> + <number>1</number> + </property> + <property name="value"> + <number>2</number> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="fSplitSpinBox"> + <property name="minimumSize"> + <size> + <width>100</width> + <height>0</height> + </size> + </property> + <property name="toolTip"> + <string><html><head/><body><p>Decode JT9 only above this frequency</p></body></html></string> + </property> + <property name="suffix"> + <string> Hz</string> + </property> + <property name="prefix"> + <string>Split </string> + </property> + <property name="maximum"> + <number>5000</number> + </property> + <property name="singleStep"> + <number>100</number> + </property> + <property name="value"> + <number>3000</number> + </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item> + <widget class="QLabel" name="labTime"> + <property name="toolTip"> + <string><html><head/><body><p>Position of time stamp above each interval line</p></body></html></string> + </property> + <property name="text"> + <string>Time stamp </string> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="timestampComboBox"> + <property name="toolTip"> + <string><html><head/><body><p>Position of time stamp above each interval line</p></body></html></string> + </property> + <property name="currentText"> + <string>Off</string> + </property> + <item> + <property name="text"> + <string>Off</string> + </property> + </item> + <item> + <property name="text"> + <string>Left</string> + </property> + </item> + <item> + <property name="text"> + <string>Right</string> + </property> + </item> + </widget> + </item> + </layout> + </item> + </layout> + </item> + <item row="0" column="7" rowspan="3"> + <layout class="QVBoxLayout" name="verticalLayout_6"> + <property name="spacing"> + <number>0</number> + </property> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QLabel" name="labPalette"> + <property name="text"> + <string> Palette </string> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="adjust_palette_push_button"> + <property name="maximumSize"> + <size> + <width>65</width> + <height>16777215</height> + </size> + </property> + <property name="toolTip"> + <string><html><head/><body><p>Enter definition for a new color palette.</p></body></html></string> + </property> + <property name="text"> + <string>Adjust...</string> + </property> + <property name="autoDefault"> + <bool>false</bool> + </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="QComboBox" name="paletteComboBox"> + <property name="toolTip"> + <string>Select waterfall palette</string> + </property> + </widget> + </item> + </layout> + </item> + <item row="0" column="17" rowspan="3"> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>5</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="0" column="2" rowspan="3"> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <property name="spacing"> + <number>0</number> + </property> + <item> + <widget class="QCheckBox" name="cbBars"> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + <property name="text"> + <string>Bars</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="cbFreq"> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + <property name="text"> + <string>Freq</string> + </property> + </widget> + </item> + </layout> + </item> + <item row="0" column="10" rowspan="3"> + <layout class="QVBoxLayout" name="verticalLayout_7"> + <property name="spacing"> + <number>0</number> + </property> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <item> + <widget class="QCheckBox" name="cbFlatten"> + <property name="toolTip"> + <string><html><head/><body><p>Flatten spectral baseline over the full displayed interval.</p></body></html></string> + </property> + <property name="text"> + <string>Flatten</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="cbRef"> + <property name="toolTip"> + <string><html><head/><body><p>Compute and save a reference spectrum. (Not yet fully implemented.)</p></body></html></string> + </property> + <property name="text"> + <string>Ref Spec</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="QComboBox" name="spec2dComboBox"> + <property name="toolTip"> + <string><html><head/><body><p>Select data for spectral display</p></body></html></string> + </property> + <property name="currentIndex"> + <number>0</number> + </property> + <item> + <property name="text"> + <string>Current</string> + </property> + </item> + <item> + <property name="text"> + <string>Cumulative</string> + </property> + </item> + <item> + <property name="text"> + <string>Linear Avg</string> + </property> + </item> + <item> + <property name="text"> + <string>Reference</string> + </property> + </item> + <item> + <property name="text"> + <string>Q65_Sync</string> + </property> + </item> + <item> + <property name="text"> + <string>Total power (dB)</string> + </property> + </item> + </widget> + </item> + </layout> + </item> + <item row="0" column="11" rowspan="3"> + <layout class="QVBoxLayout" name="verticalLayout_8"> + <property name="spacing"> + <number>0</number> + </property> + <item> + <widget class="QSlider" name="gainSlider"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> + <horstretch>1</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>80</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>200</width> + <height>16777215</height> + </size> + </property> + <property name="toolTip"> + <string>Waterfall gain</string> + </property> + <property name="minimum"> + <number>-50</number> + </property> + <property name="maximum"> + <number>50</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="tickPosition"> + <enum>QSlider::TicksAbove</enum> + </property> + </widget> + </item> + <item> + <widget class="QSlider" name="gain2dSlider"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> + <horstretch>1</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>80</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>200</width> + <height>16777215</height> + </size> + </property> + <property name="toolTip"> + <string>Spectrum gain</string> + </property> + <property name="minimum"> + <number>-50</number> + </property> + <property name="maximum"> + <number>50</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="tickPosition"> + <enum>QSlider::TicksAbove</enum> + </property> + </widget> + </item> + </layout> + </item> + <item row="0" column="12" rowspan="3"> + <layout class="QVBoxLayout" name="verticalLayout_9"> + <property name="spacing"> + <number>0</number> + </property> + <item> + <widget class="QSlider" name="zeroSlider"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> + <horstretch>1</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>80</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>200</width> + <height>16777215</height> + </size> + </property> + <property name="toolTip"> + <string>Waterfall zero</string> + </property> + <property name="minimum"> + <number>-50</number> + </property> + <property name="maximum"> + <number>50</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="tickPosition"> + <enum>QSlider::TicksAbove</enum> + </property> + </widget> + </item> + <item> + <widget class="QSlider" name="zero2dSlider"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> + <horstretch>1</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>80</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>200</width> + <height>16777215</height> + </size> + </property> + <property name="toolTip"> + <string>Spectrum zero</string> + </property> + <property name="minimum"> + <number>-50</number> + </property> + <property name="maximum"> + <number>50</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="tickPosition"> + <enum>QSlider::TicksAbove</enum> + </property> + </widget> + </item> + </layout> + </item> + <item row="0" column="13" rowspan="3"> + <layout class="QVBoxLayout" name="verticalLayout_10"> + <property name="spacing"> + <number>0</number> + </property> + <item> + <widget class="QSpinBox" name="sbPercent2dPlot"> + <property name="minimumSize"> + <size> + <width>75</width> + <height>0</height> + </size> + </property> + <property name="toolTip"> + <string><html><head/><body><p>Set fractional size of spectrum in this window.</p></body></html></string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="suffix"> + <string> %</string> + </property> + <property name="prefix"> + <string>Spec </string> + </property> + <property name="maximum"> + <number>100</number> + </property> + <property name="singleStep"> + <number>5</number> + </property> + <property name="value"> + <number>30</number> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="smoSpinBox"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip"> + <string>Smoothing of Linear Average spectrum</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="suffix"> + <string/> + </property> + <property name="prefix"> + <string>Smooth </string> + </property> + <property name="minimum"> + <number>1</number> + </property> + <property name="maximum"> + <number>7</number> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + <customwidgets> + <customwidget> + <class>CPlotter</class> + <extends>QFrame</extends> + <header>widgets/plotter.h</header> + <container>1</container> + </customwidget> + </customwidgets> + <tabstops> + <tabstop>cbControls</tabstop> + <tabstop>adjust_palette_push_button</tabstop> + <tabstop>cbFlatten</tabstop> + <tabstop>cbRef</tabstop> + </tabstops> + <resources/> + <connections/> +</ui> diff --git a/widgets/widgets.pri b/widgets/widgets.pri index 3254bc9c..e82bfbbe 100755..100644 --- a/widgets/widgets.pri +++ b/widgets/widgets.pri @@ -1,48 +1,48 @@ -SOURCES += \
- widgets/astro.cpp widgets/LettersSpinBox.cpp \
- widgets/logqso.cpp widgets/displaytext.cpp \
- widgets/meterwidget.cpp widgets/signalmeter.cpp \
- widgets/plotter.cpp widgets/widegraph.cpp widgets/about.cpp \
- widgets/mainwindow.cpp widgets/messageaveraging.cpp \
- widgets/activeStations.cpp \
- widgets/echoplot.cpp widgets/echograph.cpp widgets/fastgraph.cpp \
- widgets/fastplot.cpp widgets/MessageBox.cpp \
- widgets/colorhighlighting.cpp widgets/ExportCabrillo.cpp \
- widgets/AbstractLogWindow.cpp \
- widgets/FrequencyLineEdit.cpp widgets/FrequencyDeltaLineEdit.cpp \
- widgets/FoxLogWindow.cpp widgets/CabrilloLogWindow.cpp \
- widgets/HelpTextWindow.cpp widgets/RestrictedSpinBox.cpp \
- widgets/LazyFillComboBox.cpp widgets/CheckableItemComboBox.cpp \
- widgets/QSYMessage.cpp \
- widgets/QSYMessageCreator.cpp \
- widgets/qsymonitor.cpp
-
-HEADERS += \
- widgets/mainwindow.h widgets/plotter.h \
- widgets/about.h widgets/widegraph.h \
- widgets/displaytext.h widgets/logqso.h widgets/LettersSpinBox.hpp \
- widgets/FrequencyLineEdit.hpp widgets/FrequencyDeltaLineEdit.hpp widgets/signalmeter.h \
- widgets/meterwidget.h widgets/messageaveraging.h \
- widgets/activeStations.h \
- widgets/echoplot.h widgets/echograph.h widgets/fastgraph.h \
- widgets/fastplot.h widgets/MessageBox.hpp widgets/colorhighlighting.h \
- widgets/ExportCabrillo.h widgets/AbstractLogWindow.hpp \
- widgets/FoxLogWindow.hpp widgets/CabrilloLogWindow.hpp \
- widgets/DateTimeEdit.hpp widgets/HelpTextWindow.hpp \
- widgets/RestrictedSpinBox.hpp \
- widgets/LazyFillComboBox.hpp widgets/CheckableItemComboBox.hpp \
- widgets/QSYMessage.h \
- widgets/QSYMessageCreator.h \
- widgets/qsymonitor.h
-
-FORMS += \
- widgets/mainwindow.ui widgets/about.ui \
- widgets/widegraph.ui widgets/astro.ui \
- widgets/logqso.ui widgets/messageaveraging.ui \
- widgets/activeStations.ui \
- widgets/echograph.ui widgets/fastgraph.ui \
- widgets/colorhighlighting.ui widgets/ExportCabrillo.ui \
- widgets/FoxLogWindow.ui widgets/CabrilloLogWindow.ui \
- widgets/QSYMessage.ui \
- widgets/QSYMessageCreator.ui \
- widgets/qsymonitor.ui
+SOURCES += \ + widgets/astro.cpp widgets/LettersSpinBox.cpp \ + widgets/logqso.cpp widgets/displaytext.cpp \ + widgets/meterwidget.cpp widgets/signalmeter.cpp \ + widgets/plotter.cpp widgets/widegraph.cpp widgets/about.cpp \ + widgets/mainwindow.cpp widgets/messageaveraging.cpp \ + widgets/activeStations.cpp \ + widgets/echoplot.cpp widgets/echograph.cpp widgets/fastgraph.cpp \ + widgets/fastplot.cpp widgets/MessageBox.cpp \ + widgets/colorhighlighting.cpp widgets/ExportCabrillo.cpp \ + widgets/AbstractLogWindow.cpp \ + widgets/FrequencyLineEdit.cpp widgets/FrequencyDeltaLineEdit.cpp \ + widgets/FoxLogWindow.cpp widgets/CabrilloLogWindow.cpp \ + widgets/HelpTextWindow.cpp widgets/RestrictedSpinBox.cpp \ + widgets/LazyFillComboBox.cpp widgets/CheckableItemComboBox.cpp \ + widgets/QSYMessage.cpp \ + widgets/QSYMessageCreator.cpp \ + widgets/qsymonitor.cpp + +HEADERS += \ + widgets/mainwindow.h widgets/plotter.h \ + widgets/about.h widgets/widegraph.h \ + widgets/displaytext.h widgets/logqso.h widgets/LettersSpinBox.hpp \ + widgets/FrequencyLineEdit.hpp widgets/FrequencyDeltaLineEdit.hpp widgets/signalmeter.h \ + widgets/meterwidget.h widgets/messageaveraging.h \ + widgets/activeStations.h \ + widgets/echoplot.h widgets/echograph.h widgets/fastgraph.h \ + widgets/fastplot.h widgets/MessageBox.hpp widgets/colorhighlighting.h \ + widgets/ExportCabrillo.h widgets/AbstractLogWindow.hpp \ + widgets/FoxLogWindow.hpp widgets/CabrilloLogWindow.hpp \ + widgets/DateTimeEdit.hpp widgets/HelpTextWindow.hpp \ + widgets/RestrictedSpinBox.hpp \ + widgets/LazyFillComboBox.hpp widgets/CheckableItemComboBox.hpp \ + widgets/QSYMessage.h \ + widgets/QSYMessageCreator.h \ + widgets/qsymonitor.h + +FORMS += \ + widgets/mainwindow.ui widgets/about.ui \ + widgets/widegraph.ui widgets/astro.ui \ + widgets/logqso.ui widgets/messageaveraging.ui \ + widgets/activeStations.ui \ + widgets/echograph.ui widgets/fastgraph.ui \ + widgets/colorhighlighting.ui widgets/ExportCabrillo.ui \ + widgets/FoxLogWindow.ui widgets/CabrilloLogWindow.ui \ + widgets/QSYMessage.ui \ + widgets/QSYMessageCreator.ui \ + widgets/qsymonitor.ui |
