diff options
| author | Christoph Berg <myon@debian.org> | 2026-10-09 14:12:35 +0200 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2026-10-09 14:12:35 +0200 |
| commit | ffc62c792c9a5196cb4ce7a353287dfe20db6524 (patch) | |
| tree | 1269efa852935b183daae4bb33a58d1b4d2ffb53 /widgets/displaytext.cpp | |
| parent | 059831534c7e884f0a607ed86b582fd00d821731 (diff) | |
New upstream version 3.3.0~beta1+dfsgupstream/3.3.0_beta1+dfsg
Diffstat (limited to 'widgets/displaytext.cpp')
| -rw-r--r-- | widgets/displaytext.cpp | 34 |
1 files changed, 9 insertions, 25 deletions
diff --git a/widgets/displaytext.cpp b/widgets/displaytext.cpp index f4b4fcba..228df487 100644 --- a/widgets/displaytext.cpp +++ b/widgets/displaytext.cpp @@ -23,6 +23,7 @@ #include <QResizeEvent> #include "Configuration.hpp" +#include "Radio.hpp" #include "Decoder/decodedtext.h" #include "Network/LotWUsers.hpp" #include "models/DecodeHighlightingModel.hpp" @@ -49,7 +50,6 @@ bool muted = false; namespace { QRegularExpression const message_73_regexp {"^(73|RR73)$"}; - QRegularExpression const grid_regexp {"\\A(?![Rr]{2}73)[A-Ra-r]{2}[0-9]{2}([A-Xa-x]{2}){0,1}\\z"}; // Trailing #? matches Q65's "copied last Tx" flag marker (e.g. "q3#"), // appended after the usual AP-type/averaging-count qualifier. QRegularExpression const ap_regexp {R"((?:\?\s)?(?:a[0-9]|q[0-9][0-9*]?#?)$)"}; @@ -309,34 +309,18 @@ void DisplayText::insertLineSpacer(QString const& line) namespace { using Highlight = DecodeHighlightingModel::Highlight; - using highlight_types = std::vector<Highlight>; + using highlight_types = DecodeHighlightingModel::HighlightTypes; 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_; - } - } + auto const resolved = DecodeHighlightingModel::resolve_colors ( + config->decode_highlighting ().items (), types, *bg, *fg); + *bg = resolved.background_; + *fg = resolved.foreground_; + return resolved.type_; } - return result; // highest priority enabled highlighting + return Highlight::CQ; } } @@ -761,7 +745,7 @@ bool DisplayText::displayDecodedText(DecodedText const& decodedText, QString con QString dxCall; QString dxGrid; decodedText.deCallAndGrid (/*out*/ dxCall, dxGrid); - if(!dxGrid.contains(grid_regexp)) dxGrid=""; + if(!dxGrid.contains(Radio::decoded_grid_pattern())) dxGrid=""; message = message.left (message.indexOf (QChar::Nbsp)).trimmed (); // strip appended info QString extra; QString state; // NJ0A -- populated only when GridMap() is enabled; drives |
