Merged master 8748
This commit is contained in:
@@ -1,242 +0,0 @@
|
||||
#include "displaytext.h"
|
||||
|
||||
#include <QMouseEvent>
|
||||
#include <QDateTime>
|
||||
#include <QTextCharFormat>
|
||||
#include <QTextCursor>
|
||||
#include <QTextBlock>
|
||||
#include <QMenu>
|
||||
#include <QAction>
|
||||
|
||||
#include "qt_helpers.hpp"
|
||||
|
||||
#include "moc_displaytext.cpp"
|
||||
|
||||
DisplayText::DisplayText(QWidget *parent)
|
||||
: QTextEdit(parent)
|
||||
, erase_action_ {new QAction {tr ("&Erase"), this}}
|
||||
{
|
||||
setReadOnly (true);
|
||||
viewport ()->setCursor (Qt::ArrowCursor);
|
||||
setWordWrapMode (QTextOption::NoWrap);
|
||||
|
||||
// max lines to limit heap usage
|
||||
document ()->setMaximumBlockCount (5000);
|
||||
|
||||
// context menu erase action
|
||||
setContextMenuPolicy (Qt::CustomContextMenu);
|
||||
connect (this, &DisplayText::customContextMenuRequested, [this] (QPoint const& position) {
|
||||
auto * menu = createStandardContextMenu (position);
|
||||
menu->addAction (erase_action_);
|
||||
menu->exec (mapToGlobal (position));
|
||||
delete menu;
|
||||
});
|
||||
connect (erase_action_, &QAction::triggered, this, &DisplayText::erase);
|
||||
}
|
||||
|
||||
void DisplayText::erase ()
|
||||
{
|
||||
clear ();
|
||||
Q_EMIT erased ();
|
||||
}
|
||||
|
||||
void DisplayText::setContentFont(QFont const& font)
|
||||
{
|
||||
char_font_ = font;
|
||||
selectAll ();
|
||||
auto cursor = textCursor ();
|
||||
cursor.beginEditBlock ();
|
||||
auto char_format = cursor.charFormat ();
|
||||
char_format.setFont (char_font_);
|
||||
cursor.mergeCharFormat (char_format);
|
||||
cursor.clearSelection ();
|
||||
cursor.movePosition (QTextCursor::End);
|
||||
|
||||
// position so viewport scrolled to left
|
||||
cursor.movePosition (QTextCursor::Up);
|
||||
cursor.movePosition (QTextCursor::StartOfLine);
|
||||
cursor.endEditBlock ();
|
||||
|
||||
setTextCursor (cursor);
|
||||
ensureCursorVisible ();
|
||||
}
|
||||
|
||||
void DisplayText::mouseDoubleClickEvent(QMouseEvent *e)
|
||||
{
|
||||
bool shift = (e->modifiers() & Qt::ShiftModifier);
|
||||
bool ctrl = (e->modifiers() & Qt::ControlModifier);
|
||||
bool alt = (e->modifiers() & Qt::AltModifier);
|
||||
emit(selectCallsign(shift,ctrl,alt));
|
||||
QTextEdit::mouseDoubleClickEvent(e);
|
||||
}
|
||||
|
||||
void DisplayText::insertLineSpacer(QString const& line)
|
||||
{
|
||||
appendText (line, "#d3d3d3");
|
||||
}
|
||||
|
||||
void DisplayText::appendText(QString const& text, QColor bg)
|
||||
{
|
||||
auto cursor = textCursor ();
|
||||
cursor.movePosition (QTextCursor::End);
|
||||
auto block_format = cursor.blockFormat ();
|
||||
block_format.setBackground (bg);
|
||||
if (0 == cursor.position ())
|
||||
{
|
||||
cursor.setBlockFormat (block_format);
|
||||
auto char_format = cursor.charFormat ();
|
||||
char_format.setFont (char_font_);
|
||||
cursor.setCharFormat (char_format);
|
||||
}
|
||||
else
|
||||
{
|
||||
cursor.insertBlock (block_format);
|
||||
}
|
||||
cursor.insertText (text);
|
||||
|
||||
// position so viewport scrolled to left
|
||||
cursor.movePosition (QTextCursor::StartOfLine);
|
||||
setTextCursor (cursor);
|
||||
ensureCursorVisible ();
|
||||
document ()->setMaximumBlockCount (document ()->maximumBlockCount ());
|
||||
}
|
||||
|
||||
|
||||
QString DisplayText::appendDXCCWorkedB4(QString message, QString const& callsign, QColor * bg,
|
||||
LogBook const& logBook, QColor color_CQ,
|
||||
QColor color_DXCC,
|
||||
QColor color_NewCall)
|
||||
{
|
||||
// allow for seconds
|
||||
int padding {message.indexOf (" ") > 4 ? 2 : 0};
|
||||
QString call = callsign;
|
||||
QString countryName;
|
||||
bool callWorkedBefore;
|
||||
bool countryWorkedBefore;
|
||||
|
||||
if(call.length()==2) {
|
||||
int i0=message.indexOf("CQ "+call);
|
||||
call=message.mid(i0+6,-1);
|
||||
i0=call.indexOf(" ");
|
||||
call=call.mid(0,i0);
|
||||
}
|
||||
if(call.length()<3) return message;
|
||||
if(!call.contains(QRegExp("[0-9]|[A-Z]"))) return message;
|
||||
|
||||
logBook.match(/*in*/call,/*out*/countryName,callWorkedBefore,countryWorkedBefore);
|
||||
|
||||
message = message.trimmed ();
|
||||
QString appendage;
|
||||
if (!countryWorkedBefore) // therefore not worked call either
|
||||
{
|
||||
appendage += "!";
|
||||
*bg = color_DXCC;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!callWorkedBefore) // but have worked the country
|
||||
{
|
||||
appendage += "~";
|
||||
*bg = color_NewCall;
|
||||
}
|
||||
else
|
||||
{
|
||||
appendage += " "; // have worked this call before
|
||||
*bg = color_CQ;
|
||||
}
|
||||
}
|
||||
|
||||
// do some obvious abbreviations
|
||||
countryName.replace ("Islands", "Is.");
|
||||
countryName.replace ("Island", "Is.");
|
||||
countryName.replace ("North ", "N. ");
|
||||
countryName.replace ("Northern ", "N. ");
|
||||
countryName.replace ("South ", "S. ");
|
||||
countryName.replace ("East ", "E. ");
|
||||
countryName.replace ("Eastern ", "E. ");
|
||||
countryName.replace ("West ", "W. ");
|
||||
countryName.replace ("Western ", "W. ");
|
||||
countryName.replace ("Central ", "C. ");
|
||||
countryName.replace (" and ", " & ");
|
||||
countryName.replace ("Republic", "Rep.");
|
||||
countryName.replace ("United States", "U.S.A.");
|
||||
countryName.replace ("Fed. Rep. of ", "");
|
||||
countryName.replace ("French ", "Fr.");
|
||||
countryName.replace ("Asiatic", "AS");
|
||||
countryName.replace ("European", "EU");
|
||||
countryName.replace ("African", "AF");
|
||||
|
||||
appendage += countryName;
|
||||
|
||||
// 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,
|
||||
bool displayDXCCEntity, LogBook const& logBook,
|
||||
QColor color_CQ, QColor color_MyCall,
|
||||
QColor color_DXCC, QColor color_NewCall)
|
||||
{
|
||||
QColor bg {Qt::white};
|
||||
bool CQcall = false;
|
||||
if (decodedText.string ().contains (" CQ ")
|
||||
|| decodedText.string ().contains (" CQDX ")
|
||||
|| decodedText.string ().contains (" QRZ "))
|
||||
{
|
||||
CQcall = true;
|
||||
bg = color_CQ;
|
||||
}
|
||||
if (myCall != "" and (
|
||||
decodedText.indexOf (" " + myCall + " ") >= 0
|
||||
or decodedText.indexOf (" " + myCall + "/") >= 0
|
||||
or decodedText.indexOf ("/" + myCall + " ") >= 0
|
||||
or decodedText.indexOf ("<" + myCall + " ") >= 0
|
||||
or decodedText.indexOf (" " + myCall + ">") >= 0)) {
|
||||
bg = color_MyCall;
|
||||
}
|
||||
auto message = decodedText.string ();
|
||||
message = message.left (message.indexOf (QChar::Nbsp)); // strip appended info
|
||||
if (displayDXCCEntity && CQcall)
|
||||
// if enabled add the DXCC entity and B4 status to the end of the
|
||||
// preformated text line t1
|
||||
message = appendDXCCWorkedB4 (message, decodedText.CQersCall (), &bg, logBook, color_CQ,
|
||||
color_DXCC, color_NewCall);
|
||||
appendText (message.trimmed (), bg);
|
||||
}
|
||||
|
||||
|
||||
void DisplayText::displayTransmittedText(QString text, QString modeTx, qint32 txFreq,
|
||||
QColor color_TxMsg, bool bFastMode)
|
||||
{
|
||||
QString t1=" @ ";
|
||||
if(modeTx=="FT8") t1=" ~ ";
|
||||
if(modeTx=="JT4") t1=" $ ";
|
||||
if(modeTx=="JT65") t1=" # ";
|
||||
if(modeTx=="MSK144") t1=" & ";
|
||||
QString t2;
|
||||
t2.sprintf("%4d",txFreq);
|
||||
QString t;
|
||||
if(bFastMode or modeTx=="FT8") {
|
||||
t = QDateTime::currentDateTimeUtc().toString("hhmmss") + \
|
||||
" Tx " + t2 + t1 + text;
|
||||
} else {
|
||||
t = QDateTime::currentDateTimeUtc().toString("hhmm") + \
|
||||
" Tx " + t2 + t1 + text;
|
||||
}
|
||||
appendText (t, color_TxMsg);
|
||||
}
|
||||
|
||||
void DisplayText::displayQSY(QString text)
|
||||
{
|
||||
QString t = QDateTime::currentDateTimeUtc().toString("hhmmss") + " " + text;
|
||||
appendText (t, "hotpink");
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
|
||||
make-ldpc ex-ldpc-encode.pchk 200 400 1 evenboth 3
|
||||
|
||||
make-gen ex-ldpc-encode.pchk ex-ldpc-encode.genf sparse first
|
||||
Number of 1s per check in L is 6.4, U is 6.4, B is 3.0, total is 15.8
|
||||
make-gen ex-ldpc-encode.pchk ex-ldpc-encode.genc sparse mincol
|
||||
Number of 1s per check in L is 3.0, U is 3.3, B is 3.0, total is 9.3
|
||||
make-gen ex-ldpc-encode.pchk ex-ldpc-encode.genp sparse minprod
|
||||
Number of 1s per check in L is 2.4, U is 3.2, B is 3.0, total is 8.6
|
||||
make-gen ex-ldpc-encode.pchk ex-ldpc-encode.gend dense ex-ldpc-encode.genp
|
||||
Number of 1s per check in Inv(A) X B is 69.2
|
||||
make-gen ex-ldpc-encode.pchk ex-ldpc-encode.genm mixed ex-ldpc-encode.genp
|
||||
Number of 1s per check in Inv(A) is 64.7, in B is 3.0, total is 67.7
|
||||
|
||||
rand-src ex-ldpc-encode.src 1 200x10
|
||||
|
||||
encode ex-ldpc-encode.pchk ex-ldpc-encode.genf ex-ldpc-encode.src \
|
||||
ex-ldpc-encode.encf
|
||||
Encoded 10 blocks, source block size 200, encoded block size 400
|
||||
encode ex-ldpc-encode.pchk ex-ldpc-encode.genc ex-ldpc-encode.src \
|
||||
ex-ldpc-encode.encc
|
||||
Encoded 10 blocks, source block size 200, encoded block size 400
|
||||
encode ex-ldpc-encode.pchk ex-ldpc-encode.genp ex-ldpc-encode.src \
|
||||
ex-ldpc-encode.encp
|
||||
Encoded 10 blocks, source block size 200, encoded block size 400
|
||||
encode ex-ldpc-encode.pchk ex-ldpc-encode.gend ex-ldpc-encode.src \
|
||||
ex-ldpc-encode.encd
|
||||
Encoded 10 blocks, source block size 200, encoded block size 400
|
||||
encode ex-ldpc-encode.pchk ex-ldpc-encode.genm ex-ldpc-encode.src \
|
||||
ex-ldpc-encode.encm
|
||||
Encoded 10 blocks, source block size 200, encoded block size 400
|
||||
|
||||
cmp ex-ldpc-encode.encp ex-ldpc-encode.encd
|
||||
cmp ex-ldpc-encode.encp ex-ldpc-encode.encm
|
||||
|
||||
verify ex-ldpc-encode.pchk ex-ldpc-encode.encf ex-ldpc-encode.genf \
|
||||
ex-ldpc-encode.src
|
||||
Block counts: tot 10, with chk errs 0, with src errs 0, both 0
|
||||
Bit error rate (on message bits only): 0.000e+00
|
||||
verify ex-ldpc-encode.pchk ex-ldpc-encode.encc ex-ldpc-encode.genc \
|
||||
ex-ldpc-encode.src
|
||||
Block counts: tot 10, with chk errs 0, with src errs 0, both 0
|
||||
Bit error rate (on message bits only): 0.000e+00
|
||||
verify ex-ldpc-encode.pchk ex-ldpc-encode.encp ex-ldpc-encode.genp \
|
||||
ex-ldpc-encode.src
|
||||
Block counts: tot 10, with chk errs 0, with src errs 0, both 0
|
||||
Bit error rate (on message bits only): 0.000e+00
|
||||
@@ -1,105 +0,0 @@
|
||||
=== AP Decoding
|
||||
|
||||
With the QRA64 decoder Nico Palermo, IV3NWV, introduced a technique
|
||||
for decoding with the aid of information that naturally accumulates
|
||||
during a minimal QSO. This _a priori_ (AP) information can be
|
||||
used to increase the sensitivity of the decoder.
|
||||
|
||||
When an operator decides to answer a CQ, he already knows his own
|
||||
callsign and that of his potential QSO partner. He therefore knows
|
||||
what to expect for at least 56 of the 72 message bits in a
|
||||
standard-format response to his call. The _WSJT-X_ decoders for QRA64
|
||||
and FT8 can use these and similar AP bits to decode messages
|
||||
containing them with higher sensitivity than otherwise possible.
|
||||
|
||||
We have implemented AP decoding in slightly different ways in QRA64
|
||||
and FT8. To provide some explicit examples for users, we provide here
|
||||
a brief description of the FT8 behavior.
|
||||
|
||||
AP decoding attempts effectively set the AP bits to the hypothesized
|
||||
values, as if they had been received correctly. The decoder then
|
||||
proceeds to determine whether the remaining message and parity bits
|
||||
are consistent with the hypothesized AP bits. If a codeword is found
|
||||
that the decoder judges to have high (but not overwhelmingly high)
|
||||
probability of being correct, a ? character is appended when the
|
||||
decoded message is displayed. To avoid misleading spots of occasional
|
||||
false decodes, messages so marked are not forwarded to {pskreporter}.
|
||||
|
||||
Successful AP decodes are always labeled with an end-of-line indicator
|
||||
of the form aP, where P is one of the single-digit AP decoding types
|
||||
listed in Table 1. For example, an `a2` designator says that the
|
||||
successful decode used MyCall as hypothetically known information.
|
||||
|
||||
[[AP_INFO_TABLE]]
|
||||
.AP information types
|
||||
[width="35%",cols="h10,<m20",frame=topbot,options="header"]
|
||||
|===============================================
|
||||
|P | Message components
|
||||
|1 | CQ     ?     ?
|
||||
|2 | MyCall     ?     ?
|
||||
|3 | MyCall DxCall     ?
|
||||
|4 | MyCall DxCall RRR
|
||||
|5 | MyCall DxCall 73
|
||||
|6 | MyCall DxCall RR73
|
||||
|===============================================
|
||||
|
||||
Table 2 lists the six possible QSO states that are tracked by the
|
||||
WSJT-X auto-sequencer, along with the type of AP decoding that would
|
||||
be attempted in each state.
|
||||
|
||||
[[AP decoding types for each QSO state]]
|
||||
[width="35%",cols="h10,<m20",frame=topbot,options="header"]
|
||||
|===========================================
|
||||
|State |AP type
|
||||
|CALLING | 1, 2
|
||||
|REPLYING | 2, 3
|
||||
|REPORT | 2, 3
|
||||
|ROGER_REPORT | 3, 4, 5, 6
|
||||
|ROGERS | 3, 4, 5, 6
|
||||
|SIGNOFF | 3, 1, 2
|
||||
|===========================================
|
||||
|
||||
|
||||
=== Decoded Lines
|
||||
|
||||
Displayed information accompanying decoded messages generally includes UTC,
|
||||
signal-to-noise ratio in dB, time offset DT in seconds, and
|
||||
audio frequency in Hz. Some modes include additional information such
|
||||
as frequency offset from nominal (DF), frequency drift (Drift or F1),
|
||||
or distance (km or mi).
|
||||
|
||||
There may also be some cryptic characters with special meanings
|
||||
summarized in the following Table:
|
||||
|
||||
[[DECODED_LINES_TABLE]]
|
||||
.Notations used on decoded text lines
|
||||
[width="50%",cols="h,3*^",frame=topbot,options="header"]
|
||||
|===========================================
|
||||
|Mode |Mode character|Sync character|End of line information
|
||||
|FT8 | ~ | | ?   aP
|
||||
|JT4 | $ | *, # | f, fN, dNC
|
||||
|JT9 | @ | |
|
||||
|JT65 | # | |
|
||||
|JT65 VHF| # | *, # | f, fN, dNC
|
||||
|QRA64 | : | * | R
|
||||
|ISCAT | | * | M N C T
|
||||
|MSK144 | & | | N H E
|
||||
|===========================================
|
||||
Sync character::
|
||||
`*` - Normal sync +
|
||||
`#` - Alternate sync
|
||||
|
||||
End of line information::
|
||||
`?` - Decoded with lower confidence +
|
||||
`a` - Decoded with aid of some a priori (AP) information +
|
||||
`C` - Confidence indicator [ISCAT and Deep Search; (0-9,*)] +
|
||||
`d` - Deep Search algorithm +
|
||||
`E` - Size of MSK eye diagram opening - if negative, the eye is closed +
|
||||
`f` - Franke-Taylor or Fano algorithm +
|
||||
`H` - Number of bit errors corrected +
|
||||
`M` - Message length (characters) +
|
||||
`N` - Number of Rx intervals or frames averaged +
|
||||
`P` - Number indicating type of AP information (Table 1, above) +
|
||||
`R` - Return code from QRA64 decoder +
|
||||
`T` - Length of analyzed region (s)
|
||||
|
||||
Reference in New Issue
Block a user