From ffc62c792c9a5196cb4ce7a353287dfe20db6524 Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Fri, 9 Oct 2026 14:12:35 +0200 Subject: New upstream version 3.3.0~beta1+dfsg --- widgets/displaytext.cpp | 34 +++++++++------------------------- 1 file changed, 9 insertions(+), 25 deletions(-) (limited to 'widgets/displaytext.cpp') 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 #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; + 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 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 -- cgit v1.2.3