From d4652ef0e5dadee4305bfcac76169e7d0ff8dc6a Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Mon, 30 Oct 2017 20:47:08 +0000 Subject: [PATCH] More progress on FoxCalls... git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@8199 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- foxcalls.cpp | 20 +++++++++------- foxcalls.h | 2 ++ foxcalls.ui | 23 ++++++++++++++++-- lib/decoder.f90 | 59 ++++++++++++++++++++++++++++++++++++++++++---- lib/ft8_decode.f90 | 9 +++++++ mainwindow.cpp | 8 +------ 6 files changed, 100 insertions(+), 21 deletions(-) diff --git a/foxcalls.cpp b/foxcalls.cpp index acf6c17c8..41229f85c 100644 --- a/foxcalls.cpp +++ b/foxcalls.cpp @@ -14,10 +14,9 @@ FoxCalls::FoxCalls(QSettings * settings, QWidget *parent) : setWindowTitle (QApplication::applicationName () + " - " + tr ("Fox Callers")); installEventFilter(parent); //Installing the filter - //Restore user's settings m_settings->beginGroup("FoxCalls"); - restoreGeometry (m_settings->value ("geometry", saveGeometry ()).toByteArray ()); + restoreGeometry (m_settings->value("geometry").toByteArray()); } FoxCalls::~FoxCalls() @@ -35,17 +34,22 @@ void FoxCalls::saveSettings() { //Save user's settings m_settings->beginGroup("FoxCalls"); - m_settings->setValue ("geometry", saveGeometry ()); + m_settings->setValue("geometry", saveGeometry()); m_settings->endGroup(); } void FoxCalls::insertText(QString t) { - QTextDocument *doc = ui->foxPlainTextEdit->document(); - QFont font = doc->defaultFont(); - font.setFamily("Courier New"); - doc->setDefaultFont(font); - qDebug() << font; + if(m_bFirst) { + QTextDocument *doc = ui->foxPlainTextEdit->document(); + QFont font = doc->defaultFont(); + font.setFamily("Courier New"); + font.setPointSize(12); + doc->setDefaultFont(font); + ui->label_2->setFont(font); + ui->label_2->setText("Call Grid dB Freq Age"); + m_bFirst=false; + } ui->foxPlainTextEdit->setPlainText(t); ui->foxPlainTextEdit->setReadOnly (true); } diff --git a/foxcalls.h b/foxcalls.h index 9ae35c30d..71a3424b6 100644 --- a/foxcalls.h +++ b/foxcalls.h @@ -4,6 +4,7 @@ #include #include #include +#include namespace Ui { class FoxCalls; @@ -30,6 +31,7 @@ private slots: // void on_binsPerPixelSpinBox_valueChanged(int n); private: + bool m_bFirst=true; QSettings * m_settings; QScopedPointer ui; }; diff --git a/foxcalls.ui b/foxcalls.ui index 0f473445d..e508b7277 100644 --- a/foxcalls.ui +++ b/foxcalls.ui @@ -17,7 +17,7 @@ 19 - 60 + 30 321 31 @@ -78,7 +78,7 @@ 20 90 - 511 + 411 191 @@ -89,6 +89,25 @@ + + + + 27 + 70 + 341 + 16 + + + + + Courier New + 12 + + + + + + diff --git a/lib/decoder.f90 b/lib/decoder.f90 index c913cdb19..48a7a99ee 100644 --- a/lib/decoder.f90 +++ b/lib/decoder.f90 @@ -54,10 +54,13 @@ subroutine multimode_decoder(ss,id2,params,nfsample) 10 if (params%nagain) then open(13,file=trim(temp_dir)//'/decoded.txt',status='unknown', & position='append',iostat=ios) + if(params%nmode.eq.8) open(19,file=trim(temp_dir)//'/foxcalls.txt', & + status='unknown',position='append',iostat=ios) else - open(13,file=trim(temp_dir)//'/decoded.txt',status='unknown', & - iostat=ios) - end if + open(13,file=trim(temp_dir)//'/decoded.txt',status='unknown',iostat=ios) + if(params%nmode.eq.8) open(19,file=trim(temp_dir)//'/foxcalls.txt', & + status='unknown',iostat=ios) + endif if(ios.ne.0) then nfail=nfail+1 if(nfail.le.3) then @@ -76,6 +79,15 @@ subroutine multimode_decoder(ss,id2,params,nfsample) logical(params%lapon),params%napwid,params%mycall, & params%mygrid,params%hiscall,params%hisgrid) call timer('decft8 ',1) + n15min=minval(n15fox) + n15max=maxval(n15fox) + print*,nfox,n15min,n15max + do i=1,nfox + n=n15max-n15fox(i) + write(19,1004) c2fox(i),g2fox(i),nsnrfox(i),nfreqfox(i),n +1004 format(a12,1x,a4,i5,i6,i5) + enddo + flush(19) go to 800 endif @@ -400,11 +412,32 @@ contains real, intent(in) :: dt real, intent(in) :: freq character(len=22), intent(in) :: decoded + character c2*6,g2*4,w*4 + integer i1,i2,i3,n15 integer, intent(in) :: nap real, intent(in) :: qual character*2 annot character*22 decoded0 - + logical isgrid4,first + data first/.true./ + save + + isgrid4(w)=(len_trim(w).eq.4 .and. & + ichar(w(1:1)).ge.ichar('A') .and. ichar(w(1:1)).le.ichar('R') .and. & + ichar(w(2:2)).ge.ichar('A') .and. ichar(w(2:2)).le.ichar('R') .and. & + ichar(w(3:3)).ge.ichar('0') .and. ichar(w(3:3)).le.ichar('9') .and. & + ichar(w(4:4)).ge.ichar('0') .and. ichar(w(4:4)).le.ichar('9')) + + if(first) then + c2fox=' ' + g2fox=' ' + nsnrfox=-99 + nfreqfox=-99 + n15z=-99 + nfox=0 + first=.false. + endif + decoded0=decoded annot=' ' if(nap.ne.0) then @@ -415,6 +448,24 @@ contains 1000 format(i6.6,i4,f5.1,i5,' ~ ',1x,a22,1x,a2) write(13,1002) params%nutc,nint(sync),snr,dt,freq,0,decoded0 1002 format(i6.6,i4,i5,f6.1,f8.0,i4,3x,a22,' FT8') + + i1=index(decoded0,' ') + i2=i1 + index(decoded0(i1+1:),' ') + i3=i2 + index(decoded0(i2+1:),' ') + c2=decoded0(i1+1:i2-1) + g2=decoded0(i2+1:i3-1) + if(i3-i2.eq.5 .and. isgrid4(g2)) then + n=params%nutc + n15=(3600*(n/10000) + 60*mod((n/100),100) + mod(n,100))/15 + nfox=nfox+1 + c2fox(nfox)=c2 + g2fox(nfox)=g2 + nsnrfox(nfox)=snr + nfreqfox(nfox)=nint(freq) + n15fox(nfox)=n15 + n15z=n15 + endif + call flush(6) call flush(13) diff --git a/lib/ft8_decode.f90 b/lib/ft8_decode.f90 index 61984932b..4ad6c873d 100644 --- a/lib/ft8_decode.f90 +++ b/lib/ft8_decode.f90 @@ -1,5 +1,14 @@ module ft8_decode + parameter (MAXFOX=1000) + character*12 c2fox(MAXFOX) + character*4 g2fox(MAXFOX) + integer nsnrfox(MAXFOX) + integer nfreqfox(MAXFOX) + integer n15fox(MAXFOX) + integer n15z + integer nfox + type :: ft8_decoder procedure(ft8_decode_callback), pointer :: callback contains diff --git a/mainwindow.cpp b/mainwindow.cpp index 2f6306a6c..8d80d1569 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -2719,8 +2719,7 @@ void MainWindow::decodeDone () m_RxLog=0; m_blankLine=true; if(m_config.bFox()) { - QFile f(m_config.temp_dir ().absoluteFilePath ("decoded.txt")); - + QFile f(m_config.temp_dir().absoluteFilePath("foxcalls.txt")); if(f.open(QIODevice::ReadOnly | QIODevice::Text)) { QTextStream s(&f); QString t=s.readAll(); @@ -3401,8 +3400,6 @@ void MainWindow::guiUpdate() //Once per second: if(nsec != m_sec0) { -// qDebug() << "a" << m_foxCalls->font(); -// qDebug() << "b" << ui->decodedTextBrowser->font(); if(m_freqNominal!=0 and m_freqNominal<50000000 and m_config.enable_VHF_features()) { if(!m_bVHFwarned) vhfWarning(); } else { @@ -4754,9 +4751,6 @@ void MainWindow::on_actionFT8_triggered() displayWidgets(nWidgets("111010000100111000010000")); if(m_config.bFox()) { if(!m_foxCalls->isVisible()) { -// QStringList headers{"Call","Loc","dB","Freq","UTC"}; -// m_foxTable->setHorizontalHeaderLabels(headers); -// m_foxTable->setGeometry(QRect(100,100,550,400)); m_foxCalls->show(); } } else {