#ifndef JTTY_RECEIVE_RESULT_CONTROLLER_HPP #define JTTY_RECEIVE_RESULT_CONTROLLER_HPP #include "DecodeOperatingContext.hpp" #include "JttyDecoder.hpp" #include "JttyReceiveLine.hpp" #include #include #include 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 display; std::function selection; std::function echo; std::function 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 reviewHeading; std::function render; std::function echo; std::function noteDecoded; std::function log; std::function spot; }; void apply(QVector 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 liveLines_, replayLines_; std::deque snrHistory_; bool reviewHeading_ {}; }; } #endif