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
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)
now=time()

View File

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

View File

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

View File

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