From d4e454c0add0703b68d4da3b0e73914a1a360760 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Fri, 31 Jan 2014 19:01:33 +0000 Subject: [PATCH] Implement automatic generation of "Type 1" or "Type 2" messages with compound callsigns, as required. TO DO: Now that the fixed "short list" of common prefixes and suffixes is compiled into the code, would be better to remove the requirement for file prefixes.txt. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3679 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- mainwindow.cpp | 43 ++++++++++++++++++++++++++++++++++++------- mainwindow.h | 1 + 2 files changed, 37 insertions(+), 7 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 5ceb2d7ab..64674eae5 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -366,6 +366,7 @@ MainWindow::MainWindow(QSettings * settings, QSharedMemory *shdmem, QString *the border-style: outset; border-width: 1px; border-radius: 5px; \ border-color: black; min-width: 5em; padding: 3px;}"; + getpfx(); //Load the prefix/suffix dictionary genStdMsgs(m_rpt); m_ntx=6; ui->txrb6->setChecked(true); @@ -438,8 +439,6 @@ MainWindow::MainWindow(QSettings * settings, QSharedMemory *shdmem, QString *the out << QDateTime::currentDateTimeUtc().toString("yyyy-MMM-dd hh:mm") << " " << m_dialFreq << " MHz " << m_mode << endl; f2.close(); - - getpfx(); } // End of MainWindow constructor //--------------------------------------------------- MainWindow destructor @@ -2121,9 +2120,10 @@ void MainWindow::genStdMsgs(QString rpt) //genStdMsgs() } QString hisBase=baseCall(hisCall); QString myBase=baseCall(m_myCall); + QString t0=hisBase + " " + myBase + " "; t=t0 + m_myGrid.mid(0,4); - if(myBase!=m_myCall) t="DE " + m_myCall + " " + m_myGrid.mid(0,4); +// if(myBase!=m_myCall) t="DE " + m_myCall + " " + m_myGrid.mid(0,4); //### msgtype(t, ui->tx1); if(rpt == "") { t=t+" OOO"; @@ -2139,12 +2139,33 @@ void MainWindow::genStdMsgs(QString rpt) //genStdMsgs() t=t0 + "RRR"; msgtype(t, ui->tx4); t=t0 + "73"; - if(myBase!=m_myCall) t="DE " + m_myCall + " 73"; +// if(myBase!=m_myCall) t="DE " + m_myCall + " 73"; //### msgtype(t, ui->tx5); } t="CQ " + m_myCall + " " + m_myGrid.mid(0,4); msgtype(t, ui->tx6); + + if(m_myCall!=myBase) { + if(shortList(m_myCall)) { + t="CQ " + m_myCall; + msgtype(t, ui->tx6); + } else { + t="DE " + m_myCall + " " + m_myGrid.mid(0,4); + msgtype(t, ui->tx2); + t="DE " + m_myCall + " 73"; + msgtype(t, ui->tx5); + t="CQ " + m_myCall + " " + m_myGrid.mid(0,4); + msgtype(t, ui->tx6); + } + } else { + if(hisCall!=hisBase) { + if(shortList(hisCall)) { + t=hisCall + " " + m_myCall; + msgtype(t, ui->tx2); + } + } + } m_ntx=1; ui->txrb1->setChecked(true); m_rpt=rpt; @@ -3136,13 +3157,21 @@ void MainWindow::getpfx() m_suffix << "P" << "0" << "1" << "2" << "3" << "4" << "5" << "6" \ << "7" << "8" << "9" << "A"; - qDebug() << m_suffix.length() << m_prefix.length(); for(int i=0; i<12; i++) { m_sfx.insert(m_suffix[i],true); } for(int i=0; i<339; i++) { m_pfx.insert(m_prefix[i],true); } - qDebug() << m_sfx.contains("4") << m_sfx.contains("X"); - qDebug() << m_pfx.contains("ZD8") << m_pfx.contains("ZD6"); +\} + +bool MainWindow::shortList(QString callsign) +{ + int n=callsign.length(); + int i1=callsign.indexOf("/"); + Q_ASSERT(i1>0 and i1