From 041df48e962b4e1003b23aabff1405890ff7ead5 Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Tue, 4 Dec 2018 01:49:36 +0000 Subject: [PATCH 1/6] Fix issues with auto scrolling log winddows to the last added row --- widgets/AbstractLogWindow.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/widgets/AbstractLogWindow.cpp b/widgets/AbstractLogWindow.cpp index e796cdc3e..c1bfd35c2 100644 --- a/widgets/AbstractLogWindow.cpp +++ b/widgets/AbstractLogWindow.cpp @@ -85,9 +85,12 @@ AbstractLogWindow::AbstractLogWindow (QString const& settings_key, QSettings * s , m_ {this, settings_key, settings, configuration} { // ensure view scrolls to latest new row - connect (&m_->model_, &QAbstractItemModel::rowsInserted, [this] (QModelIndex const& /*parent*/, int /*first*/, int /*last*/) { - if (m_->log_view_) m_->log_view_->scrollToBottom (); - }); + connect (&m_->model_, &QAbstractItemModel::rowsInserted, this, [this] (QModelIndex const& parent, int /*first*/, int last) { + // note col 0 is hidden so use col 1 + // queued connection required otherwise row may not be available + // in time + if (m_->log_view_) m_->log_view_->scrollTo (m_->log_view_->model ()->index (last, 1, parent)); + }, Qt::QueuedConnection); } AbstractLogWindow::~AbstractLogWindow () @@ -106,6 +109,7 @@ void AbstractLogWindow::set_log_view (QTableView * log_view) m_->log_view_->setAlternatingRowColors (true); m_->log_view_->setSelectionBehavior (QAbstractItemView::SelectRows); m_->log_view_->setSelectionMode (QAbstractItemView::ExtendedSelection); + m_->log_view_->setVerticalScrollMode (QAbstractItemView::ScrollPerPixel); m_->model_.setSourceModel (m_->log_view_->model ()); m_->log_view_->setModel (&m_->model_); m_->log_view_->setColumnHidden (0, true); From 337bae6d0d14bf62a4d36d0060e2e99422dfc82c Mon Sep 17 00:00:00 2001 From: Steve Franke Date: Wed, 5 Dec 2018 16:06:33 -0600 Subject: [PATCH 2/6] Housekeeping. Remove unused code and unused variables. Silence some compiler warnings. --- CMakeLists.txt | 4 - lib/crc.f90 | 16 -- lib/crc12.cpp | 31 --- lib/decoder.f90 | 4 +- lib/ft8/bpdecode174.f90 | 401 -------------------------------------- lib/ft8/chkcrc12a.f90 | 24 --- lib/ft8/foxgen.f90 | 1 - lib/ft8/ft8apset.f90 | 1 - lib/ft8/ft8b.f90 | 5 +- lib/ft8/ft8code.f90 | 9 +- lib/ft8/ft8sim.f90 | 2 +- lib/msk144code.f90 | 8 +- lib/msk144decodeframe.f90 | 2 +- lib/msk144sim.f90 | 1 - 14 files changed, 12 insertions(+), 497 deletions(-) delete mode 100644 lib/crc12.cpp delete mode 100644 lib/ft8/bpdecode174.f90 delete mode 100644 lib/ft8/chkcrc12a.f90 diff --git a/CMakeLists.txt b/CMakeLists.txt index a2717dca8..3e7e816bc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -322,14 +322,12 @@ set (wsjtx_CXXSRCS set (wsjt_CXXSRCS lib/crc10.cpp - lib/crc12.cpp lib/crc13.cpp lib/crc14.cpp ) # deal with a GCC v6 UB error message set_source_files_properties ( lib/crc10.cpp - lib/crc12.cpp lib/crc13.cpp lib/crc14.cpp PROPERTIES COMPILE_FLAGS -fpermissive) @@ -384,13 +382,11 @@ set (wsjt_FSRCS lib/ft8/baseline.f90 lib/bpdecode40.f90 lib/bpdecode128_90.f90 - lib/ft8/bpdecode174.f90 lib/ft8/bpdecode174_91.f90 lib/baddata.f90 lib/calibrate.f90 lib/ccf2.f90 lib/ccf65.f90 - lib/ft8/chkcrc12a.f90 lib/ft8/chkcrc13a.f90 lib/ft8/chkcrc14a.f90 lib/chkcall.f90 diff --git a/lib/crc.f90 b/lib/crc.f90 index a36e364f9..f0cd17e32 100644 --- a/lib/crc.f90 +++ b/lib/crc.f90 @@ -34,22 +34,6 @@ module crc integer (c_int), value :: length end function crc13_check - function crc12 (data, length) bind (C, name="crc12") - use, intrinsic :: iso_c_binding, only: c_short, c_ptr, c_int - implicit none - integer (c_short) :: crc12 - type (c_ptr), value :: data - integer (c_int), value :: length - end function crc12 - - function crc12_check (data, length) bind (C, name="crc12_check") - use, intrinsic :: iso_c_binding, only: c_bool, c_ptr, c_int - implicit none - logical (c_bool) :: crc12_check - type (c_ptr), value :: data - integer (c_int), value :: length - end function crc12_check - function crc10 (data, length) bind (C, name="crc10") use, intrinsic :: iso_c_binding, only: c_short, c_ptr, c_int implicit none diff --git a/lib/crc12.cpp b/lib/crc12.cpp deleted file mode 100644 index 44e50fe71..000000000 --- a/lib/crc12.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include -#include - -extern "C" -{ - short crc12 (unsigned char const * data, int length); - bool crc12_check (unsigned char const * data, int length); -} - -#define POLY 0xc06 - -#ifdef BOOST_NO_CXX11_CONSTEXPR -#define TRUNCATED_POLYNOMIAL POLY -#else -namespace -{ - unsigned long constexpr TRUNCATED_POLYNOMIAL = POLY; -} -#endif - -// assumes CRC is last 16 bits of the data and is set to zero -// caller should assign the returned CRC into the message in big endian byte order -short crc12 (unsigned char const * data, int length) -{ - return boost::augmented_crc<12, TRUNCATED_POLYNOMIAL> (data, length); -} - -bool crc12_check (unsigned char const * data, int length) -{ - return !boost::augmented_crc<12, TRUNCATED_POLYNOMIAL> (data, length); -} diff --git a/lib/decoder.f90 b/lib/decoder.f90 index e1fb40436..730c59d12 100644 --- a/lib/decoder.f90 +++ b/lib/decoder.f90 @@ -470,8 +470,8 @@ contains real, intent(in) :: dt real, intent(in) :: freq character(len=37), intent(in) :: decoded - character c1*12,c2*12,g2*4,w*4,ctmp*12 - integer i0,i1,i2,i3,i4,i5,i6,n30,nwrap + character c1*12,c2*12,g2*4,w*4 + integer i0,i1,i2,i3,i4,i5,n30,nwrap integer, intent(in) :: nap real, intent(in) :: qual character*2 annot diff --git a/lib/ft8/bpdecode174.f90 b/lib/ft8/bpdecode174.f90 deleted file mode 100644 index 9442cc4a1..000000000 --- a/lib/ft8/bpdecode174.f90 +++ /dev/null @@ -1,401 +0,0 @@ -subroutine bpdecode174(llr,apmask,maxiterations,decoded,cw,nharderror,iter) -! -! A log-domain belief propagation decoder for the (174,87) code. -! -integer, parameter:: N=174, K=87, M=N-K -integer*1 codeword(N),cw(N),apmask(N) -integer colorder(N) -integer*1 decoded(K) -integer Nm(7,M) ! 5, 6, or 7 bits per check -integer Mn(3,N) ! 3 checks per bit -integer synd(M) -real tov(3,N) -real toc(7,M) -real tanhtoc(7,M) -real zn(N) -real llr(N) -real Tmn -integer nrw(M) - -data colorder/ & - 0, 1, 2, 3, 30, 4, 5, 6, 7, 8, 9, 10, 11, 32, 12, 40, 13, 14, 15, 16,& - 17, 18, 37, 45, 29, 19, 20, 21, 41, 22, 42, 31, 33, 34, 44, 35, 47, 51, 50, 43,& - 36, 52, 63, 46, 25, 55, 27, 24, 23, 53, 39, 49, 59, 38, 48, 61, 60, 57, 28, 62,& - 56, 58, 65, 66, 26, 70, 64, 69, 68, 67, 74, 71, 54, 76, 72, 75, 78, 77, 80, 79,& - 73, 83, 84, 81, 82, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,& - 100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,& - 120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,& - 140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,& - 160,161,162,163,164,165,166,167,168,169,170,171,172,173/ - -data Mn/ & - 1, 25, 69, & - 2, 5, 73, & - 3, 32, 68, & - 4, 51, 61, & - 6, 63, 70, & - 7, 33, 79, & - 8, 50, 86, & - 9, 37, 43, & - 10, 41, 65, & - 11, 14, 64, & - 12, 75, 77, & - 13, 23, 81, & - 15, 16, 82, & - 17, 56, 66, & - 18, 53, 60, & - 19, 31, 52, & - 20, 67, 84, & - 21, 29, 72, & - 22, 24, 44, & - 26, 35, 76, & - 27, 36, 38, & - 28, 40, 42, & - 30, 54, 55, & - 34, 49, 87, & - 39, 57, 58, & - 45, 74, 83, & - 46, 62, 80, & - 47, 48, 85, & - 59, 71, 78, & - 1, 50, 53, & - 2, 47, 84, & - 3, 25, 79, & - 4, 6, 14, & - 5, 7, 80, & - 8, 34, 55, & - 9, 36, 69, & - 10, 43, 83, & - 11, 23, 74, & - 12, 17, 44, & - 13, 57, 76, & - 15, 27, 56, & - 16, 28, 29, & - 18, 19, 59, & - 20, 40, 63, & - 21, 35, 52, & - 22, 54, 64, & - 24, 62, 78, & - 26, 32, 77, & - 30, 72, 85, & - 31, 65, 87, & - 33, 39, 51, & - 37, 48, 75, & - 38, 70, 71, & - 41, 42, 68, & - 45, 67, 86, & - 46, 81, 82, & - 49, 66, 73, & - 58, 60, 66, & - 61, 65, 85, & - 1, 14, 21, & - 2, 13, 59, & - 3, 67, 82, & - 4, 32, 73, & - 5, 36, 54, & - 6, 43, 46, & - 7, 28, 75, & - 8, 33, 71, & - 9, 49, 76, & - 10, 58, 64, & - 11, 48, 68, & - 12, 19, 45, & - 15, 50, 61, & - 16, 22, 26, & - 17, 72, 80, & - 18, 40, 55, & - 20, 35, 51, & - 23, 25, 34, & - 24, 63, 87, & - 27, 39, 74, & - 29, 78, 83, & - 30, 70, 77, & - 31, 69, 84, & - 22, 37, 86, & - 38, 41, 81, & - 42, 44, 57, & - 47, 53, 62, & - 52, 56, 79, & - 60, 75, 81, & - 1, 39, 77, & - 2, 16, 41, & - 3, 31, 54, & - 4, 36, 78, & - 5, 45, 65, & - 6, 57, 85, & - 7, 14, 49, & - 8, 21, 46, & - 9, 15, 72, & - 10, 20, 62, & - 11, 17, 71, & - 12, 34, 47, & - 13, 68, 86, & - 18, 23, 43, & - 19, 64, 73, & - 24, 48, 79, & - 25, 70, 83, & - 26, 80, 87, & - 27, 32, 40, & - 28, 56, 69, & - 29, 63, 66, & - 30, 42, 50, & - 33, 37, 82, & - 35, 60, 74, & - 38, 55, 84, & - 44, 52, 61, & - 51, 53, 72, & - 58, 59, 67, & - 47, 56, 76, & - 1, 19, 37, & - 2, 61, 75, & - 3, 8, 66, & - 4, 60, 84, & - 5, 34, 39, & - 6, 26, 53, & - 7, 32, 57, & - 9, 52, 67, & - 10, 12, 15, & - 11, 51, 69, & - 13, 14, 65, & - 16, 31, 43, & - 17, 20, 36, & - 18, 80, 86, & - 21, 48, 59, & - 22, 40, 46, & - 23, 33, 62, & - 24, 30, 74, & - 25, 42, 64, & - 27, 49, 85, & - 28, 38, 73, & - 29, 44, 81, & - 35, 68, 70, & - 41, 63, 76, & - 45, 49, 71, & - 50, 58, 87, & - 48, 54, 83, & - 13, 55, 79, & - 77, 78, 82, & - 1, 2, 24, & - 3, 6, 75, & - 4, 56, 87, & - 5, 44, 53, & - 7, 50, 83, & - 8, 10, 28, & - 9, 55, 62, & - 11, 29, 67, & - 12, 33, 40, & - 14, 16, 20, & - 15, 35, 73, & - 17, 31, 39, & - 18, 36, 57, & - 19, 46, 76, & - 21, 42, 84, & - 22, 34, 59, & - 23, 26, 61, & - 25, 60, 65, & - 27, 64, 80, & - 30, 37, 66, & - 32, 45, 72, & - 38, 51, 86, & - 41, 77, 79, & - 43, 56, 68, & - 47, 74, 82, & - 40, 52, 78, & - 54, 61, 71, & - 46, 58, 69/ - -data Nm/ & - 1, 30, 60, 89, 118, 147, 0, & - 2, 31, 61, 90, 119, 147, 0, & - 3, 32, 62, 91, 120, 148, 0, & - 4, 33, 63, 92, 121, 149, 0, & - 2, 34, 64, 93, 122, 150, 0, & - 5, 33, 65, 94, 123, 148, 0, & - 6, 34, 66, 95, 124, 151, 0, & - 7, 35, 67, 96, 120, 152, 0, & - 8, 36, 68, 97, 125, 153, 0, & - 9, 37, 69, 98, 126, 152, 0, & - 10, 38, 70, 99, 127, 154, 0, & - 11, 39, 71, 100, 126, 155, 0, & - 12, 40, 61, 101, 128, 145, 0, & - 10, 33, 60, 95, 128, 156, 0, & - 13, 41, 72, 97, 126, 157, 0, & - 13, 42, 73, 90, 129, 156, 0, & - 14, 39, 74, 99, 130, 158, 0, & - 15, 43, 75, 102, 131, 159, 0, & - 16, 43, 71, 103, 118, 160, 0, & - 17, 44, 76, 98, 130, 156, 0, & - 18, 45, 60, 96, 132, 161, 0, & - 19, 46, 73, 83, 133, 162, 0, & - 12, 38, 77, 102, 134, 163, 0, & - 19, 47, 78, 104, 135, 147, 0, & - 1, 32, 77, 105, 136, 164, 0, & - 20, 48, 73, 106, 123, 163, 0, & - 21, 41, 79, 107, 137, 165, 0, & - 22, 42, 66, 108, 138, 152, 0, & - 18, 42, 80, 109, 139, 154, 0, & - 23, 49, 81, 110, 135, 166, 0, & - 16, 50, 82, 91, 129, 158, 0, & - 3, 48, 63, 107, 124, 167, 0, & - 6, 51, 67, 111, 134, 155, 0, & - 24, 35, 77, 100, 122, 162, 0, & - 20, 45, 76, 112, 140, 157, 0, & - 21, 36, 64, 92, 130, 159, 0, & - 8, 52, 83, 111, 118, 166, 0, & - 21, 53, 84, 113, 138, 168, 0, & - 25, 51, 79, 89, 122, 158, 0, & - 22, 44, 75, 107, 133, 155, 172, & - 9, 54, 84, 90, 141, 169, 0, & - 22, 54, 85, 110, 136, 161, 0, & - 8, 37, 65, 102, 129, 170, 0, & - 19, 39, 85, 114, 139, 150, 0, & - 26, 55, 71, 93, 142, 167, 0, & - 27, 56, 65, 96, 133, 160, 174, & - 28, 31, 86, 100, 117, 171, 0, & - 28, 52, 70, 104, 132, 144, 0, & - 24, 57, 68, 95, 137, 142, 0, & - 7, 30, 72, 110, 143, 151, 0, & - 4, 51, 76, 115, 127, 168, 0, & - 16, 45, 87, 114, 125, 172, 0, & - 15, 30, 86, 115, 123, 150, 0, & - 23, 46, 64, 91, 144, 173, 0, & - 23, 35, 75, 113, 145, 153, 0, & - 14, 41, 87, 108, 117, 149, 170, & - 25, 40, 85, 94, 124, 159, 0, & - 25, 58, 69, 116, 143, 174, 0, & - 29, 43, 61, 116, 132, 162, 0, & - 15, 58, 88, 112, 121, 164, 0, & - 4, 59, 72, 114, 119, 163, 173, & - 27, 47, 86, 98, 134, 153, 0, & - 5, 44, 78, 109, 141, 0, 0, & - 10, 46, 69, 103, 136, 165, 0, & - 9, 50, 59, 93, 128, 164, 0, & - 14, 57, 58, 109, 120, 166, 0, & - 17, 55, 62, 116, 125, 154, 0, & - 3, 54, 70, 101, 140, 170, 0, & - 1, 36, 82, 108, 127, 174, 0, & - 5, 53, 81, 105, 140, 0, 0, & - 29, 53, 67, 99, 142, 173, 0, & - 18, 49, 74, 97, 115, 167, 0, & - 2, 57, 63, 103, 138, 157, 0, & - 26, 38, 79, 112, 135, 171, 0, & - 11, 52, 66, 88, 119, 148, 0, & - 20, 40, 68, 117, 141, 160, 0, & - 11, 48, 81, 89, 146, 169, 0, & - 29, 47, 80, 92, 146, 172, 0, & - 6, 32, 87, 104, 145, 169, 0, & - 27, 34, 74, 106, 131, 165, 0, & - 12, 56, 84, 88, 139, 0, 0, & - 13, 56, 62, 111, 146, 171, 0, & - 26, 37, 80, 105, 144, 151, 0, & - 17, 31, 82, 113, 121, 161, 0, & - 28, 49, 59, 94, 137, 0, 0, & - 7, 55, 83, 101, 131, 168, 0, & - 24, 50, 78, 106, 143, 149, 0/ - -data nrw/ & - 6,6,6,6,6,6,6,6,6,6, & - 6,6,6,6,6,6,6,6,6,6, & - 6,6,6,6,6,6,6,6,6,6, & - 6,6,6,6,6,6,6,6,6,7, & - 6,6,6,6,6,7,6,6,6,6, & - 6,6,6,6,6,7,6,6,6,6, & - 7,6,5,6,6,6,6,6,6,5, & - 6,6,6,6,6,6,6,6,6,6, & - 5,6,6,6,5,6,6/ - -ncw=3 - -decoded=0 -toc=0 -tov=0 -tanhtoc=0 -! initialize messages to checks -do j=1,M - do i=1,nrw(j) - toc(i,j)=llr((Nm(i,j))) - enddo -enddo - -ncnt=0 - -do iter=0,maxiterations - -! Update bit log likelihood ratios (tov=0 in iteration 0). - do i=1,N - if( apmask(i) .ne. 1 ) then - zn(i)=llr(i)+sum(tov(1:ncw,i)) - else - zn(i)=llr(i) - endif - enddo - -! Check to see if we have a codeword (check before we do any iteration). - cw=0 - where( zn .gt. 0. ) cw=1 - ncheck=0 - do i=1,M - synd(i)=sum(cw(Nm(1:nrw(i),i))) - if( mod(synd(i),2) .ne. 0 ) ncheck=ncheck+1 -! if( mod(synd(i),2) .ne. 0 ) write(*,*) 'check ',i,' unsatisfied' - enddo -! write(*,*) 'number of unsatisfied parity checks ',ncheck - if( ncheck .eq. 0 ) then ! we have a codeword - reorder the columns and return it - codeword=cw(colorder+1) - decoded=codeword(M+1:N) - nerr=0 - do i=1,N - if( (2*cw(i)-1)*llr(i) .lt. 0.0 ) nerr=nerr+1 - enddo - nharderror=nerr - return - endif - - if( iter.gt.0 ) then ! this code block implements an early stopping criterion -! if( iter.gt.10000 ) then ! this code block implements an early stopping criterion - nd=ncheck-nclast - if( nd .lt. 0 ) then ! # of unsatisfied parity checks decreased - ncnt=0 ! reset counter - else - ncnt=ncnt+1 - endif -! write(*,*) iter,ncheck,nd,ncnt - if( ncnt .ge. 5 .and. iter .ge. 10 .and. ncheck .gt. 15) then - nharderror=-1 - return - endif - endif - nclast=ncheck - -! Send messages from bits to check nodes - do j=1,M - do i=1,nrw(j) - ibj=Nm(i,j) - toc(i,j)=zn(ibj) - do kk=1,ncw ! subtract off what the bit had received from the check - if( Mn(kk,ibj) .eq. j ) then - toc(i,j)=toc(i,j)-tov(kk,ibj) - endif - enddo - enddo - enddo - -! send messages from check nodes to variable nodes - do i=1,M - tanhtoc(1:7,i)=tanh(-toc(1:7,i)/2) - enddo - - do j=1,N - do i=1,ncw - ichk=Mn(i,j) ! Mn(:,j) are the checks that include bit j - Tmn=product(tanhtoc(1:nrw(ichk),ichk),mask=Nm(1:nrw(ichk),ichk).ne.j) - call platanh(-Tmn,y) -! y=atanh(-Tmn) - tov(i,j)=2*y - enddo - enddo - -enddo -nharderror=-1 -return -end subroutine bpdecode174 diff --git a/lib/ft8/chkcrc12a.f90 b/lib/ft8/chkcrc12a.f90 deleted file mode 100644 index fc4291907..000000000 --- a/lib/ft8/chkcrc12a.f90 +++ /dev/null @@ -1,24 +0,0 @@ -subroutine chkcrc12a(decoded,nbadcrc) - - use crc - integer*1 decoded(87) - integer*1, target:: i1Dec8BitBytes(11) - character*87 cbits - -! Write decoded bits into cbits: 75-bit message plus 12-bit CRC - write(cbits,1000) decoded -1000 format(87i1) - read(cbits,1001) i1Dec8BitBytes -1001 format(11b8) - read(cbits,1002) ncrc12 !Received CRC12 -1002 format(75x,b12) - - i1Dec8BitBytes(10)=iand(i1Dec8BitBytes(10),128+64+32) - i1Dec8BitBytes(11)=0 - icrc12=crc12(c_loc(i1Dec8BitBytes),11) !CRC12 computed from 75 msg bits - - nbadcrc=1 - if(ncrc12.eq.icrc12) nbadcrc=0 - - return -end subroutine chkcrc12a diff --git a/lib/ft8/foxgen.f90 b/lib/ft8/foxgen.f90 index 806b20648..7492a6f70 100644 --- a/lib/ft8/foxgen.f90 +++ b/lib/ft8/foxgen.f90 @@ -20,7 +20,6 @@ subroutine foxgen() character*37 msg,msgsent integer itone(79) integer*1 msgbits(77),msgbits2 - integer*1, target:: i1Msg8BitBytes(11) integer*1, target:: mycall real x(NFFT) real*8 dt,twopi,f0,fstep,dfreq,phi,dphi diff --git a/lib/ft8/ft8apset.f90 b/lib/ft8/ft8apset.f90 index 2fac41969..15eddd057 100644 --- a/lib/ft8/ft8apset.f90 +++ b/lib/ft8/ft8apset.f90 @@ -4,7 +4,6 @@ subroutine ft8apset(mycall12,hiscall12,apsym) character*37 msg character*12 mycall12,hiscall12,hiscall integer apsym(58) - integer*1 msgbits(77) logical nohiscall if(len(trim(mycall12)).eq.0) then diff --git a/lib/ft8/ft8b.f90 b/lib/ft8/ft8b.f90 index 0f075aad2..5db48341a 100644 --- a/lib/ft8/ft8b.f90 +++ b/lib/ft8/ft8b.f90 @@ -7,12 +7,10 @@ subroutine ft8b(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly, & use packjt77 include 'ft8_params.f90' parameter(NP2=2812) - character*37 msg37,msgsent37 + character*37 msg37 character*12 mycall12,hiscall12,hiscall12_0 character*77 c77 - character*6 mycall6,hiscall6,c1,c2 character*13 c13 - character*87 cbits real a(5) real s8(0:7,NN) real s2(0:511),s2l(0:511) @@ -28,7 +26,6 @@ subroutine ft8b(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly, & integer nappasses(0:5) !Number of decoding passes to use for each QSO state integer naptypes(0:5,4) ! (nQSOProgress, decoding pass) maximum of 4 passes for now integer ncontest,ncontest0 - integer*1, target:: i1hiscall(12) logical one(0:511,0:8) integer graymap(0:7) complex cd0(0:3199) diff --git a/lib/ft8/ft8code.f90 b/lib/ft8/ft8code.f90 index c20aaaa38..cbafd34be 100644 --- a/lib/ft8/ft8code.f90 +++ b/lib/ft8/ft8code.f90 @@ -8,14 +8,11 @@ program ft8code include 'ft8_testmsg.f90' parameter (NWAVE=NN*NSPS) - character*77 c77 character*37 msg,msgsent character*9 comment - character bad*1,msgtype*16 - character*91 cbits + character bad*1,msgtype*18 integer itone(NN) integer*1 msgbits(77) - logical unpk77_success ! Get command-line argument(s) nargs=iargc() @@ -69,10 +66,10 @@ program ft8code if(msg.ne.msgsent) bad="*" if(n3.ge.0) then write(*,1020) imsg,msg,msgsent,bad,i3,n3,msgtype,comment -1020 format(i2,'.',1x,a37,1x,a37,1x,a1,2x,i1,'.',i1,1x,a16,1x,a9) +1020 format(i2,'.',1x,a37,1x,a37,1x,a1,2x,i1,'.',i1,1x,a18,1x,a9) else write(*,1022) imsg,msg,msgsent,bad,i3,msgtype,comment -1022 format(i2,'.',1x,a37,1x,a37,1x,a1,2x,i1,'.',1x,1x,a16,1x,a9) +1022 format(i2,'.',1x,a37,1x,a37,1x,a1,2x,i1,'.',1x,1x,a18,1x,a9) endif enddo diff --git a/lib/ft8/ft8sim.f90 b/lib/ft8/ft8sim.f90 index a1de4061f..e43850daf 100644 --- a/lib/ft8/ft8sim.f90 +++ b/lib/ft8/ft8sim.f90 @@ -9,7 +9,7 @@ program ft8sim parameter (NWAVE=NN*NSPS) type(hdr) h !Header for .wav file character arg*12,fname*17 - character msg37*37,msgsent37*37,msg40*40 + character msg37*37,msgsent37*37 character c77*77 complex c0(0:NMAX-1) complex c(0:NMAX-1) diff --git a/lib/msk144code.f90 b/lib/msk144code.f90 index 6c8963d01..81a185159 100644 --- a/lib/msk144code.f90 +++ b/lib/msk144code.f90 @@ -5,7 +5,7 @@ program msk144code use packjt77 character*77 c77 - character msg*37,msgsent*37,decoded,bad*1,msgtype*16 + character msg*37,msgsent*37,decoded,bad*1,msgtype*18 integer*4 i4tone(144) include 'msk144_testmsg.f90' @@ -61,13 +61,13 @@ program msk144code if(msg.ne.msgsent) bad="*" if(i3.eq.0.and.n3.ge.0) then write(*,1020) imsg,msg,msgsent,bad,i3,n3,msgtype -1020 format(i2,'.',1x,a37,1x,a37,1x,a1,2x,i1,'.',i1,1x,a16) +1020 format(i2,'.',1x,a37,1x,a37,1x,a1,2x,i1,'.',i1,1x,a18) elseif(i3.ge.1) then write(*,1022) imsg,msg,msgsent,bad,i3,msgtype -1022 format(i2,'.',1x,a37,1x,a37,1x,a1,2x,i1,'.',1x,1x,a16) +1022 format(i2,'.',1x,a37,1x,a37,1x,a1,2x,i1,'.',1x,1x,a18) elseif(i3.lt.0) then write(*,1024) imsg,msg,msgsent,bad,msgtype -1024 format(i2,'.',1x,a37,1x,a37,1x,a1,6x,a16) +1024 format(i2,'.',1x,a37,1x,a37,1x,a1,6x,a18) endif enddo diff --git a/lib/msk144decodeframe.f90 b/lib/msk144decodeframe.f90 index de039aadc..19da84937 100644 --- a/lib/msk144decodeframe.f90 +++ b/lib/msk144decodeframe.f90 @@ -100,7 +100,7 @@ subroutine msk144decodeframe(c,softbits,msgreceived,nsuccess) if( nharderror .ge. 0 .and. nharderror .lt. 18 ) then nsuccess=1 write(c77,'(77i1)') decoded77 - read(c77(72:77),'(2b3)'),n3,i3 + read(c77(72:77),'(2b3)') n3,i3 if( (i3.eq.0.and.(n3.eq.1 .or. n3.eq.3 .or. n3.eq.4 .or. n3.gt.5)) .or. i3.eq.3 .or. i3.gt.4 ) then nsuccess=0 else diff --git a/lib/msk144sim.f90 b/lib/msk144sim.f90 index 7b2a8a00b..3472d8827 100644 --- a/lib/msk144sim.f90 +++ b/lib/msk144sim.f90 @@ -5,7 +5,6 @@ program msk144sim real pings(0:NMAX-1) real waveform(0:NMAX-1) character arg*8,msg*37,msgsent*37,fname*40 - character*77 c77 real wave(0:NMAX-1) !Simulated received waveform real*8 twopi,freq,phi,dphi0,dphi1,dphi type(hdr) h !Header for .wav file From b8e451771846eacab4b9bc9398437608fc98e1f4 Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Thu, 6 Dec 2018 05:41:16 +0000 Subject: [PATCH 3/6] Improve performance of Fox and contest log view windows This include inverting the order of table view rows so the newest is at the top, without that the Qt MVC interactions when using a database table based model is too slow and complex to manage. The table views now have sort by column capability in the normal way (click column header to reverse sort order) for timely logging and non-disruption of Tx starts the log view should be sorted in descending time order and scrolled to the last row added. Without that Fox and contest logging will work but serious delays may be invoked that disrupt operation. --- item_delegates/CallsignDelegate.cpp | 1 + main.cpp | 9 +++++ models/CabrilloLog.cpp | 14 +++++-- models/FoxLog.cpp | 11 +++++- widgets/AbstractLogWindow.cpp | 59 ++++++++++++++++++----------- widgets/CabrilloLogWindow.cpp | 3 +- widgets/echoplot.cpp | 2 + widgets/echoplot.h | 11 ++++-- widgets/fastgraph.cpp | 1 + widgets/fastgraph.h | 6 ++- widgets/fastplot.cpp | 4 ++ widgets/fastplot.h | 13 ++++--- widgets/logqso.h | 4 +- widgets/mainwindow.cpp | 18 ++++++--- widgets/mainwindow.h | 14 ++++--- widgets/plotter.cpp | 6 +++ widgets/plotter.h | 12 ++---- widgets/widegraph.cpp | 2 + widgets/widegraph.h | 4 +- widgets/widgets.pri | 2 +- 20 files changed, 133 insertions(+), 63 deletions(-) diff --git a/item_delegates/CallsignDelegate.cpp b/item_delegates/CallsignDelegate.cpp index 017389458..d3b9864c1 100644 --- a/item_delegates/CallsignDelegate.cpp +++ b/item_delegates/CallsignDelegate.cpp @@ -28,3 +28,4 @@ void CallsignDelegate::setModelData (QWidget * editor, QAbstractItemModel * mode { model->setData (index, static_cast (editor)->text (), Qt::EditRole); } + diff --git a/main.cpp b/main.cpp index 601ae6a7e..fd510bffb 100644 --- a/main.cpp +++ b/main.cpp @@ -6,6 +6,8 @@ #include #include +#include +#include #include #include #include @@ -21,6 +23,7 @@ #include #include #include +#include #include #include "revision_utils.hpp" @@ -288,6 +291,12 @@ int main(int argc, char *argv[]) throw std::runtime_error {("Database Error: " + db.lastError ().text ()).toStdString ()}; } + // better performance traded for a risk of d/b corruption + // on system crash or application crash + // db.exec ("PRAGMA synchronous=OFF"); // system crash risk + // db.exec ("PRAGMA journal_mode=MEMORY"); // application crash risk + db.exec ("PRAGMA locking_mode=EXCLUSIVE"); + int result; do { diff --git a/models/CabrilloLog.cpp b/models/CabrilloLog.cpp index d558e66e0..aaedd3bd1 100644 --- a/models/CabrilloLog.cpp +++ b/models/CabrilloLog.cpp @@ -59,6 +59,12 @@ CabrilloLog::impl::impl (Configuration const * configuration) setHeaderData (fieldIndex ("exchange_sent"), Qt::Horizontal, tr ("Sent")); setHeaderData (fieldIndex ("exchange_rcvd"), Qt::Horizontal, tr ("Rcvd")); setHeaderData (fieldIndex ("band"), Qt::Horizontal, tr ("Band")); + + // This descending order by time is important, it makes the view + // place the latest row at the top, without this the model/view + // interactions are both sluggish and unhelpful. + setSort (fieldIndex ("when"), Qt::DescendingOrder); + SQL_error_check (*this, &QSqlTableModel::select); } @@ -113,11 +119,11 @@ bool CabrilloLog::add_QSO (Frequency frequency, QDateTime const& when, QString c { m_->revert (); // discard any uncommitted changes } + m_->setEditStrategy (QSqlTableModel::OnManualSubmit); + ConditionalTransaction transaction {*m_}; auto ok = m_->insertRecord (-1, record); - if (ok) - { - m_->select (); // to refresh views - } + transaction.submit (); + m_->setEditStrategy (QSqlTableModel::OnFieldChange); return ok; } diff --git a/models/FoxLog.cpp b/models/FoxLog.cpp index 691647fdc..1f985f620 100644 --- a/models/FoxLog.cpp +++ b/models/FoxLog.cpp @@ -51,6 +51,12 @@ FoxLog::impl::impl () setHeaderData (fieldIndex ("report_sent"), Qt::Horizontal, tr ("Sent")); setHeaderData (fieldIndex ("report_rcvd"), Qt::Horizontal, tr ("Rcvd")); setHeaderData (fieldIndex ("band"), Qt::Horizontal, tr ("Band")); + + // This descending order by time is important, it makes the view + // place the latest row at the top, without this the model/view + // interactions are both sluggish and unhelpful. + setSort (fieldIndex ("when"), Qt::DescendingOrder); + SQL_error_check (*this, &QSqlTableModel::select); } @@ -104,11 +110,14 @@ bool FoxLog::add_QSO (QDateTime const& when, QString const& call, QString const& { m_->revert (); // discard any uncommitted changes } + m_->setEditStrategy (QSqlTableModel::OnManualSubmit); + ConditionalTransaction transaction {*m_}; auto ok = m_->insertRecord (-1, record); if (ok) { - m_->select (); // to refresh views + ok = transaction.submit (false); } + m_->setEditStrategy (QSqlTableModel::OnFieldChange); return ok; } diff --git a/widgets/AbstractLogWindow.cpp b/widgets/AbstractLogWindow.cpp index c1bfd35c2..efa1e60f1 100644 --- a/widgets/AbstractLogWindow.cpp +++ b/widgets/AbstractLogWindow.cpp @@ -84,13 +84,23 @@ AbstractLogWindow::AbstractLogWindow (QString const& settings_key, QSettings * s : QWidget {parent} , m_ {this, settings_key, settings, configuration} { - // ensure view scrolls to latest new row - connect (&m_->model_, &QAbstractItemModel::rowsInserted, this, [this] (QModelIndex const& parent, int /*first*/, int last) { - // note col 0 is hidden so use col 1 - // queued connection required otherwise row may not be available - // in time - if (m_->log_view_) m_->log_view_->scrollTo (m_->log_view_->model ()->index (last, 1, parent)); - }, Qt::QueuedConnection); + // this attempt to scroll to the last new record doesn't work, some + // sort of issue with model indexes and optimized DB fetches. For + // now sorting by the same column and direction as the underlying DB + // select and that DB select being in descending order so new rows + // at the end appear at view row 0 gets the job done + + // // ensure view scrolls to latest new row + // connect (&m_->model_, &QAbstractItemModel::rowsInserted, this, [this] (QModelIndex const& parent, int first, int last) { + // // note col 0 is hidden so use col 1 + // // queued connection required otherwise row may not be available + // // in time + // auto index = m_->model_.index (last, 1, parent); + // if (m_->log_view_) + // { + // m_->log_view_->scrollTo (index); + // } + // }, Qt::QueuedConnection); } AbstractLogWindow::~AbstractLogWindow () @@ -105,24 +115,27 @@ void AbstractLogWindow::set_log_view (QTableView * log_view) SettingsGroup g {m_->settings_, m_->settings_key_}; restoreGeometry (m_->settings_->value ("window/geometry").toByteArray ()); m_->log_view_ = log_view; - m_->log_view_->setContextMenuPolicy (Qt::ActionsContextMenu); - m_->log_view_->setAlternatingRowColors (true); - m_->log_view_->setSelectionBehavior (QAbstractItemView::SelectRows); - m_->log_view_->setSelectionMode (QAbstractItemView::ExtendedSelection); - m_->log_view_->setVerticalScrollMode (QAbstractItemView::ScrollPerPixel); - m_->model_.setSourceModel (m_->log_view_->model ()); - m_->log_view_->setModel (&m_->model_); - m_->log_view_->setColumnHidden (0, true); + set_log_view_font (m_->configuration_->decoded_text_font ()); + log_view->setSortingEnabled (true); + log_view->setContextMenuPolicy (Qt::ActionsContextMenu); + log_view->setAlternatingRowColors (true); + log_view->setSelectionBehavior (QAbstractItemView::SelectRows); + log_view->setSelectionMode (QAbstractItemView::ExtendedSelection); + log_view->setVerticalScrollMode (QAbstractItemView::ScrollPerPixel); + m_->model_.setSourceModel (log_view->model ()); + log_view->setModel (&m_->model_); + log_view->setColumnHidden (0, true); auto horizontal_header = log_view->horizontalHeader (); + horizontal_header->setResizeContentsPrecision (0); // visible region only horizontal_header->setSectionResizeMode (QHeaderView::ResizeToContents); horizontal_header->setSectionsMovable (true); - m_->log_view_->verticalHeader ()->setSectionResizeMode (QHeaderView::ResizeToContents); - set_log_view_font (m_->configuration_->decoded_text_font ()); - m_->log_view_->scrollToBottom (); + auto vertical_header = log_view->horizontalHeader (); + vertical_header->setResizeContentsPrecision (0); // visible region only + vertical_header->setSectionResizeMode (QHeaderView::ResizeToContents); // actions - auto delete_action = new QAction {tr ("&Delete ..."), m_->log_view_}; - m_->log_view_->insertAction (nullptr, delete_action); + auto delete_action = new QAction {tr ("&Delete ..."), log_view}; + log_view->insertAction (nullptr, delete_action); connect (delete_action, &QAction::triggered, [this] (bool /*checked*/) { m_->delete_QSOs (); }); @@ -130,8 +143,8 @@ void AbstractLogWindow::set_log_view (QTableView * log_view) void AbstractLogWindow::set_log_view_font (QFont const& font) { - // m_->log_view_->setFont (font); - // m_->log_view_->horizontalHeader ()->setFont (font); - // m_->log_view_->verticalHeader ()->setFont (font); + m_->log_view_->setFont (font); + m_->log_view_->horizontalHeader ()->setFont (font); + m_->log_view_->verticalHeader ()->setFont (font); m_->model_.set_font (font); } diff --git a/widgets/CabrilloLogWindow.cpp b/widgets/CabrilloLogWindow.cpp index 4bf70f805..44a52cc6b 100644 --- a/widgets/CabrilloLogWindow.cpp +++ b/widgets/CabrilloLogWindow.cpp @@ -67,7 +67,8 @@ CabrilloLogWindow::CabrilloLogWindow (QSettings * settings, Configuration const m_->ui_.log_table_view->setItemDelegateForColumn (2, new DateTimeAsSecsSinceEpochDelegate {this}); m_->ui_.log_table_view->setItemDelegateForColumn (3, new CallsignDelegate {this}); m_->ui_.log_table_view->setItemDelegateForColumn (6, new ForeignKeyDelegate {configuration->bands (), 0, this}); - m_->ui_.log_table_view->horizontalHeader ()->moveSection (6, 1); // band to first column + auto h_header = m_->ui_.log_table_view->horizontalHeader (); + h_header->moveSection (6, 1); // band to first column } CabrilloLogWindow::~CabrilloLogWindow () diff --git a/widgets/echoplot.cpp b/widgets/echoplot.cpp index 961173b06..0a93e889e 100644 --- a/widgets/echoplot.cpp +++ b/widgets/echoplot.cpp @@ -1,6 +1,8 @@ #include "echoplot.h" #include "commons.h" #include +#include +#include #include #include "moc_echoplot.cpp" diff --git a/widgets/echoplot.h b/widgets/echoplot.h index 23976b02e..a7492b974 100644 --- a/widgets/echoplot.h +++ b/widgets/echoplot.h @@ -4,17 +4,20 @@ // For more details see the accompanying file LICENSE_WHEATLEY.TXT /////////////////////////////////////////////////////////////////////////// -#ifndef EPLOTTER_H -#define EPLOTTER_H +#ifndef EPLOTTER_H_ +#define EPLOTTER_H_ -#include #include +#include #include -#include +#include #define VERT_DIVS 7 //specify grid screen divisions #define HORZ_DIVS 20 +class QPaintEvent; +class QResizeEvent; + class EPlotter : public QFrame { Q_OBJECT diff --git a/widgets/fastgraph.cpp b/widgets/fastgraph.cpp index 2c86d5dcb..e599138f2 100644 --- a/widgets/fastgraph.cpp +++ b/widgets/fastgraph.cpp @@ -3,6 +3,7 @@ #include "commons.h" #include #include +#include #include "fastplot.h" #include "SettingsGroup.hpp" diff --git a/widgets/fastgraph.h b/widgets/fastgraph.h index 1832d84c4..7ed32671f 100644 --- a/widgets/fastgraph.h +++ b/widgets/fastgraph.h @@ -1,5 +1,5 @@ -#ifndef FASTGRAPH_H -#define FASTGRAPH_H +#ifndef FASTGRAPH_H_ +#define FASTGRAPH_H_ #include #include @@ -9,6 +9,8 @@ namespace Ui { } class QSettings; +class QCloseEvent; +class QKeyEvent; class FastGraph : public QDialog { diff --git a/widgets/fastplot.cpp b/widgets/fastplot.cpp index cd186c2c8..1437834d8 100644 --- a/widgets/fastplot.cpp +++ b/widgets/fastplot.cpp @@ -1,6 +1,10 @@ #include "fastplot.h" #include "commons.h" #include +#include +#include +#include +#include #include #include "moc_fastplot.cpp" diff --git a/widgets/fastplot.h b/widgets/fastplot.h index 57a4ea904..b13913388 100644 --- a/widgets/fastplot.h +++ b/widgets/fastplot.h @@ -4,13 +4,16 @@ // For more details see the accompanying file LICENSE_WHEATLEY.TXT /////////////////////////////////////////////////////////////////////////// -#ifndef FPLOTTER_H -#define FPLOTTER_H +#ifndef FPLOTTER_H_ +#define FPLOTTER_H_ -#include #include -#include -#include +#include +#include +#include +#include + +class QMouseEvent; class FPlotter : public QFrame { diff --git a/widgets/logqso.h b/widgets/logqso.h index 346e3e5a2..3363d2eac 100644 --- a/widgets/logqso.h +++ b/widgets/logqso.h @@ -1,6 +1,6 @@ // -*- Mode: C++ -*- -#ifndef LogQSO_H -#define LogQSO_H +#ifndef LogQSO_H_ +#define LogQSO_H_ #include diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp index d54b8f1c9..d7e883652 100644 --- a/widgets/mainwindow.cpp +++ b/widgets/mainwindow.cpp @@ -1,12 +1,20 @@ //---------------------------------------------------------- MainWindow #include "mainwindow.h" #include +#include #include #include #include #include #include #include +#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -3100,7 +3108,7 @@ void MainWindow::readFromStdout() //readFromStdout if(w.at(0)==m_config.my_callsign() or w.at(0)==Radio::base_callsign(m_config.my_callsign())) { //### Check for ui->dxCallEntry->text()==foxCall before logging! ### ui->stopTxButton->click (); - on_logQSOButton_clicked(); + logQSOTimer.start(0); } if((w.at(2)==m_config.my_callsign() or w.at(2)==Radio::base_callsign(m_config.my_callsign())) and ui->tx3->text().length()>0) { @@ -3118,7 +3126,7 @@ void MainWindow::readFromStdout() //readFromStdout ui->tx3->text().length()>0) { if(w.at(2)=="RR73") { ui->stopTxButton->click (); - on_logQSOButton_clicked(); + logQSOTimer.start(0); } else { if(w.at(1)==Radio::base_callsign(ui->dxCallEntry->text()) and (w.at(2).mid(0,1)=="+" or w.at(2).mid(0,1)=="-")) { @@ -4453,7 +4461,7 @@ void MainWindow::processMessage (DecodedText const& message, Qt::KeyboardModifie m_nextCall=""; //### Temporary: disable use of "TU;" message if(SpecOp::RTTY == m_config.special_op_id() and m_nextCall!="") { // We're in RTTY contest and have "nextCall" queued up: send a "TU; ..." message - on_logQSOButton_clicked(); + logQSOTimer.start(0); ui->tx3->setText(ui->tx3->text().remove("TU; ")); useNextCall(); QString t="TU; " + ui->tx3->text(); @@ -4462,7 +4470,7 @@ void MainWindow::processMessage (DecodedText const& message, Qt::KeyboardModifie } else { // if(SpecOp::RTTY == m_config.special_op_id()) { if(false) { - on_logQSOButton_clicked(); + logQSOTimer.start(0); m_ntx=6; ui->txrb6->setChecked(true); } else { @@ -8216,7 +8224,7 @@ list2Done: { writeFoxQSO (QString {" Log: %1 %2 %3 %4 %5"}.arg (m_hisCall).arg (m_hisGrid) .arg (m_rptSent).arg (m_rptRcvd).arg (m_lastBand)); - on_logQSOButton_clicked(); + logQSOTimer.start(0); m_foxRateQueue.enqueue (now); //Add present time in seconds //to Rate queue. } diff --git a/widgets/mainwindow.h b/widgets/mainwindow.h index 428ea6890..cfae42029 100644 --- a/widgets/mainwindow.h +++ b/widgets/mainwindow.h @@ -1,12 +1,12 @@ // -*- Mode: C++ -*- #ifndef MAINWINDOW_H #define MAINWINDOW_H -#ifdef QT5 -#include -#else -#include -#endif + +#include +#include #include +#include +#include #include #include #include @@ -58,6 +58,8 @@ namespace Ui { class MainWindow; } +class QSharedMemory; +class QSplashScreen; class QSettings; class QLineEdit; class QFont; @@ -102,6 +104,8 @@ public: QWidget *parent = nullptr); ~MainWindow(); + int decoderBusy () const {return m_decoderBusy;} + public slots: void showSoundInError(const QString& errorMsg); void showSoundOutError(const QString& errorMsg); diff --git a/widgets/plotter.cpp b/widgets/plotter.cpp index cf3166127..761dae08d 100644 --- a/widgets/plotter.cpp +++ b/widgets/plotter.cpp @@ -1,5 +1,11 @@ #include "plotter.h" #include +#include +#include +#include +#include +#include +#include #include #include "commons.h" #include "moc_plotter.cpp" diff --git a/widgets/plotter.h b/widgets/plotter.h index 20d1739ac..e243c1777 100644 --- a/widgets/plotter.h +++ b/widgets/plotter.h @@ -5,18 +5,14 @@ // For more details see the accompanying file LICENSE_WHEATLEY.TXT /////////////////////////////////////////////////////////////////////////// -#ifndef PLOTTER_H -#define PLOTTER_H +#ifndef PLOTTER_H_ +#define PLOTTER_H_ -#ifdef QT5 -#include -#else -#include -#endif #include +#include #include #include -#include +#include #define VERT_DIVS 7 //specify grid screen divisions #define HORZ_DIVS 20 diff --git a/widgets/widegraph.cpp b/widgets/widegraph.cpp index 350eae9b0..b4601ba4c 100644 --- a/widgets/widegraph.cpp +++ b/widgets/widegraph.cpp @@ -3,6 +3,8 @@ #include #include #include +#include +#include #include "ui_widegraph.h" #include "commons.h" #include "Configuration.hpp" diff --git a/widgets/widegraph.h b/widgets/widegraph.h index f5e57f8dc..a809a6c8c 100644 --- a/widgets/widegraph.h +++ b/widgets/widegraph.h @@ -1,6 +1,6 @@ // -*- Mode: C++ -*- -#ifndef WIDEGRAPH_H -#define WIDEGRAPH_H +#ifndef WIDEGRAPH_H_ +#define WIDEGRAPH_H_ #include #include diff --git a/widgets/widgets.pri b/widgets/widgets.pri index e70c5cb9e..24ddd5a3c 100644 --- a/widgets/widgets.pri +++ b/widgets/widgets.pri @@ -19,7 +19,7 @@ HEADERS += \ widgets/echoplot.h widgets/echograph.h widgets/fastgraph.h \ widgets/fastplot.h widgets/MessageBox.hpp widgets/colorhighlighting.h \ widgets/ExportCabrillo.h widgets/AbstractLogWindow.hpp \ - widgets/FoxLogWindow.cpp widgets/CabrilloLogWindow.cpp + widgets/FoxLogWindow.hpp widgets/CabrilloLogWindow.hpp FORMS += \ widgets/mainwindow.ui widgets/about.ui \ From bf8749963546c5e2051d5ea21e68a204fb088abc Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Thu, 6 Dec 2018 14:04:14 +0000 Subject: [PATCH 4/6] Fix truncation of non-FT8 decoded messages in ALL.TXT --- widgets/mainwindow.cpp | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp index d7e883652..0a68d3f0d 100644 --- a/widgets/mainwindow.cpp +++ b/widgets/mainwindow.cpp @@ -2960,18 +2960,17 @@ void MainWindow::decodeDone () void MainWindow::readFromStdout() //readFromStdout { while(proc_jt9.canReadLine()) { - QByteArray t=proc_jt9.readLine(); + auto line_read = proc_jt9.readLine (); if(m_mode!="FT8") { - //Pad 22-char msg to 37 chars - t=t.left(43) + " " + t.mid(43,-1); - t=t.trimmed(); + //Pad 22-char msg to at least 37 chars + line_read = line_read.left(43) + " " + line_read.mid(43,-1); } // qint64 ms=QDateTime::currentMSecsSinceEpoch() - m_msec0; bool bAvgMsg=false; int navg=0; - if(t.indexOf("") >= 0) { + if(line_read.indexOf("") >= 0) { if(m_mode=="QRA64") m_wideGraph->drawRed(0,0); - m_bDecoded = t.mid(20).trimmed().toInt() > 0; + m_bDecoded = line_read.mid(20).trimmed().toInt() > 0; int mswait=3*1000*m_TRperiod/4; if(!m_diskData) killFileTimer.start(mswait); //Kill in 3/4 period decodeDone (); @@ -2983,16 +2982,16 @@ void MainWindow::readFromStdout() //readFromStdout return; } else { if(m_mode=="JT4" or m_mode=="JT65" or m_mode=="QRA64" or m_mode=="FT8") { - int n=t.indexOf("f"); - if(n<0) n=t.indexOf("d"); + int n=line_read.indexOf("f"); + if(n<0) n=line_read.indexOf("d"); if(n>0) { - QString tt=t.mid(n+1,1); + QString tt=line_read.mid(n+1,1); navg=tt.toInt(); if(navg==0) { char c = tt.data()->toLatin1(); if(int(c)>=65 and int(c)<=90) navg=int(c)-54; } - if(navg>1 or t.indexOf("f*")>0) bAvgMsg=true; + if(navg>1 or line_read.indexOf("f*")>0) bAvgMsg=true; } } @@ -3005,8 +3004,7 @@ void MainWindow::readFromStdout() //readFromStdout << m_mode << endl; m_RxLog=0; } - int n=t.length(); - out << t.mid(0,n-2) << endl; + out << line_read.left (line_read.size() - 2).trimmed () << endl; f.close(); } else { MessageBox::warning_message (this, tr ("File Open Error") @@ -3022,9 +3020,9 @@ void MainWindow::readFromStdout() //readFromStdout m_blankLine = false; } - DecodedText decodedtext0 {QString::fromUtf8(t.constData()) + DecodedText decodedtext0 {QString::fromUtf8(line_read.constData()) .remove(QRegularExpression {"\r|\n"})}; - DecodedText decodedtext {QString::fromUtf8(t.constData()) + DecodedText decodedtext {QString::fromUtf8(line_read.constData()) .remove(QRegularExpression {"\r|\n"}).remove("TU; ")}; if(m_mode=="FT8" and SpecOp::FOX == m_config.special_op_id() and From 7cd7989f4503380928a88ae88759af29c4e55615 Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Thu, 6 Dec 2018 15:34:46 +0000 Subject: [PATCH 5/6] Fix line ending handling when processing decodes --- widgets/mainwindow.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp index 0a68d3f0d..8c9648b50 100644 --- a/widgets/mainwindow.cpp +++ b/widgets/mainwindow.cpp @@ -2961,9 +2961,14 @@ void MainWindow::readFromStdout() //readFromStdout { while(proc_jt9.canReadLine()) { auto line_read = proc_jt9.readLine (); + if (auto p = std::strpbrk (line_read.constData (), "\n\r")) + { + // truncate before line ending chars + line_read = line_read.left (p - line_read.constData ()); + } if(m_mode!="FT8") { //Pad 22-char msg to at least 37 chars - line_read = line_read.left(43) + " " + line_read.mid(43,-1); + line_read = line_read.left(43) + " " + line_read.mid(43); } // qint64 ms=QDateTime::currentMSecsSinceEpoch() - m_msec0; bool bAvgMsg=false; @@ -3004,6 +3009,7 @@ void MainWindow::readFromStdout() //readFromStdout << m_mode << endl; m_RxLog=0; } + qDebug () << "line_read:" << line_read; out << line_read.left (line_read.size() - 2).trimmed () << endl; f.close(); } else { @@ -3020,10 +3026,8 @@ void MainWindow::readFromStdout() //readFromStdout m_blankLine = false; } - DecodedText decodedtext0 {QString::fromUtf8(line_read.constData()) - .remove(QRegularExpression {"\r|\n"})}; - DecodedText decodedtext {QString::fromUtf8(line_read.constData()) - .remove(QRegularExpression {"\r|\n"}).remove("TU; ")}; + DecodedText decodedtext0 {QString::fromUtf8(line_read.constData())}; + DecodedText decodedtext {QString::fromUtf8(line_read.constData()).remove("TU; ")}; if(m_mode=="FT8" and SpecOp::FOX == m_config.special_op_id() and (decodedtext.string().contains("R+") or decodedtext.string().contains("R-"))) { From cf244660cd81b1e42e46ab14c93293b64da1f662 Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Thu, 6 Dec 2018 15:39:21 +0000 Subject: [PATCH 6/6] Removed unnecessary diagnostic print --- widgets/mainwindow.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp index 8c9648b50..827022717 100644 --- a/widgets/mainwindow.cpp +++ b/widgets/mainwindow.cpp @@ -3009,7 +3009,6 @@ void MainWindow::readFromStdout() //readFromStdout << m_mode << endl; m_RxLog=0; } - qDebug () << "line_read:" << line_read; out << line_read.left (line_read.size() - 2).trimmed () << endl; f.close(); } else {