summaryrefslogtreecommitdiff
path: root/widgets/displaytext.cpp
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2020-09-28 23:28:13 +0200
committerChristoph Berg <myon@debian.org>2020-09-28 23:28:13 +0200
commit7aa3c56b01768ba7d38fccedc17b30a4046b3fbb (patch)
treeda509a2cf3667b6f9855ea811f4a1f95d9e6f5ef /widgets/displaytext.cpp
parent28f34ff4908a90b1a7323b2988c33cdb1779fa06 (diff)
New upstream version 2.3.0~rc1+repackupstream/2.3.0_rc1+repack
Diffstat (limited to 'widgets/displaytext.cpp')
-rw-r--r--widgets/displaytext.cpp72
1 files changed, 50 insertions, 22 deletions
diff --git a/widgets/displaytext.cpp b/widgets/displaytext.cpp
index f0f17f64..d498f180 100644
--- a/widgets/displaytext.cpp
+++ b/widgets/displaytext.cpp
@@ -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,26 +366,38 @@ 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);
- // 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
- int space_count {40 + padding - message.size ()};
- if (space_count > 0) {
- message += QString {space_count, QChar {' '}};
- }
- message += QChar::Nbsp + appendage;
+ 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
+ int space_count {40 + padding - message.size ()};
+ if (space_count > 0) {
+ message += QString {space_count, QChar {' '}};
+ }
+ message += QChar::Nbsp + appendage;
+ }
return message;
}
void DisplayText::displayDecodedText(DecodedText const& decodedText, QString const& myCall,
QString const& mode,
bool displayDXCCEntity, LogBook const& logBook,
- QString const& currentBand, bool ppfx, bool bCQonly)
+ QString const& currentBand, bool ppfx, bool bCQonly,
+ bool haveFSpread, float fSpread)
{
m_bPrincipalPrefix=ppfx;
QColor bg;
@@ -420,7 +430,18 @@ 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)
+ {
+ extra += QString {"%1"}.arg (fSpread, 5, 'f', fSpread < 0.95 ? 3 : 2) + QChar {' '};
+ }
+ auto ap_pos = message.lastIndexOf (QRegularExpression {R"((?:\?\s)?a[0-9]$)"});
+ if (ap_pos >= 0)
+ {
+ extra += message.mid (ap_pos) + QChar {' '};
+ message = message.left (ap_pos).trimmed ();
+ }
m_CQPriority="";
if (CQcall)
{
@@ -434,10 +455,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()))
{
@@ -446,12 +468,17 @@ 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);
}
-void DisplayText::displayTransmittedText(QString text, QString modeTx, qint32 txFreq,bool bFastMode)
+void DisplayText::displayTransmittedText(QString text, QString modeTx, qint32 txFreq,
+ bool bFastMode, double TRperiod)
{
QString t1=" @ ";
if(modeTx=="FT4") t1=" + ";
@@ -459,10 +486,11 @@ void DisplayText::displayTransmittedText(QString text, QString modeTx, qint32 tx
if(modeTx=="JT4") t1=" $ ";
if(modeTx=="JT65") t1=" # ";
if(modeTx=="MSK144") t1=" & ";
+ if(modeTx=="FST4") t1=" ` ";
QString t2;
t2 = t2.asprintf("%4d",txFreq);
QString t;
- if(bFastMode or modeTx=="FT8" or modeTx=="FT4") {
+ if(bFastMode or modeTx=="FT8" or modeTx=="FT4" or (TRperiod<60)) {
t = QDateTime::currentDateTimeUtc().toString("hhmmss") + \
" Tx " + t2 + t1 + text;
} else if(modeTx.mid(0,6)=="FT8fox") {