From 5a023e8ea99c38bd61c050a601e076033227d885 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Wed, 15 Nov 2017 16:38:35 +0000 Subject: [PATCH] More work on the Fox GUI. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@8237 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- lib/decoder.f90 | 6 +-- mainwindow.cpp | 81 ++++++++++++++++++++++++++++++++++---- mainwindow.h | 8 ++++ mainwindow.ui | 102 +++++++++++++++++++++++++++++++++++++++++++++++- 4 files changed, 185 insertions(+), 12 deletions(-) diff --git a/lib/decoder.f90 b/lib/decoder.f90 index da2198e3f..224c7d336 100644 --- a/lib/decoder.f90 +++ b/lib/decoder.f90 @@ -96,11 +96,11 @@ subroutine multimode_decoder(ss,id2,params,nfsample) nsnrfox(j)=nsnrfox(i) nfreqfox(j)=nfreqfox(i) n15fox(j)=n - m=n15max-n +! m=n15max-n call azdist(params%mygrid,g2fox(j),utch,nAz,nEl,nDmiles,nDkm, & nHotAz,nHotABetter) - write(19,1004) c2fox(j),g2fox(j),nsnrfox(j),nfreqfox(j),nDkm,m -1004 format(a12,1x,a4,i5,i6,i7,i5) + write(19,1004) c2fox(j),g2fox(j),nsnrfox(j),nfreqfox(j),nDkm +1004 format(a12,1x,a4,i5,i6,i7) endif enddo nfox=j diff --git a/mainwindow.cpp b/mainwindow.cpp index de829a13e..26d591b5e 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -989,6 +989,14 @@ void MainWindow::writeSettings() m_settings->setValue ("FreeText", ui->freeTextMsg->currentText ()); m_settings->setValue("ShowMenus",ui->cbMenus->isChecked()); m_settings->setValue("CallFirst",ui->cbFirst->isChecked()); + m_settings->setValue("FoxSortCall",ui->rbCall->isChecked()); + m_settings->setValue("FoxSortGrid",ui->rbGrid->isChecked()); + m_settings->setValue("FoxSortSNR",ui->rbSNR->isChecked()); + m_settings->setValue("FoxSortDist",ui->rbDist->isChecked()); + m_settings->setValue("FoxSortRandom",ui->rbRandom->isChecked()); + m_settings->setValue("FoxSortReverse",ui->cbReverse->isChecked()); + m_settings->setValue("FoxNsig",ui->sbNsig->value()); + m_settings->endGroup(); m_settings->beginGroup("Common"); @@ -1056,6 +1064,13 @@ void MainWindow::readSettings() m_settings->value ("FreeText").toString ()); ui->cbMenus->setChecked(m_settings->value("ShowMenus",true).toBool()); ui->cbFirst->setChecked(m_settings->value("CallFirst",true).toBool()); + ui->rbCall->setChecked(m_settings->value("FoxSortCall",false).toBool()); + ui->rbGrid->setChecked(m_settings->value("FoxSortGrid",false).toBool()); + ui->rbSNR->setChecked(m_settings->value("FoxSortSNR",true).toBool()); + ui->rbDist->setChecked(m_settings->value("FoxSortDist",false).toBool()); + ui->rbRandom->setChecked(m_settings->value("FoxSortRandom",false).toBool()); + ui->cbReverse->setChecked(m_settings->value("FoxSortReverse",true).toBool()); + ui->sbNsig->setValue(m_settings->value("FoxNsig",5).toInt()); m_settings->endGroup(); // do this outside of settings group because it uses groups internally @@ -2510,6 +2525,7 @@ void MainWindow::msgAvgDecode2() void MainWindow::decode() //decode() { + m_msec0=QDateTime::currentMSecsSinceEpoch(); if(!m_dataAvailable or m_TRperiod==0) return; ui->DecodeButton->setChecked (true); if(!dec_data.params.nagain && m_diskData && !m_bFastMode && m_mode!="FT8") { @@ -2747,7 +2763,7 @@ void MainWindow::decodeDone () if(t.length()>30) { QString t1=sortFoxCalls(t,m_isort,m_min_dB,m_max_dB); ui->decodedTextBrowser->setText(t1); - if(m_toBeCalled!="") ui->decodedTextBrowser->displayFoxToBeCalled(m_toBeCalled,"#ff99ff"); +// if(m_toBeCalled!="") ui->decodedTextBrowser->displayFoxToBeCalled(m_toBeCalled,"#ff99ff"); } } } @@ -2757,6 +2773,8 @@ void MainWindow::readFromStdout() //readFromStdout { while(proc_jt9.canReadLine()) { QByteArray t=proc_jt9.readLine(); +// qint64 ms=QDateTime::currentMSecsSinceEpoch() - m_msec0; +// qDebug() << "A" << ms << t; bool bAvgMsg=false; int navg=0; if(t.indexOf("") >= 0) { @@ -3810,9 +3828,10 @@ void MainWindow::doubleClickOnCall(Qt::KeyboardModifiers modifiers) } if(m_config.bFox() and m_decodedText2) { - if(m_nToBeCalled >= 5 or m_nFoxCallers==0) return; + if(m_nToBeCalled >= m_Nsig or m_nFoxCallers==0) return; QString t=cursor.block().text(); QString c2=t.split(" ",QString::SkipEmptyParts).at(0); + if(ui->textBrowser3->toPlainText().indexOf(c2) >= 0) return; QString g2=t.split(" ",QString::SkipEmptyParts).at(1); QString rpt=t.split(" ",QString::SkipEmptyParts).at(2); ui->dxCallEntry->setText(c2); @@ -3825,7 +3844,6 @@ void MainWindow::doubleClickOnCall(Qt::KeyboardModifiers modifiers) m_nToBeCalled+=1; ui->decodedTextBrowser->clear(); ui->decodedTextBrowser->append(m_FoxCallers); -// ui->decodedTextBrowser->displayFoxToBeCalled(m_toBeCalled,"#ff99ff"); QString t1=c2 + " "; QString t2=rpt; if(rpt.mid(0,1) != "-") t2="+" + rpt; @@ -4823,7 +4841,7 @@ void MainWindow::on_actionFT8_triggered() ui->label_7->setText("Rx Frequency"); if(m_config.bFox()) { ui->label_6->setText("Stations calling DXpedition " + m_config.my_callsign()); - ui->decodedTextLabel->setText( "Call Grid dB Freq Dist Age"); + ui->decodedTextLabel->setText( "Call Grid dB Freq Dist"); } else { ui->label_6->setText("Band Activity"); ui->decodedTextLabel->setText( " UTC dB DT Freq Message"); @@ -7009,10 +7027,9 @@ QString MainWindow::sortFoxCalls(QString t, int isort, int min_dB, int max_dB) QString msg,c2,t1; QString ABC{"ABCDEFGHIJKLMNOPQRSTUVWXYZ"}; QList list; - int i,j,k,n,nlines; - bool bReverse; + int i,j,k,m,n,nlines; + bool bReverse=ui->cbReverse->isChecked(); - bReverse=(isort<0); isort=qAbs(isort); // Save only the most recent transmission from each caller. lines = t.split("\n"); @@ -7067,6 +7084,21 @@ QString MainWindow::sortFoxCalls(QString t, int isort, int min_dB, int max_dB) } } + int nn=lines2.length(); + if(isort==0) { + int a[nn]; + for(i=0; i-1; i--) { + j=(i+1)*double(qrand())/RAND_MAX; + m=a[j]; + a[j]=a[i]; + a[i]=m; + t += lines2.at(m) + "\n"; + } + } + // QString uniqueCalls; // uniqueCalls.sprintf(" Unique callers: %d",j); // ui->labCallers->setText(uniqueCalls); @@ -7077,3 +7109,38 @@ QString MainWindow::sortFoxCalls(QString t, int isort, int min_dB, int max_dB) m_FoxCallers=t.mid(0,m_max_N*i0); return m_FoxCallers; } + +void MainWindow::on_rbCall_toggled(bool b) +{ + if(b) { + m_isort=1; + ui->cbReverse->setChecked(false); + } +} + +void MainWindow::on_rbGrid_toggled(bool b) +{ + if(b) m_isort=2; +} + +void MainWindow::on_rbSNR_toggled(bool b) +{ + if(b) m_isort=3; +} + +void MainWindow::on_rbDist_toggled(bool b) +{ + if(b) m_isort=4; +} + +void MainWindow::on_rbRandom_toggled(bool b) +{ + if(b) m_isort=0; +} + +void MainWindow::on_sbNsig_valueChanged(int n) +{ + m_Nsig=n; +} + + diff --git a/mainwindow.h b/mainwindow.h index 8707e9f08..8712b2a72 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -282,6 +282,12 @@ private slots: void on_actionFreqCal_triggered(); void splash_done (); void on_measure_check_box_stateChanged (int); + void on_rbCall_toggled(bool b); + void on_rbGrid_toggled(bool b); + void on_rbSNR_toggled(bool b); + void on_rbDist_toggled(bool b); + void on_rbRandom_toggled(bool b); + void on_sbNsig_valueChanged(int n); private: Q_SIGNAL void initializeAudioOutputStream (QAudioDeviceInfo, @@ -357,6 +363,7 @@ private: qint64 m_msErase; qint64 m_secBandChanged; qint64 m_freqMoon; + qint64 m_msec0; Frequency m_freqNominal; Frequency m_freqTxNominal; Astro::Correction m_astroCorrection; @@ -413,6 +420,7 @@ private: qint32 m_min_dB; qint32 m_nFoxCallers=0; qint32 m_nToBeCalled=0; + qint32 m_Nsig=5; bool m_btxok; //True if OK to transmit bool m_diskData; diff --git a/mainwindow.ui b/mainwindow.ui index a09a6eaa4..8c5b133da 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -1036,6 +1036,12 @@ QLabel[oob="true"] { + + + 0 + 250 + + QTabWidget::West @@ -1621,11 +1627,103 @@ list. The list can be maintained in Settings (F2). 10 3 - 130 - 110 + 171 + 91 + + + + 10 + 100 + 131 + 91 + + + + Selection Order + + + + + 10 + 20 + 113 + 65 + + + + + + + Call + + + true + + + + + + + Dist + + + + + + + Grid + + + + + + + Random + + + + + + + S/N + + + + + + + Reverse + + + + + + + + + + 150 + 140 + 61 + 22 + + + + Nsig: + + + 1 + + + 5 + + + 5 + +