Fix the generation of Tx* messages containing nonstandard calls.

This commit is contained in:
Joe Taylor 2018-07-30 11:17:09 -04:00
parent c87296d90e
commit cbf8b5d914
3 changed files with 56 additions and 16 deletions

View File

@ -69,8 +69,8 @@ TNX BOB 73 GL
free text msg free text msg
CQ YW18FIFA CQ YW18FIFA
<YW18FIFA> KA1ABC <YW18FIFA> KA1ABC
KA1ABC <YW1FIFA> -11 KA1ABC <YW18FIFA> -11
<YW1FIFA> KA1ABC R-17 <YW18FIFA> KA1ABC R-17
<KA1ABC> YW1FIFA RR73 <KA1ABC> YW18FIFA RR73
<YW1FIFA> KA1ABC 73 <YW18FIFA> KA1ABC 73
123456789ABCD 123456789ABCD

View File

@ -140,7 +140,7 @@ extern "C" {
void plotsave_(float swide[], int* m_w , int* m_h1, int* irow); void plotsave_(float swide[], int* m_w , int* m_h1, int* irow);
bool stdmsg_(char const * msg, char const * mygrid, fortran_charlen_t, fortran_charlen_t); void chkcall_(char* w, char* basc_call, bool cok, int len1, int len2);
} }
int volatile itone[NUM_ISCAT_SYMBOLS]; //Audio tones for all Tx symbols int volatile itone[NUM_ISCAT_SYMBOLS]; //Audio tones for all Tx symbols
@ -4464,13 +4464,24 @@ void MainWindow::genCQMsg ()
if(m_config.my_callsign().size () && m_config.my_grid().size ()) { if(m_config.my_callsign().size () && m_config.my_grid().size ()) {
auto const& grid = m_config.my_callsign () != m_baseCall && shortList (m_config.my_callsign ()) ? QString {} : m_config.my_grid (); auto const& grid = m_config.my_callsign () != m_baseCall && shortList (m_config.my_callsign ()) ? QString {} : m_config.my_grid ();
if (ui->cbCQTx->isEnabled () && ui->cbCQTx->isVisible () && ui->cbCQTx->isChecked ()) { if (ui->cbCQTx->isEnabled () && ui->cbCQTx->isVisible () && ui->cbCQTx->isChecked ()) {
msgtype (QString {"CQ %1 %2 %3"} if(stdCall(m_config.my_callsign())) {
msgtype (QString {"CQ %1 %2 %3"}
.arg (m_freqNominal / 1000 - m_freqNominal / 1000000 * 1000, 3, 10, QChar {'0'}) .arg (m_freqNominal / 1000 - m_freqNominal / 1000000 * 1000, 3, 10, QChar {'0'})
.arg (m_config.my_callsign()) .arg (m_config.my_callsign())
.arg (grid.left (4)), .arg (grid.left (4)),
ui->tx6); ui->tx6);
} else {
msgtype (QString {"CQ %1 %2"}
.arg (m_freqNominal / 1000 - m_freqNominal / 1000000 * 1000, 3, 10, QChar {'0'})
.arg (m_config.my_callsign()),
ui->tx6);
}
} else { } else {
msgtype (QString {"%1 %2 %3"}.arg(m_CQtype).arg(m_config.my_callsign()).arg(grid.left(4)),ui->tx6); if(stdCall(m_config.my_callsign())) {
msgtype (QString {"%1 %2 %3"}.arg(m_CQtype).arg(m_config.my_callsign()).arg(grid.left(4)),ui->tx6);
} else {
msgtype (QString {"%1 %2"}.arg(m_CQtype).arg(m_config.my_callsign()),ui->tx6);
}
} }
if ((m_mode=="JT4" or m_mode=="QRA64") and ui->cbShMsgs->isChecked()) { if ((m_mode=="JT4" or m_mode=="QRA64") and ui->cbShMsgs->isChecked()) {
if (ui->cbTx6->isChecked ()) { if (ui->cbTx6->isChecked ()) {
@ -4489,8 +4500,26 @@ void MainWindow::genCQMsg ()
} }
} }
void MainWindow::genStdMsgs(QString rpt, bool unconditional) bool MainWindow::stdCall(QString w)
{ {
int n=w.trimmed().length();
//Treat /P and /R as special cases:
if((w.mid(n-2,2)=="/P") and m_nContest==EU_VHF) w=w.left(n-2);
if(w.mid(n-2,2)=="/R") w=w.left(n-2);
n=w.trimmed().length();
if(n>6) return false;
w=w.toUpper();
for(int i=0; i<n; i++) {
QString c=w.mid(i,1);
bool b=(c>="A" and c<="Z") or (c>="0" and c<="9") or c=="/";
if(!b) return false;
}
return true;
}
void MainWindow::genStdMsgs(QString rpt, bool unconditional)
{
genCQMsg (); genCQMsg ();
auto const& hisCall=ui->dxCallEntry->text(); auto const& hisCall=ui->dxCallEntry->text();
if(!hisCall.size ()) { if(!hisCall.size ()) {
@ -4515,8 +4544,16 @@ void MainWindow::genStdMsgs(QString rpt, bool unconditional)
auto const& hisBase = Radio::base_callsign (hisCall); auto const& hisBase = Radio::base_callsign (hisCall);
auto eme_short_codes = m_config.enable_VHF_features () && ui->cbShMsgs->isChecked () auto eme_short_codes = m_config.enable_VHF_features () && ui->cbShMsgs->isChecked ()
&& m_mode == "JT65"; && m_mode == "JT65";
bool bMyCall=stdCall(my_callsign);
bool bHisCall=stdCall(hisCall);
QString t0=hisBase + " " + m_baseCall + " "; QString t0=hisBase + " " + m_baseCall + " ";
if(m_config.bGenerate77()) t0=hisCall + " " + my_callsign + " "; if(m_config.bGenerate77()) {
if(bHisCall and bMyCall) t0=hisCall + " " + my_callsign + " ";
if(bHisCall and !bMyCall) t0=hisCall + " <" + my_callsign + "> ";
if(!bHisCall and bMyCall) t0="<"+hisCall + "> " + my_callsign + " ";
}
QString t00=t0; QString t00=t0;
QString t {t0 + my_grid}; QString t {t0 + my_grid};
msgtype(t, ui->tx1); msgtype(t, ui->tx1);
@ -4603,7 +4640,6 @@ void MainWindow::genStdMsgs(QString rpt, bool unconditional)
if ((m_mode=="JT4" || m_mode=="QRA64") && m_bShMsgs) t="@1500 (RRR)"; if ((m_mode=="JT4" || m_mode=="QRA64") && m_bShMsgs) t="@1500 (RRR)";
msgtype(t, ui->tx4); msgtype(t, ui->tx4);
if(m_config.bGenerate77()) return;
t=t0 + "73"; t=t0 + "73";
if (m_mode=="JT4" || m_mode=="QRA64") { if (m_mode=="JT4" || m_mode=="QRA64") {
@ -4618,6 +4654,8 @@ void MainWindow::genStdMsgs(QString rpt, bool unconditional)
} }
} }
if(m_config.bGenerate77()) return;
if (is_compound) { if (is_compound) {
if (is_type_one) { if (is_type_one) {
t=hisBase + " " + my_callsign; t=hisBase + " " + my_callsign;
@ -4873,24 +4911,25 @@ void MainWindow::msgtype(QString t, QLineEdit* tx) //msgtype()
int i0=t.trimmed().length()-7; int i0=t.trimmed().length()-7;
if(t.mid(i0,3)==" R ") text=false; if(t.mid(i0,3)==" R ") text=false;
} }
if(m_config.bFieldDay() or m_config.bRTTYroundup() or m_config.bNA_VHF_Contest() or if(m_config.bGenerate77()) text=false;
m_config.bEU_VHF_Contest()) text=false;
//### ... to here ... //### ... to here ...
QPalette p(tx->palette()); QPalette p(tx->palette());
if(text) { if(text) {
p.setColor(QPalette::Base,"#ffccff"); p.setColor(QPalette::Base,"#ffccff"); //pink
} else { } else {
if(shortMsg) { if(shortMsg) {
p.setColor(QPalette::Base,"#66ffff"); p.setColor(QPalette::Base,"#66ffff"); //light blue
} else { } else {
p.setColor(QPalette::Base,Qt::transparent); p.setColor(QPalette::Base,Qt::transparent);
if(m_mode=="MSK144" and t.mid(0,1)=="<") { if(m_mode=="MSK144" and t.mid(0,1)=="<") {
p.setColor(QPalette::Base,"#00ffff"); p.setColor(QPalette::Base,"#00ffff"); //another light blue
} }
} }
} }
tx->setPalette(p); tx->setPalette(p);
auto pos = tx->cursorPosition (); auto pos = tx->cursorPosition ();
tx->setText(t.toUpper()); tx->setText(t.toUpper());
tx->setCursorPosition (pos); tx->setCursorPosition (pos);

View File

@ -294,7 +294,8 @@ private slots:
void on_comboBoxHoundSort_activated (int index); void on_comboBoxHoundSort_activated (int index);
void not_GA_warning_message (); void not_GA_warning_message ();
void setContestType(); void setContestType();
int setTxMsg(int n); int setTxMsg(int n);
bool stdCall(QString w);
private: private:
Q_SIGNAL void initializeAudioOutputStream (QAudioDeviceInfo, Q_SIGNAL void initializeAudioOutputStream (QAudioDeviceInfo,