More work on the ActiveStations features.

This commit is contained in:
Joe Taylor 2022-03-17 16:43:58 -04:00
parent f3bac687ba
commit 5668e74f61
5 changed files with 23 additions and 10 deletions

View File

@ -3,6 +3,7 @@
#include <QSettings>
#include <QApplication>
#include <QTextCharFormat>
#include <QDateTime>
#include "SettingsGroup.hpp"
#include "qt_helpers.hpp"
@ -20,7 +21,7 @@ ActiveStations::ActiveStations(QSettings * settings, QFont const& font, QWidget
ui->RecentStationsPlainTextEdit->setReadOnly (true);
changeFont (font);
read_settings ();
ui->header_label2->setText(" Call Grid Age Points");
ui->header_label2->setText(" N Call Grid Tx Age Points");
connect(ui->RecentStationsPlainTextEdit, &QPlainTextEdit::selectionChanged, this, select);
}
@ -69,6 +70,9 @@ int ActiveStations::maxAge()
void ActiveStations::select()
{
qint64 msec=QDateTime::currentMSecsSinceEpoch();
if((msec-m_msec0)<500) return;
m_msec0=msec;
int nline=ui->RecentStationsPlainTextEdit->textCursor().blockNumber();
emit callSandP(nline);
}

View File

@ -31,7 +31,8 @@ signals:
private:
void read_settings ();
void write_settings ();
// void setContentFont (QFont const&);
qint64 m_msec0=0;
QSettings * settings_;
QScopedPointer<Ui::ActiveStations> ui;

View File

@ -36,7 +36,7 @@
<string>Max Age </string>
</property>
<property name="minimum">
<number>4</number>
<number>0</number>
</property>
<property name="maximum">
<number>10</number>
@ -64,7 +64,7 @@
<string>Max Recent </string>
</property>
<property name="maximum">
<number>20</number>
<number>50</number>
</property>
<property name="value">
<number>10</number>

View File

@ -3402,6 +3402,7 @@ void MainWindow::ARRL_Digi_Update(DecodedText dt)
rc.audioFreq=dt.frequencyOffset();
rc.snr=dt.snr();
m_latestDecodeTime=dt.timeInSeconds();
rc.txEven = (m_latestDecodeTime % int(2*m_TRperiod)) > 0;
rc.ready2call=false;
bool bCQ=dt.messageWords()[0].left(3)=="CQ ";
if(bCQ or deGrid=="RR73" or deGrid=="73") rc.ready2call=true;
@ -3427,8 +3428,10 @@ void MainWindow::ARRL_Digi_Display()
icall.next();
deCall=icall.key();
age=int((m_latestDecodeTime - icall.value().decodeTime)/m_TRperiod + 0.5);
int itx=1;
if(icall.value().txEven) itx=0;
if(age>maxAge) {
// qDebug() << "bb" << i << deCall << "removed";
qDebug() << "bb" << i << deCall << "removed";
icall.remove();
} else {
i++;
@ -3436,7 +3439,7 @@ void MainWindow::ARRL_Digi_Display()
if(points>maxPoints) maxPoints=points;
pts[i-1]=points - float(age)/(maxAge+1);
QString t1;
t1 = t1.asprintf(" %2d %5d",age,points);
t1 = t1.asprintf(" %2d %2d %5d",itx,age,points);
t1 = (deCall + " ").left(6) + " " + m_activeCall[deCall].grid4 + t1;
list.append(t1);
}
@ -3449,15 +3452,17 @@ void MainWindow::ARRL_Digi_Display()
int k=indx[j]-1;
m_ready2call[i]=list[k];
i++;
t += (list[k] + "\n");
QString t1=QString::number(i) + ". ";
if(i<10) t1=" " + t1;
t += (t1 + list[k] + "\n");
}
if(m_ActiveStationsWidget!=NULL) m_ActiveStationsWidget->displayRecentStations(t);
}
void MainWindow::callSandP2(int n)
{
if(m_ready2call[n]=="") return;
QStringList w=m_ready2call[n].split(' ', SkipEmptyParts);
m_deCall=w[0]; //### needed?
m_deGrid=w[1]; //### needed?
m_bDoubleClicked=true; //### needed?
@ -3465,8 +3470,10 @@ void MainWindow::callSandP2(int n)
ui->dxGridEntry->setText(m_deGrid);
genStdMsgs("-10"); //### real SNR would be better here?
setTxMsg(3);
m_txFirst = (w[2]=="0");
ui->txFirstCheckBox->setChecked(m_txFirst);
if (!ui->autoButton->isChecked()) ui->autoButton->click(); // Enable Tx
if(m_transmitting) m_restart=true;
}
void MainWindow::readFromStdout() //readFromStdout

View File

@ -648,7 +648,7 @@ private:
QString m_BestCQpriority;
QString m_deCall;
QString m_deGrid;
QString m_ready2call[20];
QString m_ready2call[50];
QSet<QString> m_pfx;
QSet<QString> m_sfx;
@ -690,6 +690,7 @@ private:
qint32 audioFreq;
qint32 snr;
qint32 decodeTime;
bool txEven;
bool ready2call;
};
QMap<QString,RecentCall> m_recentCall; //Key = callsign, value = snr, dialFreq, audioFreq, decodeTime