Fix the updateRate() logic, and the logic for "ProcessMsgNormally". (Is it right, yet??)

This commit is contained in:
Joe Taylor 2022-04-11 13:08:16 -04:00
parent cf27347656
commit ab72238132
2 changed files with 28 additions and 21 deletions

View File

@ -3450,6 +3450,7 @@ void MainWindow::ARRL_Digi_Update(DecodedText dt)
m_recentCall[deCall]=rc; m_recentCall[deCall]=rc;
m_points=m_activeCall.value(deCall).points; m_points=m_activeCall.value(deCall).points;
} }
updateRate();
} }
void MainWindow::ARRL_Digi_Display() void MainWindow::ARRL_Digi_Display()
@ -3755,18 +3756,18 @@ void MainWindow::readFromStdout() //readFromStdout
} }
} }
if(m_bCallingCQ && !m_bAutoReply && for_us && SpecOp::FOX > m_config.special_op_id()) { if(m_bCallingCQ && !m_bAutoReply && for_us && SpecOp::FOX > m_config.special_op_id()) {
bool bActiveStations=false; bool bProcessMsgNormally=ui->respondComboBox->currentText()=="CQ: First" or
if(ui->respondComboBox->currentText()=="CQ: First") bActiveStations=true; (ui->respondComboBox->currentText()=="CQ: Max Dist" and m_ActiveStationsWidget==NULL) or
(m_ActiveStationsWidget!=NULL and !m_ActiveStationsWidget->isVisible());
if(ui->respondComboBox->currentText()=="CQ: Max Dist" and m_ActiveStationsWidget==NULL) bActiveStations=true; QString t=decodedtext.messageWords()[4];
if(m_ActiveStationsWidget!=NULL and !m_ActiveStationsWidget->isVisible()) bActiveStations=true; if(t.contains("R+") or t.contains("R-") or t.contains("R ")) bProcessMsgNormally=true;
if(bActiveStations) { if(bProcessMsgNormally) {
m_bDoubleClicked=true; m_bDoubleClicked=true;
m_bAutoReply = true; m_bAutoReply = true;
processMessage (decodedtext); processMessage (decodedtext);
} }
if(!bActiveStations and m_ActiveStationsWidget and ui->respondComboBox->currentText()=="CQ: Max Dist") { if(!bProcessMsgNormally and m_ActiveStationsWidget and ui->respondComboBox->currentText()=="CQ: Max Dist") {
QString deCall; QString deCall;
QString deGrid; QString deGrid;
decodedtext.deCallAndGrid(/*out*/deCall,deGrid); decodedtext.deCallAndGrid(/*out*/deCall,deGrid);
@ -6322,20 +6323,7 @@ void MainWindow::acceptQSO (QDateTime const& QSO_date_off, QString const& call,
al.band=band; al.band=band;
al.points=points; al.points=points;
m_arrl_log.append(al); m_arrl_log.append(al);
int iz=m_arrl_log.size(); updateRate();
int rate=0;
int nbc=0;
for(int i=iz-1; i>=0; i--) {
double hrDiff = m_arrl_log[i].time.msecsTo(al.time)/3600000.0;
if(hrDiff > 1.0) break;
rate += m_arrl_log[i].points;
if(i<iz-1 and m_arrl_log[i].band != m_arrl_log[i+1].band) nbc += 1;
}
m_ActiveStationsWidget->setRate(rate);
m_ActiveStationsWidget->setScore(m_score);
m_ActiveStationsWidget->setBandChanges(nbc);
} }
m_xSent.clear (); m_xSent.clear ();
@ -6344,6 +6332,24 @@ void MainWindow::acceptQSO (QDateTime const& QSO_date_off, QString const& call,
if (m_config.clear_DXgrid ()) ui->dxGridEntry->clear (); if (m_config.clear_DXgrid ()) ui->dxGridEntry->clear ();
} }
void MainWindow::updateRate()
{
int iz=m_arrl_log.size();
int rate=0;
int nbc=0;
double hrDiff;
for(int i=iz-1; i>=0; i--) {
hrDiff = m_arrl_log[i].time.msecsTo(QDateTime::currentDateTimeUtc())/3600000.0;
if(hrDiff > 1.0) break;
rate += m_arrl_log[i].points;
if(i<iz-1 and m_arrl_log[i].band != m_arrl_log[i+1].band) nbc += 1;
}
m_ActiveStationsWidget->setRate(rate);
m_ActiveStationsWidget->setScore(m_score);
m_ActiveStationsWidget->setBandChanges(nbc);
}
qint64 MainWindow::nWidgets(QString t) qint64 MainWindow::nWidgets(QString t)
{ {
Q_ASSERT(t.length()==N_WIDGETS); Q_ASSERT(t.length()==N_WIDGETS);

View File

@ -785,6 +785,7 @@ private:
void CQTxFreq(); void CQTxFreq();
void useNextCall(); void useNextCall();
void abortQSO(); void abortQSO();
void updateRate();
void write_all(QString txRx, QString message); void write_all(QString txRx, QString message);
bool isWorked(int itype, QString key, float fMHz=0, QString=""); bool isWorked(int itype, QString key, float fMHz=0, QString="");