diff options
| author | Christoph Berg <myon@debian.org> | 2026-10-09 14:12:49 +0200 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2026-10-09 14:12:49 +0200 |
| commit | 76956486fa7ef52a51d4e56df1e13a9f19a6c93c (patch) | |
| tree | fe0c394439fdc167d1970372e8998874090854dd /JttyReceiveResultController.hpp | |
| parent | 0685fcada9f95fe90f70b387cd7d757da8209624 (diff) | |
| parent | ffc62c792c9a5196cb4ce7a353287dfe20db6524 (diff) | |
Update upstream source from tag 'upstream/3.3.0_beta1+dfsg'
Update to upstream version '3.3.0~beta1+dfsg'
with Debian dir 85037bbb9376721108594b59b54ead82ac6924a3
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 |
