Narrow decode prints in the Band Activity window

This commit is contained in:
Bill Somerville 2020-07-21 00:29:22 +01:00
parent 2da65408a8
commit 0f6d054276
No known key found for this signature in database
GPG Key ID: D864B06D1E81618F
2 changed files with 37 additions and 22 deletions

View File

@ -241,10 +241,9 @@ void DisplayText::new_period ()
QString DisplayText::appendWorkedB4 (QString message, QString call, QString const& grid,
QColor * bg, QColor * fg, LogBook const& logBook,
QString const& currentBand, QString const& currentMode)
QString const& currentBand, QString const& currentMode,
QString extra)
{
// allow for seconds
int padding {message.indexOf (" ") > 4 ? 2 : 0};
QString countryName;
bool callB4;
bool callB4onBand;
@ -278,7 +277,6 @@ QString DisplayText::appendWorkedB4 (QString message, QString call, QString cons
}
message = message.trimmed ();
QString appendage;
highlight_types types;
// no shortcuts here as some types may be disabled
@ -329,20 +327,20 @@ QString DisplayText::appendWorkedB4 (QString message, QString call, QString cons
{
case Highlight::Continent:
case Highlight::ContinentBand:
appendage = AD1CCty::continent (looked_up.continent);
extra += AD1CCty::continent (looked_up.continent);
break;
case Highlight::CQZone:
case Highlight::CQZoneBand:
appendage = QString {"CQ Zone %1"}.arg (looked_up.CQ_zone);
extra += QString {"CQ Zone %1"}.arg (looked_up.CQ_zone);
break;
case Highlight::ITUZone:
case Highlight::ITUZoneBand:
appendage = QString {"ITU Zone %1"}.arg (looked_up.ITU_zone);
extra += QString {"ITU Zone %1"}.arg (looked_up.ITU_zone);
break;
default:
if (m_bPrincipalPrefix)
{
appendage = looked_up.primary_prefix;
extra += looked_up.primary_prefix;
}
else
{
@ -368,11 +366,21 @@ QString DisplayText::appendWorkedB4 (QString message, QString call, QString cons
countryName.replace ("European", "EU");
countryName.replace ("African", "AF");
appendage += countryName;
extra += countryName;
}
}
m_CQPriority=DecodeHighlightingModel::highlight_name(top_highlight);
return leftJustifyAppendage (message, extra);
}
QString DisplayText::leftJustifyAppendage (QString message, QString const& appendage) const
{
if (appendage.size ())
{
// allow for seconds
int padding {message.indexOf (" ") > 4 ? 2 : 0};
// use a nbsp to save the start of appended text so we can find
// it again later, align appended data at a fixed column if
// there is space otherwise let it float to the right
@ -381,6 +389,7 @@ QString DisplayText::appendWorkedB4 (QString message, QString call, QString cons
message += QString {space_count, QChar {' '}};
}
message += QChar::Nbsp + appendage;
}
return message;
}
@ -421,11 +430,11 @@ void DisplayText::displayDecodedText(DecodedText const& decodedText, QString con
decodedText.deCallAndGrid (/*out*/ dxCall, dxGrid);
QRegularExpression grid_regexp {"\\A(?![Rr]{2}73)[A-Ra-r]{2}[0-9]{2}([A-Xa-x]{2}){0,1}\\z"};
if(!dxGrid.contains(grid_regexp)) dxGrid="";
message = message.left (message.indexOf (QChar::Nbsp)); // strip appended info
message = message.left (message.indexOf (QChar::Nbsp)).trimmed (); // strip appended info
QString extra;
if (haveFSpread)
{
message += QString {37 - message.size (), QChar {' '}};
message += QChar::Nbsp + QString {"%1"}.arg (fSpread, 5, 'f', fSpread < 0.95 ? 3 : 2);
extra = QString {"%1"}.arg (fSpread, 5, 'f', fSpread < 0.95 ? 3 : 2) + QChar {' '};
}
m_CQPriority="";
if (CQcall)
@ -440,10 +449,11 @@ void DisplayText::displayDecodedText(DecodedText const& decodedText, QString con
currentMode = decodedText.isJT65 () ? "JT65" : "JT9";
}
message = appendWorkedB4 (message, decodedText.CQersCall(), dxGrid, &bg, &fg
, logBook, currentBand, currentMode);
, logBook, currentBand, currentMode, extra);
}
else
{
message = leftJustifyAppendage (message, extra);
highlight_types types {Highlight::CQ};
if (m_config && m_config->lotw_users ().user (decodedText.CQersCall()))
{
@ -452,6 +462,10 @@ void DisplayText::displayDecodedText(DecodedText const& decodedText, QString con
set_colours (m_config, &bg, &fg, types);
}
}
else
{
message = leftJustifyAppendage (message, extra);
}
appendText (message.trimmed (), bg, fg, decodedText.call (), dxCall);
}

View File

@ -47,6 +47,7 @@ public:
Q_SLOT void highlight_callsign (QString const& callsign, QColor const& bg, QColor const& fg, bool last_period_only);
private:
QString leftJustifyAppendage (QString message, QString const& appendage) const;
void mouseDoubleClickEvent (QMouseEvent *) override;
void extend_vertical_scrollbar (int min, int max);
@ -57,7 +58,7 @@ private:
QString appendWorkedB4(QString message, QString callsign
, QString const& grid, QColor * bg, QColor * fg
, LogBook const& logBook, QString const& currentBand
, QString const& currentMode);
, QString const& currentMode, QString extra);
QFont char_font_;
QAction * erase_action_;
QHash<QString, QPair<QColor, QColor>> highlighted_calls_;