Merged master 8748
This commit is contained in:
@@ -1,166 +0,0 @@
|
||||
/* ALIST-TO-PCHK.C - Convert a parity check matrix to alist format. */
|
||||
|
||||
/* Copyright (c) 1995-2012 by Radford M. Neal.
|
||||
*
|
||||
* Permission is granted for anyone to copy, use, modify, and distribute
|
||||
* these programs and accompanying documents for any purpose, provided
|
||||
* this copyright notice is retained and prominently displayed, and note
|
||||
* is made of any changes made to these programs. These programs and
|
||||
* documents are distributed without any warranty, express or implied.
|
||||
* As the programs were written for research purposes only, they have not
|
||||
* been tested to the degree that would be advisable in any important
|
||||
* application. All use of these programs is entirely at the user's own
|
||||
* risk.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "alloc.h"
|
||||
#include "open.h"
|
||||
#include "mod2sparse.h"
|
||||
#include "mod2dense.h"
|
||||
#include "mod2convert.h"
|
||||
#include "rcode.h"
|
||||
|
||||
|
||||
void usage(void);
|
||||
|
||||
|
||||
/* MAIN PROGRAM. */
|
||||
|
||||
int main
|
||||
( int argc,
|
||||
char **argv
|
||||
)
|
||||
{
|
||||
char *alist_file, *pchk_file;
|
||||
FILE *af, *pf;
|
||||
int mxrw, mxcw;
|
||||
int *rw, *cw;
|
||||
int i, j, k;
|
||||
mod2entry *e;
|
||||
int trans;
|
||||
int nozeros;
|
||||
int last;
|
||||
|
||||
trans = 0;
|
||||
nozeros = 0;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if (argc>1 && strcmp(argv[1],"-t")==0)
|
||||
{ trans = 1;
|
||||
argc -= 1;
|
||||
argv += 1;
|
||||
}
|
||||
else if (argc>1 && strcmp(argv[1],"-z")==0)
|
||||
{ nozeros = 1;
|
||||
argc -= 1;
|
||||
argv += 1;
|
||||
}
|
||||
else
|
||||
{ break;
|
||||
}
|
||||
}
|
||||
|
||||
if (argc!=3)
|
||||
{ usage();
|
||||
}
|
||||
|
||||
pchk_file = argv[1];
|
||||
alist_file = argv[2];
|
||||
|
||||
read_pchk(pchk_file);
|
||||
|
||||
if (trans)
|
||||
{ mod2sparse *HT;
|
||||
HT = H;
|
||||
H = mod2sparse_allocate(N,M);
|
||||
mod2sparse_transpose(HT,H);
|
||||
M = mod2sparse_rows(H);
|
||||
N = mod2sparse_cols(H);
|
||||
}
|
||||
|
||||
af = open_file_std(alist_file,"wb");
|
||||
|
||||
if (af==NULL)
|
||||
{ fprintf(stderr,"Can't create alist file: %s\n",alist_file);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
fprintf(af,"%d %d\n",M,N);
|
||||
|
||||
rw = (int *) chk_alloc (M, sizeof *rw);
|
||||
mxrw = 0;
|
||||
|
||||
for (i = 0; i<M; i++)
|
||||
{ rw[i] = mod2sparse_count_row(H,i);
|
||||
if (rw[i]>mxrw)
|
||||
{ mxrw = rw[i];
|
||||
}
|
||||
}
|
||||
|
||||
cw = (int *) chk_alloc (N, sizeof *cw);
|
||||
mxcw = 0;
|
||||
|
||||
for (j = 0; j<N; j++)
|
||||
{ cw[j] = mod2sparse_count_col(H,j);
|
||||
if (cw[j]>mxcw)
|
||||
{ mxcw = cw[j];
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(af,"%d %d\n",mxrw,mxcw);
|
||||
|
||||
for (i = 0; i<M; i++)
|
||||
{ fprintf(af,"%d%c",rw[i],i==M-1?'\n':' ');
|
||||
}
|
||||
|
||||
for (j = 0; j<N; j++)
|
||||
{ fprintf(af,"%d%c",cw[j],j==N-1?'\n':' ');
|
||||
}
|
||||
|
||||
for (i = 0; i<M; i++)
|
||||
{ e = mod2sparse_first_in_row(H,i);
|
||||
last = 0;
|
||||
for (k = 0; !last; k++)
|
||||
{ last = nozeros ? k==rw[i]-1 : k==mxrw-1;
|
||||
fprintf (af, "%d%c", mod2sparse_at_end(e)?0:mod2sparse_col(e)+1,
|
||||
last?'\n':' ');
|
||||
if (!mod2sparse_at_end(e))
|
||||
{ e = mod2sparse_next_in_row(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (j = 0; j<N; j++)
|
||||
{ e = mod2sparse_first_in_col(H,j);
|
||||
last = 0;
|
||||
for (k = 0; !last; k++)
|
||||
{ last = nozeros ? k==cw[j]-1 : k==mxcw-1;
|
||||
fprintf (af, "%d%c", mod2sparse_at_end(e)?0:mod2sparse_row(e)+1,
|
||||
last?'\n':' ');
|
||||
if (!mod2sparse_at_end(e))
|
||||
{ e = mod2sparse_next_in_col(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ferror(af) || fclose(af)!=0)
|
||||
{ fprintf(stderr,"Error writing to alist file %s\n",alist_file);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* PRINT USAGE MESSAGE AND EXIT. */
|
||||
|
||||
void usage(void)
|
||||
{ fprintf(stderr,"Usage: pchk-to-alist [ -t ] [ -z ] pchk-file alist-file\n");
|
||||
exit(1);
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,197 +0,0 @@
|
||||
#include "decodedtext.h"
|
||||
|
||||
#include <QStringList>
|
||||
#include <QRegularExpression>
|
||||
|
||||
extern "C" {
|
||||
bool stdmsg_(const char* msg, int len);
|
||||
}
|
||||
|
||||
DecodedText::DecodedText (QString const& the_string)
|
||||
: string_ {the_string}
|
||||
, padding_ {the_string.indexOf (" ") > 4 ? 2 : 0} // allow for
|
||||
// seconds
|
||||
, message_ {string_.mid (column_qsoText + padding_).trimmed ()}
|
||||
, is_standard_ {false}
|
||||
{
|
||||
if (message_.length() >= 1)
|
||||
{
|
||||
message_ = message_.left (22).remove (QRegularExpression {"[<>]"});
|
||||
int i1 = message_.indexOf ('\r');
|
||||
if (i1 > 0)
|
||||
{
|
||||
message_ = message_.left (i1 - 1);
|
||||
}
|
||||
// stdmsg is a fortran routine that packs the text, unpacks it and compares the result
|
||||
is_standard_ = stdmsg_ ((message_ + " ").toLatin1 ().constData (),22);
|
||||
}
|
||||
};
|
||||
|
||||
void DecodedText::removeAddedInfo ()
|
||||
{
|
||||
if (string_.indexOf (" CQ ") > 0) {
|
||||
// TODO this magic 37 characters is also referenced in DisplayText::_appendDXCCWorkedB4()
|
||||
auto eom_pos = string_.indexOf (' ', 37);
|
||||
if (eom_pos < 37) eom_pos = string_.size () - 1; // we always want at least the characters
|
||||
// to position 37
|
||||
string_ = string_.left (eom_pos + 1); // remove DXCC entity and worked B4 status. TODO need a better way to do this
|
||||
}
|
||||
}
|
||||
|
||||
QString DecodedText::CQersCall() const
|
||||
{
|
||||
QRegularExpression callsign_re {R"(^(CQ|DE|QRZ)(\s?DX|\s([A-Z]{2}|\d{3}))?\s(?<callsign>[A-Z0-9/]{2,})(\s[A-R]{2}[0-9]{2})?)"};
|
||||
return callsign_re.match (message_).captured ("callsign");
|
||||
}
|
||||
|
||||
|
||||
bool DecodedText::isJT65() const
|
||||
{
|
||||
return string_.indexOf("#") == column_mode + padding_;
|
||||
}
|
||||
|
||||
bool DecodedText::isJT9() const
|
||||
{
|
||||
return string_.indexOf("@") == column_mode + padding_;
|
||||
}
|
||||
|
||||
bool DecodedText::isTX() const
|
||||
{
|
||||
int i = string_.indexOf("Tx");
|
||||
return (i >= 0 && i < 15); // TODO guessing those numbers. Does Tx ever move?
|
||||
}
|
||||
|
||||
bool DecodedText::isLowConfidence () const
|
||||
{
|
||||
return QChar {'?'} == string_.mid (padding_ + column_qsoText + 21, 1);
|
||||
}
|
||||
|
||||
int DecodedText::frequencyOffset() const
|
||||
{
|
||||
return string_.mid(column_freq + padding_,4).toInt();
|
||||
}
|
||||
|
||||
int DecodedText::snr() const
|
||||
{
|
||||
int i1=string_.indexOf(" ")+1;
|
||||
return string_.mid(i1,3).toInt();
|
||||
}
|
||||
|
||||
float DecodedText::dt() const
|
||||
{
|
||||
return string_.mid(column_dt + padding_,5).toFloat();
|
||||
}
|
||||
|
||||
/*
|
||||
2343 -11 0.8 1259 # YV6BFE F6GUU R-08
|
||||
2343 -19 0.3 718 # VE6WQ SQ2NIJ -14
|
||||
2343 -7 0.3 815 # KK4DSD W7VP -16
|
||||
2343 -13 0.1 3627 @ CT1FBK IK5YZT R+02
|
||||
|
||||
0605 Tx 1259 # CQ VK3ACF QF22
|
||||
*/
|
||||
|
||||
// find and extract any report. Returns true if this is a standard message
|
||||
bool DecodedText::report(QString const& myBaseCall, QString const& dxBaseCall, /*mod*/QString& report) const
|
||||
{
|
||||
if (message_.size () < 1) return false;
|
||||
|
||||
QStringList const& w = message_.split(" ",QString::SkipEmptyParts);
|
||||
if (w.size ()
|
||||
&& is_standard_ && (w[0] == myBaseCall
|
||||
|| w[0].endsWith ("/" + myBaseCall)
|
||||
|| w[0].startsWith (myBaseCall + "/")
|
||||
|| (w.size () > 1 && !dxBaseCall.isEmpty ()
|
||||
&& (w[1] == dxBaseCall
|
||||
|| w[1].endsWith ("/" + dxBaseCall)
|
||||
|| w[1].startsWith (dxBaseCall + "/")))))
|
||||
{
|
||||
QString tt="";
|
||||
if(w.size() > 2) tt=w[2];
|
||||
bool ok;
|
||||
auto i1=tt.toInt(&ok);
|
||||
if (ok and i1>=-50 and i1<50)
|
||||
{
|
||||
report = tt;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tt.mid(0,1)=="R")
|
||||
{
|
||||
i1=tt.mid(1).toInt(&ok);
|
||||
if(ok and i1>=-50 and i1<50)
|
||||
{
|
||||
report = tt.mid(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return is_standard_;
|
||||
}
|
||||
|
||||
// get the first text word, usually the call
|
||||
QString DecodedText::call() const
|
||||
{
|
||||
auto call = string_;
|
||||
call = call.replace (QRegularExpression {" CQ ([A-Z]{2,2}|[0-9]{3,3}) "}, " CQ_\\1 ").mid (column_qsoText + padding_);
|
||||
int i = call.indexOf(" ");
|
||||
return call.mid(0,i);
|
||||
}
|
||||
|
||||
// get the second word, most likely the de call and the third word, most likely grid
|
||||
void DecodedText::deCallAndGrid(/*out*/QString& call, QString& grid) const
|
||||
{
|
||||
auto msg = string_;
|
||||
if(msg.mid(4,1)!=" ") msg=msg.mid(0,4)+msg.mid(6,-1); //Remove seconds from UTC
|
||||
msg = msg.replace (QRegularExpression {" CQ ([A-Z]{2,2}|[0-9]{3,3}) "}, " CQ_\\1 ").mid (column_qsoText + padding_);
|
||||
int i1 = msg.indexOf (" ");
|
||||
call = msg.mid (i1 + 1);
|
||||
int i2 = call.indexOf (" ");
|
||||
if (" R " == call.mid (i2, 3)) // MSK144 contest mode report
|
||||
{
|
||||
grid = call.mid (i2 + 3, 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
grid = call.mid (i2 + 1, 4);
|
||||
}
|
||||
call = call.left (i2).replace (">", "");
|
||||
}
|
||||
|
||||
int DecodedText::timeInSeconds() const
|
||||
{
|
||||
return 60*string_.mid(column_time,2).toInt() + string_.mid(2,2).toInt();
|
||||
}
|
||||
|
||||
/*
|
||||
2343 -11 0.8 1259 # YV6BFE F6GUU R-08
|
||||
2343 -19 0.3 718 # VE6WQ SQ2NIJ -14
|
||||
2343 -7 0.3 815 # KK4DSD W7VP -16
|
||||
2343 -13 0.1 3627 @ CT1FBK IK5YZT R+02
|
||||
|
||||
0605 Tx 1259 # CQ VK3ACF QF22
|
||||
*/
|
||||
|
||||
QString DecodedText::report() const // returns a string of the SNR field with a leading + or - followed by two digits
|
||||
{
|
||||
int sr = snr();
|
||||
if (sr<-50)
|
||||
sr = -50;
|
||||
else
|
||||
if (sr > 49)
|
||||
sr = 49;
|
||||
|
||||
QString rpt;
|
||||
rpt.sprintf("%d",abs(sr));
|
||||
if (sr > 9)
|
||||
rpt = "+" + rpt;
|
||||
else
|
||||
if (sr >= 0)
|
||||
rpt = "+0" + rpt;
|
||||
else
|
||||
if (sr >= -9)
|
||||
rpt = "-0" + rpt;
|
||||
else
|
||||
rpt = "-" + rpt;
|
||||
return rpt;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,117 +0,0 @@
|
||||
#-------------------------------------------------
|
||||
#
|
||||
# Project created by QtCreator 2011-07-07T08:39:24
|
||||
#
|
||||
#-------------------------------------------------
|
||||
|
||||
QT += network multimedia
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
CONFIG += thread
|
||||
#CONFIG += console
|
||||
|
||||
TARGET = wsjtx
|
||||
VERSION = "Not for Release"
|
||||
TEMPLATE = app
|
||||
DEFINES = QT5
|
||||
QMAKE_CXXFLAGS += -std=c++11
|
||||
DEFINES += PROJECT_MANUAL="'\"http://www.physics.princeton.edu/pulsar/K1JT/wsjtx-doc/wsjtx-main.html\"'"
|
||||
|
||||
isEmpty (DESTDIR) {
|
||||
DESTDIR = ../wsjtx_exp_install
|
||||
}
|
||||
|
||||
isEmpty (HAMLIB_DIR) {
|
||||
HAMLIB_DIR = ../../hamlib3/mingw32
|
||||
}
|
||||
|
||||
isEmpty (FFTW3_DIR) {
|
||||
FFTW3_DIR = .
|
||||
}
|
||||
|
||||
F90 = gfortran
|
||||
gfortran.output = ${QMAKE_FILE_BASE}.o
|
||||
gfortran.commands = $$F90 -c -O2 -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_NAME}
|
||||
gfortran.input = F90_SOURCES
|
||||
QMAKE_EXTRA_COMPILERS += gfortran
|
||||
|
||||
win32 {
|
||||
DEFINES += WIN32
|
||||
QT += axcontainer
|
||||
TYPELIBS = $$system(dumpcpp -getfile {4FE359C5-A58F-459D-BE95-CA559FB4F270})
|
||||
}
|
||||
|
||||
unix {
|
||||
DEFINES += UNIX
|
||||
}
|
||||
|
||||
#
|
||||
# Order matters here as the link is in this order so referrers need to be after referred
|
||||
#
|
||||
SOURCES += \
|
||||
logbook/adif.cpp \
|
||||
logbook/countrydat.cpp \
|
||||
logbook/countriesworked.cpp \
|
||||
logbook/logbook.cpp \
|
||||
astro.cpp Radio.cpp NetworkServerLookup.cpp revision_utils.cpp \
|
||||
Transceiver.cpp TransceiverBase.cpp TransceiverFactory.cpp \
|
||||
PollingTransceiver.cpp EmulateSplitTransceiver.cpp LettersSpinBox.cpp \
|
||||
HRDTransceiver.cpp DXLabSuiteCommanderTransceiver.cpp \
|
||||
HamlibTransceiver.cpp FrequencyLineEdit.cpp Bands.cpp \
|
||||
FrequencyList.cpp StationList.cpp ForeignKeyDelegate.cpp \
|
||||
FrequencyItemDelegate.cpp LiveFrequencyValidator.cpp \
|
||||
Configuration.cpp psk_reporter.cpp AudioDevice.cpp \
|
||||
Modulator.cpp Detector.cpp logqso.cpp displaytext.cpp \
|
||||
getfile.cpp soundout.cpp soundin.cpp meterwidget.cpp signalmeter.cpp \
|
||||
WFPalette.cpp plotter.cpp widegraph.cpp about.cpp WsprTxScheduler.cpp mainwindow.cpp \
|
||||
main.cpp decodedtext.cpp wsprnet.cpp messageaveraging.cpp \
|
||||
echoplot.cpp echograph.cpp fastgraph.cpp fastplot.cpp Modes.cpp \
|
||||
WSPRBandHopping.cpp MessageAggregator.cpp SampleDownloader.cpp qt_helpers.cpp\
|
||||
MultiSettings.cpp PhaseEqualizationDialog.cpp
|
||||
|
||||
HEADERS += qt_helpers.hpp \
|
||||
pimpl_h.hpp pimpl_impl.hpp \
|
||||
Radio.hpp NetworkServerLookup.hpp revision_utils.hpp \
|
||||
mainwindow.h plotter.h soundin.h soundout.h astro.h \
|
||||
about.h WFPalette.hpp widegraph.h getfile.h decodedtext.h \
|
||||
commons.h sleep.h displaytext.h logqso.h LettersSpinBox.hpp \
|
||||
Bands.hpp FrequencyList.hpp StationList.hpp ForeignKeyDelegate.hpp FrequencyItemDelegate.hpp LiveFrequencyValidator.hpp \
|
||||
FrequencyLineEdit.hpp AudioDevice.hpp Detector.hpp Modulator.hpp psk_reporter.h \
|
||||
Transceiver.hpp TransceiverBase.hpp TransceiverFactory.hpp PollingTransceiver.hpp \
|
||||
EmulateSplitTransceiver.hpp DXLabSuiteCommanderTransceiver.hpp HamlibTransceiver.hpp \
|
||||
Configuration.hpp wsprnet.h signalmeter.h meterwidget.h \
|
||||
logbook/logbook.h logbook/countrydat.h logbook/countriesworked.h logbook/adif.h \
|
||||
messageaveraging.h echoplot.h echograph.h fastgraph.h fastplot.h Modes.hpp WSPRBandHopping.hpp \
|
||||
WsprTxScheduler.h SampleDownloader.hpp MultiSettings.hpp PhaseEqualizationDialog.hpp
|
||||
|
||||
INCLUDEPATH += qmake_only
|
||||
|
||||
win32 {
|
||||
SOURCES += killbyname.cpp OmniRigTransceiver.cpp
|
||||
HEADERS += OmniRigTransceiver.hpp
|
||||
}
|
||||
|
||||
FORMS += mainwindow.ui about.ui Configuration.ui widegraph.ui astro.ui \
|
||||
logqso.ui wf_palette_design_dialog.ui messageaveraging.ui echograph.ui \
|
||||
fastgraph.ui
|
||||
|
||||
RC_FILE = wsjtx.rc
|
||||
RESOURCES = wsjtx.qrc
|
||||
|
||||
unix {
|
||||
LIBS += -L lib -ljt9
|
||||
LIBS += -lhamlib
|
||||
LIBS += -lfftw3f $$system($$F90 -print-file-name=libgfortran.so)
|
||||
}
|
||||
|
||||
win32 {
|
||||
INCLUDEPATH += $${HAMLIB_DIR}/include
|
||||
INCLUDEPATH += C:\JTSDK\wsjtx_exp\build\Release
|
||||
INCLUDEPATH += C:\JTSDK\hamlib3\include
|
||||
INCLUDEPATH += C:\JTSDK\qt5\5.2.1\mingw48_32\include\QtSerialPort
|
||||
|
||||
LIBS += -L$${HAMLIB_DIR}/lib -lhamlib
|
||||
LIBS += -L./lib -lastro -ljt9
|
||||
LIBS += -L$${FFTW3_DIR} -lfftw3f-3
|
||||
LIBS += -lws2_32
|
||||
LIBS += $$system($$F90 -print-file-name=libgfortran.a)
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
subroutine pctile(x,npts,npct,xpct)
|
||||
|
||||
parameter (NMAX=100000)
|
||||
real*4 x(npts)
|
||||
real*4 tmp(NMAX)
|
||||
|
||||
if(npts.le.0) then
|
||||
xpct=1.0
|
||||
go to 900
|
||||
endif
|
||||
if(npts.gt.NMAX) stop
|
||||
|
||||
tmp(1:npts)=x
|
||||
call shell(npts,tmp)
|
||||
j=nint(npts*0.01*npct)
|
||||
if(j.lt.1) j=1
|
||||
if(j.gt.npts) j=npts
|
||||
xpct=tmp(j)
|
||||
|
||||
900 continue
|
||||
return
|
||||
end subroutine pctile
|
||||
@@ -1,98 +0,0 @@
|
||||
For this step and the next, you may want to pretend you are K1JT
|
||||
by entering that callsign temporarily as *My Call* on the
|
||||
*Settings | General* tab. Your results should then be identical to
|
||||
those shown in the screen shot below.
|
||||
|
||||
.Open a Wave File:
|
||||
|
||||
- Select *File | Open* and select the file
|
||||
+...\save\samples\JT9\130418_1742.wav+. When the file opens you should
|
||||
see something similar to the following screen shot:
|
||||
|
||||
[[X12]]
|
||||
image::main-ui.png[align="center",alt="Main UI and Wide Graph"]
|
||||
|
||||
.Decoding Overview
|
||||
|
||||
Decoding takes place at the end of a receive sequence and proceeds in
|
||||
two steps. The first decode is done at the selected Rx frequency,
|
||||
indicated by the U-shaped green marker on the waterfall scale.
|
||||
Results appear in both the left (*Band Activity*) and right (*Rx
|
||||
Frequency*) text windows on the main screen. The program then finds
|
||||
and decodes all signals in the selected mode over the displayed
|
||||
frequency range. The red marker on the waterfall scale indicates your
|
||||
Tx frequency.
|
||||
|
||||
Seven JT9 signals are present in the example file, all decodable.
|
||||
When this file was recorded KF4RWA was finishing a QSO with K1JT.
|
||||
Since the green marker was placed at his audio frequency, 1224 Hz, his
|
||||
message `K1JT KF4RWA 73` is decoded first and appears in the *Rx
|
||||
Frequency* window. The *Band Activity* window shows this message plus
|
||||
all decodes at other frequencies. By default lines containing `CQ`
|
||||
are highlighted in green, and lines with *My Call* (in this case K1JT)
|
||||
in red.
|
||||
|
||||
[[X13]]
|
||||
.Decoding Controls
|
||||
|
||||
To gain some feeling for controls frequently used when making QSOs,
|
||||
try clicking with the mouse on the decoded text lines and on the
|
||||
waterfall spectral display. You should be able to confirm the
|
||||
following behavior:
|
||||
|
||||
- Double-click on either of the decoded lines highlighted in
|
||||
green. This action produces the following results:
|
||||
|
||||
** Callsign and locator of a station calling CQ are copied to the *DX
|
||||
Call* and *DX Grid* entry fields.
|
||||
|
||||
** Messages are generated for a standard minimal QSO.
|
||||
|
||||
** The *Tx even* box is checked or cleared appropriately, so that you
|
||||
will transmit in the proper (odd or even) minutes.
|
||||
|
||||
** The Rx and Tx frequency markers are moved to the frequency of the
|
||||
CQing station.
|
||||
|
||||
** The *Gen Msg* ("`generated message`") radio button at bottom right
|
||||
of the main window is selected.
|
||||
|
||||
** If you had checked *Double-click on call sets Tx Enable* on the
|
||||
*Setup* menu, *Enable Tx* would be activated and a transmission would
|
||||
start automatically at the proper time.
|
||||
|
||||
- Double-click on the decoded message `K1JT N5KDV EM41`,
|
||||
highlighted in red. Results will be similar to those in the
|
||||
previous step, except the Tx frequency (red marker) is not
|
||||
moved. Such messages are usually in response to your own CQ, or from
|
||||
a tail-ender, and you probably want your Tx frequency to stay where it
|
||||
was.
|
||||
|
||||
- By holding down the *Ctrl* key when double-clicking on a decoded
|
||||
line you can cause both Tx and Rx frequencies to be moved. This
|
||||
behavior can also be forced by checking *Lock Tx=Rx*.
|
||||
|
||||
- Double-click on the message from KF4RWA in either window. He is
|
||||
sending `73` to K1JT, signifying that the QSO is over. Most likely
|
||||
you want to send 73 to him, so the message `KF4RWA K1JT 73` is
|
||||
automatically generated and selected for your next transmission.
|
||||
(Alternatively, you might choose to send a free-text message or to
|
||||
call CQ again.)
|
||||
|
||||
- Click somewhere on the waterfall to set Rx frequency (green marker
|
||||
on waterfall scale).
|
||||
|
||||
- Shift-click on the waterfall to set Tx frequency (red marker).
|
||||
|
||||
- Ctrl-click on the waterfall to set both Rx and Tx frequencies.
|
||||
|
||||
- Double-click on a signal in the waterfall to set Rx frequency and
|
||||
start a narrow-band decode there. Decoded text will appear in the
|
||||
right window only.
|
||||
|
||||
- Ctrl-double-click on a signal to set both Rx and Tx frequencies and
|
||||
decode at the new frequency.
|
||||
|
||||
- Click *Erase* to clear the right window.
|
||||
|
||||
- Double-click *Erase* to clear both text windows.
|
||||
@@ -1,241 +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 ctrl = (e->modifiers() & Qt::ControlModifier);
|
||||
bool alt = (e->modifiers() & Qt::AltModifier);
|
||||
emit(selectCallsign(alt,ctrl));
|
||||
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");
|
||||
}
|
||||
Reference in New Issue
Block a user