Protect against faulty or missing tsil.3q file.

This commit is contained in:
Joe Taylor 2023-02-20 14:19:38 -05:00
parent 92c9dd7fd6
commit 16f9f50263
4 changed files with 51 additions and 36 deletions

View File

@ -20,7 +20,12 @@ subroutine get_q3list(fname,nlist,list)
nhist2=0 nhist2=0
open(24,file=fname,status='unknown',form='unformatted') open(24,file=fname,status='unknown',form='unformatted')
read(24,end=1) nhist2,callers(1:nhist2) read(24,end=1) nhist2
if(nhist2.ge.1 .and. nhist2.le.40) then
read(24,end=1) callers(1:nhist2)
else
nhist2=0
endif
1 close(24) 1 close(24)
now=time() now=time()

View File

@ -115,15 +115,20 @@ contains
! NA VHF, WW-Digi, or ARRL Digi Contest ! NA VHF, WW-Digi, or ARRL Digi Contest
open(24,file=trim(data_dir)//'/tsil.3q',status='unknown', & open(24,file=trim(data_dir)//'/tsil.3q',status='unknown', &
form='unformatted') form='unformatted')
read(24,end=2) nhist2,callers(1:nhist2) read(24,end=2) nhist2
now=time() if(nhist2.ge.1 .and. nhist2.le.40) then
do i=1,nhist2 read(24,end=2) callers(1:nhist2)
hours=(now - callers(i)%nsec)/3600.0 now=time()
if(hours.gt.24.0) then do i=1,nhist2
callers(i:nhist2-1)=callers(i+1:nhist2) hours=(now - callers(i)%nsec)/3600.0
nhist2=nhist2-1 if(hours.gt.24.0) then
endif callers(i:nhist2-1)=callers(i+1:nhist2)
enddo nhist2=nhist2-1
endif
enddo
else
nhist2=0
endif
2 close(24) 2 close(24)
endif endif

View File

@ -913,10 +913,13 @@ subroutine q65_hist2(nfreq,msg0,callers,nhist2)
callers(nhist2)%nfreq=nfreq callers(nhist2)%nfreq=nfreq
endif endif
open(24,file=trim(data_dir)//'/tsil.3q',status='unknown', & if(nhist2.ge.1 .and. nhist2.le.40) then
form='unformatted') open(24,file=trim(data_dir)//'/tsil.3q',status='unknown', &
write(24) nhist2,callers(1:nhist2) form='unformatted')
close(24) write(24) nhist2
write(24) callers(1:nhist2)
close(24)
endif
900 return 900 return
end subroutine q65_hist2 end subroutine q65_hist2

View File

@ -59,29 +59,31 @@ void ActiveStations::write_settings ()
void ActiveStations::displayRecentStations(QString mode, QString const& t) void ActiveStations::displayRecentStations(QString mode, QString const& t)
{ {
m_mode=mode; if(mode!=m_mode) {
if(m_mode=="Q65") { m_mode=mode;
ui->header_label2->setText(" N Frx Fsked S/N Call Grid Tx Age"); if(m_mode=="Q65") {
ui->label->setText("QSOs:"); ui->header_label2->setText(" N Frx Fsked S/N Call Grid Tx Age");
} else if(m_mode=="Q65-pileup") { ui->label->setText("QSOs:");
ui->header_label2->setText(" N Freq Call Grid El Age(h)"); } else if(m_mode=="Q65-pileup") {
} else { ui->header_label2->setText(" N Freq Call Grid El Age(h)");
ui->header_label2->setText(" N Call Grid Az S/N Freq Tx Age Pts"); } else {
ui->label->setText("Rate:"); ui->header_label2->setText(" N Call Grid Az S/N Freq Tx Age Pts");
} ui->label->setText("Rate:");
bool b=(m_mode.left(3)=="Q65"); }
ui->bandChanges->setVisible(!b); bool b=(m_mode.left(3)=="Q65");
ui->cbReadyOnly->setVisible(!b); ui->bandChanges->setVisible(!b);
ui->label_2->setVisible(!b); ui->cbReadyOnly->setVisible(!b);
ui->label_3->setVisible(!b); ui->label_2->setVisible(!b);
ui->score->setVisible(!b); ui->label_3->setVisible(!b);
ui->sbMaxRecent->setVisible(!b); ui->score->setVisible(!b);
ui->RecentStationsPlainTextEdit->insertPlainText(t); ui->sbMaxRecent->setVisible(!b);
b=(m_mode!="Q65-pileup"); b=(m_mode!="Q65-pileup");
ui->sbMaxAge->setVisible(b); ui->sbMaxAge->setVisible(b);
ui->label->setVisible(b); ui->label->setVisible(b);
ui->rate->setVisible(b); ui->rate->setVisible(b);
}
ui->RecentStationsPlainTextEdit->insertPlainText(t);
} }
int ActiveStations::maxRecent() int ActiveStations::maxRecent()