diff options
| author | Dave Hibberd <hibby@debian.org> | 2026-10-20 22:35:06 +0100 |
|---|---|---|
| committer | Dave Hibberd <hibby@debian.org> | 2026-10-20 22:35:06 +0100 |
| commit | 82ebb1ed1af30cee4dfbb1c628431d32885a00e0 (patch) | |
| tree | 1a1f782d3e576b758be0bc61171574a7cd8f2376 /JttyReceiveResultController.hpp | |
| parent | 061658210acb6425517733ea012dda803a7f72a1 (diff) | |
| parent | 61d684922b0f1c8455cc60eb3d123df058c9e1f5 (diff) | |
Merge tag 'debian/3.3.0_beta2+dfsg-1' into hibbian/trixie-backports
tagging wsjtx 3.3.0~beta2+dfsg-1
Diffstat (limited to 'JttyReceiveResultController.hpp')
| -rw-r--r-- | JttyReceiveResultController.hpp | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/JttyReceiveResultController.hpp b/JttyReceiveResultController.hpp new file mode 100644 index 00000000..8e05054e --- /dev/null +++ b/JttyReceiveResultController.hpp @@ -0,0 +1,81 @@ +#ifndef JTTY_RECEIVE_RESULT_CONTROLLER_HPP +#define JTTY_RECEIVE_RESULT_CONTROLLER_HPP + +#include "DecodeOperatingContext.hpp" +#include "JttyDecoder.hpp" +#include "JttyReceiveLine.hpp" +#include <QHash> +#include <deque> +#include <functional> + +namespace Jtty { + +class ReceiveResultController +{ +public: + enum class Source { Live, Wav, Review }; + enum class Pane { All, Qso }; + + struct Reception { + Source source {Source::Live}; + quint64 contextId {}; + quint64 displayGroup {}; + QDateTime anchor, displayAnchor; + DecodeOperatingContext context; + float center {1500}, tolerance {50}; + }; + + struct Selection { + bool jttyActive {}; + quint64 contextId {}; + float center {1500}, tolerance {50}; + }; + + struct EchoOptions { bool enabled {}, lowerCase {}; }; + + struct Inputs { + std::function<JttyReceiveLine::Options()> display; + std::function<Selection()> selection; + std::function<EchoOptions()> echo; + std::function<bool()> reporting; + }; + + struct Spot { + QString sender, grid; + Radio::Frequency frequency {}; + QString mode; + int snr {}; + QDateTime time; + }; + + // Effects and handle references are used only during synchronous invocation. + struct Effects { + std::function<void(Pane)> reviewHeading; + std::function<void(Pane, JttyReceiveLine&, JttyReceiveLine::Presentation const&, + JttyReceiveLine::Options const&)> render; + std::function<void(QString const&)> echo; + std::function<void(qint64, qint64)> noteDecoded; + std::function<void(QString const&, DecodeOperatingContext const&)> log; + std::function<void(Spot const&)> spot; + }; + + void apply(QVector<ReceiveUpdate> const&, Reception const&, Inputs const&, Effects const&); + void resetReplay(); + int snrForSelectedWord(QString const&, Pane) const; + +private: + struct Line { + QString text; + JttyReceiveLine allLine, qsoLine; + DecodeOperatingContext context; + bool admitted {}; + }; + struct SnrEntry { QString text; int snr; bool admitted; }; + QHash<qint64, Line> liveLines_, replayLines_; + std::deque<SnrEntry> snrHistory_; + bool reviewHeading_ {}; +}; + +} + +#endif |
