Merged master 8748

This commit is contained in:
Jordan Sherer
2018-08-05 11:33:30 -04:00
parent 8f8772f1bd
commit 62899069bf
1222 changed files with 70382 additions and 406763 deletions
@@ -1,207 +0,0 @@
#include "displaytext.h"
#include <QMouseEvent>
#include <QDateTime>
#include <QTextCharFormat>
#include <QFont>
#include <QTextCursor>
#include "qt_helpers.hpp"
#include "moc_displaytext.cpp"
DisplayText::DisplayText(QWidget *parent) :
QTextEdit(parent)
{
setReadOnly (true);
viewport ()->setCursor (Qt::ArrowCursor);
setWordWrapMode (QTextOption::NoWrap);
setStyleSheet ("");
}
void DisplayText::setContentFont(QFont const& font)
{
setFont (font);
m_charFormat.setFont (font);
selectAll ();
auto cursor = textCursor ();
cursor.mergeCharFormat (m_charFormat);
cursor.clearSelection ();
cursor.movePosition (QTextCursor::End);
// position so viewport scrolled to left
cursor.movePosition (QTextCursor::Up);
cursor.movePosition (QTextCursor::StartOfLine);
setTextCursor (cursor);
ensureCursorVisible ();
}
void DisplayText::mouseDoubleClickEvent(QMouseEvent *e)
{
bool ctrl = (e->modifiers() & Qt::ControlModifier);
bool shift = (e->modifiers() & Qt::ShiftModifier);
emit(selectCallsign(shift,ctrl));
QTextEdit::mouseDoubleClickEvent(e);
}
void DisplayText::insertLineSpacer(QString const& line)
{
appendText (line, "#d3d3d3");
}
void DisplayText::appendText(QString const& text, QString const& bg)
{
QString escaped {text.trimmed().replace('<',"&lt;").replace('>',"&gt;").replace(' ', "&nbsp;")};
QString s = "<table border=0 cellspacing=0 width=100%><tr><td bgcolor=\"" +
bg + "\">" + escaped + "</td></tr></table>";
auto cursor = textCursor ();
cursor.movePosition (QTextCursor::End);
auto pos = cursor.position ();
cursor.insertHtml (s);
cursor.setPosition (pos, QTextCursor::MoveAnchor);
cursor.movePosition (QTextCursor::End, QTextCursor::KeepAnchor);
cursor.mergeCharFormat (m_charFormat);
cursor.clearSelection ();
// position so viewport scrolled to left
cursor.movePosition (QTextCursor::Up);
cursor.movePosition (QTextCursor::StartOfLine);
setTextCursor (cursor);
ensureCursorVisible ();
}
void DisplayText::_appendDXCCWorkedB4(DecodedText& t1, QString& bg,
LogBook logBook, QColor color_CQ,
QColor color_DXCC,
QColor color_NewCall)
{
QString call = t1.CQersCall ();
QString countryName;
bool callWorkedBefore;
bool countryWorkedBefore;
if(call.length()==2) {
int i0=t1.indexOf("CQ "+call);
call=t1.mid(i0+6,-1);
i0=call.indexOf(" ");
call=call.mid(0,i0);
}
if(call.length()<3) return;
if(!call.contains(QRegExp("[0-9]")) or !call.contains(QRegExp("[A-Z]"))) return;
logBook.match(/*in*/call,/*out*/countryName,callWorkedBefore,countryWorkedBefore);
int charsAvail = 48;
// the decoder (seems) to always generate 41 chars. For a normal CQ call, the last five are spaces
// TODO this magic 37 characters is also referenced in MainWindow::doubleClickOnCall()
int nmin=37;
int i=t1.indexOf(" CQ ");
int k=t1.string().mid(i+4,3).toInt();
if(k>0 and k<999) nmin += 4;
int s3 = t1.indexOf(" ",nmin);
if (s3 < nmin) s3 = nmin; // always want at least the characters to position 35
s3 += 1; // convert the index into a character count
t1 = t1.left(s3); // reduce trailing white space
charsAvail -= s3;
if (charsAvail > 4)
{
if (!countryWorkedBefore) // therefore not worked call either
{
t1 += "!";
bg=color_DXCC.name();
}
else
if (!callWorkedBefore) // but have worked the country
{
t1 += "~";
bg=color_NewCall.name();
}
else
{
t1 += " "; // have worked this call before
bg=color_CQ.name();
}
charsAvail -= 1;
// 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");
t1 += countryName;
}
}
void DisplayText::displayDecodedText(DecodedText decodedText, QString myCall,
bool displayDXCCEntity, LogBook logBook,
QColor color_CQ, QColor color_MyCall,
QColor color_DXCC, QColor color_NewCall)
{
QString bg="white";
bool CQcall = false;
if (decodedText.string ().contains (" CQ ")
|| decodedText.string ().contains (" CQDX ")
|| decodedText.string ().contains (" QRZ "))
{
CQcall = true;
bg=color_CQ.name();
}
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.name();
}
// if enabled add the DXCC entity and B4 status to the end of the preformated text line t1
if (displayDXCCEntity && CQcall)
_appendDXCCWorkedB4(/*mod*/decodedText,bg,logBook,color_CQ,
color_DXCC,color_NewCall);
appendText(decodedText.string(),bg);
}
void DisplayText::displayTransmittedText(QString text, QString modeTx, qint32 txFreq,
QColor color_TxMsg, bool bFastMode)
{
QString bg=color_TxMsg.name();
QString t1=" @ ";
if(modeTx=="JT4") t1=" $ ";
if(modeTx=="JT65") t1=" # ";
if(modeTx=="MSK144") t1=" & ";
QString t2;
t2.sprintf("%4d",txFreq);
QString t;
if(bFastMode) {
t = QDateTime::currentDateTimeUtc().toString("hhmmss") + \
" Tx " + t2 + t1 + text;
} else {
t = QDateTime::currentDateTimeUtc().toString("hhmm") + \
" Tx " + t2 + t1 + text;
}
appendText(t,bg);
}
void DisplayText::displayQSY(QString text)
{
QString t = QDateTime::currentDateTimeUtc().toString("hhmmss") + " " + text;
QString bg="hot pink";
appendText(t,bg);
}
@@ -0,0 +1,17 @@
# Copyright (C) 2002-2003 David Abrahams.
# Copyright (C) 2002-2003 Vladimir Prus.
# Copyright (C) 2003,2007 Rene Rivera.
# Use, modification and distribution are subject to the
# Boost Software License, Version 1.0. (See accompanying file
# LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
# This is the initial file loaded by Boost Jam when run from any Boost library
# folder. It allows us to choose which Boost Build installation to use for
# building Boost libraries. Unless explicitly selected using a command-line
# option, the version included with the Boost library distribution is used (as
# opposed to any other Boost Build version installed on the user's sytem).
BOOST_ROOT = $(.boost-build-file:D) ;
BOOST_BUILD = [ MATCH --boost-build=(.*) : $(ARGV) ] ;
BOOST_BUILD ?= tools/build/src ;
boost-build $(BOOST_BUILD) ;
@@ -1,57 +0,0 @@
subroutine genft8(msg,mygrid,bcontest,msgsent,msgbits,itone)
! Encode an FT8 message, producing array itone().
use crc
use packjt
include 'ft8_params.f90'
character*22 msg,msgsent
character*6 mygrid
character*87 cbits
logical bcontest
integer*4 i4Msg6BitWords(12) !72-bit message as 6-bit words
integer*1 msgbits(KK),codeword(3*ND)
integer*1, target:: i1Msg8BitBytes(11)
integer itone(NN)
integer icos7(0:6)
data icos7/2,5,6,0,4,1,3/ !Costas 7x7 tone pattern
call packmsg(msg,i4Msg6BitWords,itype,bcontest) !Pack into 12 6-bit bytes
call unpackmsg(i4Msg6BitWords,msgsent,bcontest,mygrid) !Unpack to get msgsent
i3bit=0 !### temporary ###
write(cbits,1000) i4Msg6BitWords,32*i3bit
1000 format(12b6.6,b8.8)
read(cbits,1001) i1Msg8BitBytes(1:10)
1001 format(10b8)
i1Msg8BitBytes(10)=iand(i1Msg8BitBytes(10),128+64+32)
i1Msg8BitBytes(11)=0
icrc12=crc12(c_loc(i1Msg8BitBytes),11)
! For reference, here's how to check the CRC
! i1Msg8BitBytes(10)=icrc12/256
! i1Msg8BitBytes(11)=iand (icrc12,255)
! checksumok = crc12_check(c_loc (i1Msg8BitBytes), 11)
! if( checksumok ) write(*,*) 'Good checksum'
write(cbits,1003) i4Msg6BitWords,i3bit,icrc12
1003 format(12b6.6,b3.3,b12.12)
read(cbits,1004) msgbits
1004 format(87i1)
call encode174(msgbits,codeword) !Encode the test message
! Message structure: S7 D29 S7 D29 S7
itone(1:7)=icos7
itone(36+1:36+7)=icos7
itone(NN-6:NN)=icos7
k=7
do j=1,ND
i=3*j -2
k=k+1
if(j.eq.30) k=k+7
itone(k)=codeword(i)*4 + codeword(i+1)*2 + codeword(i+2)
enddo
return
end subroutine genft8
@@ -0,0 +1,148 @@
subroutine foxgen()
! Called from MainWindow::foxTxSequencer() to generate the Tx waveform in
! FT8 Fox mode. The Tx message can contain up to 5 "slots", each carrying
! its own FT8 signal.
! Encoded messages can be of the form "HoundCall FoxCall rpt" (a standard FT8
! message with i3bit=0) or "HoundCall_1 RR73; HoundCall_2 <FoxCall> rpt",
! a new message type with i3bit=1. The waveform is generated with
! fsample=48000 Hz; it is compressed to reduce the PEP-to-average power ratio,
! with (currently disabled) filtering afterware to reduce spectral growth.
! Input message information is provided in character array cmsg(5), in
! common/foxcom/. The generated wave(NWAVE) is passed back in the same
! common block.
use crc
parameter (NN=79,ND=58,KK=87,NSPS=4*1920)
parameter (NWAVE=NN*NSPS,NFFT=614400,NH=NFFT/2)
character*40 cmsg
character*22 msg,msgsent
character*6 mygrid
character*87 cbits
character*88 cb88
logical bcontest
integer itone(NN)
integer icos7(0:6)
integer*1 msgbits(KK),codeword(3*ND),msgbits2
integer*1, target:: i1Msg8BitBytes(11)
integer*1, target:: mycall
real x(NFFT)
real*8 dt,twopi,f0,fstep,dfreq,phi,dphi
complex cx(0:NH)
common/foxcom/wave(NWAVE),nslots,nfreq,i3bit(5),cmsg(5),mycall(12)
common/foxcom2/itone2(NN),msgbits2(KK)
equivalence (x,cx),(y,cy)
data icos7/2,5,6,0,4,1,3/ !Costas 7x7 tone pattern
bcontest=.false.
fstep=60.d0
dfreq=6.25d0
dt=1.d0/48000.d0
twopi=8.d0*atan(1.d0)
mygrid=' '
irpt=0
nplot=0
wave=0.
do n=1,nslots
i3b=i3bit(n)
if(i3b.eq.0) then
msg=cmsg(n)(1:22) !Standard FT8 message
else
i1=index(cmsg(n),' ') !Special Fox message
i2=index(cmsg(n),';')
i3=index(cmsg(n),'<')
i4=index(cmsg(n),'>')
msg=cmsg(n)(1:i1)//cmsg(n)(i2+1:i3-2)//' '
read(cmsg(n)(i4+2:i4+4),*) irpt
endif
call genft8(msg,mygrid,bcontest,0,msgsent,msgbits,itone)
! print*,'Foxgen:',n,cmsg(n),msgsent
if(i3b.eq.1) then
icrc10=crc10(c_loc(mycall),12)
nrpt=irpt+30
write(cbits,1001) msgbits(1:56),icrc10,nrpt,i3b,0
1001 format(56b1.1,b10.10,b6.6,b3.3,b12.12)
read(cbits,1002) msgbits
1002 format(87i1)
cb88=cbits//'0'
read(cb88,1003) i1Msg8BitBytes(1:11)
1003 format(11b8)
icrc12=crc12(c_loc(i1Msg8BitBytes),11)
write(cbits,1001) msgbits(1:56),icrc10,nrpt,i3b,icrc12
read(cbits,1002) msgbits
call encode174(msgbits,codeword) !Encode the test message
! Message structure: S7 D29 S7 D29 S7
itone(1:7)=icos7
itone(36+1:36+7)=icos7
itone(NN-6:NN)=icos7
k=7
do j=1,ND
i=3*j -2
k=k+1
if(j.eq.30) k=k+7
itone(k)=codeword(i)*4 + codeword(i+1)*2 + codeword(i+2)
enddo
endif
! Make copies of itone() and msgbits() for ft8sim
itone2=itone
msgbits2=msgbits
f0=nfreq + fstep*(n-1)
phi=0.d0
k=0
do j=1,NN
f=f0 + dfreq*itone(j)
dphi=twopi*f*dt
do ii=1,NSPS
k=k+1
phi=phi+dphi
xphi=phi
wave(k)=wave(k)+sin(xphi)
enddo
enddo
enddo
kz=k
peak1=maxval(abs(wave))
wave=wave/peak1
! call plotspec(1,wave) !Plot the spectrum
! Apply compression
! rms=sqrt(dot_product(wave,wave)/kz)
! wave=wave/rms
! do i=1,NWAVE
! wave(i)=h1(wave(i))
! enddo
! peak2=maxval(abs(wave))
! wave=wave/peak2
! call plotspec(2,wave) !Plot the spectrum
width=50.0
call foxfilt(nslots,nfreq,width,wave)
peak3=maxval(abs(wave))
wave=wave/peak3
! nadd=1000
! j=0
! do i=1,NWAVE,nadd
! sx=dot_product(wave(i:i+nadd-1),wave(i:i+nadd-1))
! j=j+1
! write(30,3001) j,sx/nadd
!3001 format(i8,f12.6)
! enddo
! call plotspec(3,wave) !Plot the spectrum
return
end subroutine foxgen
! include 'plotspec.f90'
@@ -0,0 +1,119 @@
// -*- Mode: C++ -*-
#ifndef WIDEGRAPH_H
#define WIDEGRAPH_H
#include <QDialog>
#include <QScopedPointer>
#include <QDir>
#include <QHash>
#include <QVariant>
#include "WFPalette.hpp"
#define MAX_SCREENSIZE 2048
namespace Ui {
class WideGraph;
}
class QSettings;
class Configuration;
class WideGraph : public QDialog
{
Q_OBJECT
public:
explicit WideGraph(QSettings *, QWidget *parent = 0);
~WideGraph ();
void dataSink2(float s[], float df3, int ihsym, int ndiskdata);
void setRxFreq(int n);
int rxFreq();
int nStartFreq();
int Fmin();
int Fmax();
int fSpan();
void saveSettings();
void setFsample(int n);
void setPeriod(int ntrperiod, int nsps);
void setTxFreq(int n);
void setMode(QString mode);
void setSubMode(int n);
void setModeTx(QString modeTx);
bool flatten();
bool useRef();
void setTol(int n);
int smoothYellow();
void setRxBand (QString const& band);
void setWSPRtransmitted();
void drawRed(int ia, int ib);
void setVHF(bool bVHF);
void setRedFile(QString fRed);
signals:
void freezeDecode2(int n);
void f11f12(int n);
void setXIT2(int n);
void setFreq3(int rxFreq, int txFreq);
public slots:
void wideFreezeDecode(int n);
void setFreq2(int rxFreq, int txFreq);
void setDialFreq(double d);
protected:
void keyPressEvent (QKeyEvent *e) override;
void closeEvent (QCloseEvent *) override;
private slots:
void on_waterfallAvgSpinBox_valueChanged(int arg1);
void on_bppSpinBox_valueChanged(int arg1);
void on_spec2dComboBox_currentIndexChanged(const QString &arg1);
void on_fSplitSpinBox_valueChanged(int n);
void on_fStartSpinBox_valueChanged(int n);
void on_paletteComboBox_activated(const QString &palette);
void on_cbFlatten_toggled(bool b);
void on_cbRef_toggled(bool b);
void on_cbControls_toggled(bool b);
void on_adjust_palette_push_button_clicked (bool);
void on_gainSlider_valueChanged(int value);
void on_zeroSlider_valueChanged(int value);
void on_gain2dSlider_valueChanged(int value);
void on_zero2dSlider_valueChanged(int value);
void on_smoSpinBox_valueChanged(int n);
void on_sbPercent2dPlot_valueChanged(int n);
private:
void readPalette ();
void setRxRange ();
void replot();
QScopedPointer<Ui::WideGraph> ui;
QSettings * m_settings;
QDir m_palettes_path;
WFPalette m_userPalette;
QHash<QString, QVariant> m_fMinPerBand;
qint32 m_waterfallAvg;
qint32 m_TRperiod;
qint32 m_nsps;
qint32 m_ntr0;
qint32 m_fMax;
qint32 m_nSubMode;
qint32 m_nsmo;
qint32 m_Percent2DScreen;
qint32 m_jz=MAX_SCREENSIZE;
qint32 m_n;
bool m_bFlatten;
bool m_bRef;
bool m_bHaveTransmitted; //Set true at end of a WSPR transmission
QString m_rxBand;
QString m_mode;
QString m_modeTx;
QString m_waterfallPalette;
};
#endif // WIDEGRAPH_H