Allow for new directional CQ messages in message processing

Also relax entry validation so it  is easier to enter standard message
forms longer than 13 characters into message entry line edits.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7294 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Bill Somerville 2016-11-05 19:41:03 +00:00
parent dc62eb04ad
commit 5152778813
2 changed files with 7 additions and 15 deletions

View File

@ -1,7 +1,8 @@
#include <QStringList>
#include <QDebug>
#include "decodedtext.h" #include "decodedtext.h"
#include <QStringList>
#include <QRegularExpression>
QString DecodedText::CQersCall() QString DecodedText::CQersCall()
{ {
// extract the CQer's call TODO: does this work with all call formats? // extract the CQer's call TODO: does this work with all call formats?
@ -123,7 +124,7 @@ bool DecodedText::report(QString const& myBaseCall, QString const& dxBaseCall, /
QString DecodedText::call() QString DecodedText::call()
{ {
auto call = _string; auto call = _string;
call = call.replace (" CQ DX ", " CQ_DX ").mid (column_qsoText); call = call.replace (QRegularExpression {" CQ ([A-Z]{2,2}) "}, " CQ_\\1 ").mid (column_qsoText);
int i = call.indexOf(" "); int i = call.indexOf(" ");
return call.mid(0,i); return call.mid(0,i);
} }
@ -132,7 +133,7 @@ QString DecodedText::call()
void DecodedText::deCallAndGrid(/*out*/QString& call, QString& grid) void DecodedText::deCallAndGrid(/*out*/QString& call, QString& grid)
{ {
auto msg = _string; auto msg = _string;
msg = msg.replace (" CQ DX ", " CQ_DX ").mid (column_qsoText); msg = msg.replace (QRegularExpression {" CQ ([A-Z]{2,2}) "}, " CQ_\\1 ").mid (column_qsoText);
int i1 = msg.indexOf(" "); int i1 = msg.indexOf(" ");
call = msg.mid(i1+1); call = msg.mid(i1+1);
int i2 = call.indexOf(" "); int i2 = call.indexOf(" ");

View File

@ -3278,7 +3278,7 @@ void MainWindow::processMessage(QString const& messages, int position, bool ctrl
} }
auto t3 = decodedtext.string (); auto t3 = decodedtext.string ();
auto t4 = t3.replace (" CQ DX ", " CQ_DX ").split (" ", QString::SkipEmptyParts); auto t4 = t3.replace (QRegularExpression {" CQ ([A-Z]{2,2}) "}, " CQ_\\1 ").split (" ", QString::SkipEmptyParts);
if(t4.size () < 6) return; //Skip the rest if no decoded text if(t4.size () < 6) return; //Skip the rest if no decoded text
int frequency = decodedtext.frequencyOffset(); int frequency = decodedtext.frequencyOffset();
@ -3794,9 +3794,6 @@ void MainWindow::msgtype(QString t, QLineEdit* tx) //msgtype()
if(itype==6) text=true; if(itype==6) text=true;
if(itype==7 and m_config.enable_VHF_features() and (m_mode=="JT65" or m_mode=="MSK144")) short65=true; if(itype==7 and m_config.enable_VHF_features() and (m_mode=="JT65" or m_mode=="MSK144")) short65=true;
if(m_mode=="MSK144" and t.mid(0,1)=="<") text=false; if(m_mode=="MSK144" and t.mid(0,1)=="<") text=false;
QString t1;
t1.fromLatin1(msgsent);
if(text) t1=t1.mid(0,13);
QPalette p(tx->palette()); QPalette p(tx->palette());
if(text) { if(text) {
p.setColor(QPalette::Base,"#ffccff"); p.setColor(QPalette::Base,"#ffccff");
@ -3811,14 +3808,8 @@ void MainWindow::msgtype(QString t, QLineEdit* tx) //msgtype()
} }
} }
tx->setPalette(p); tx->setPalette(p);
int len=t.length();
auto pos = tx->cursorPosition (); auto pos = tx->cursorPosition ();
if(text && m_mode!="MSK144" && t.mid(0,1)!="<") { tx->setText(t.toUpper());
len=qMin(len,13);
tx->setText(t.mid(0,len).toUpper());
} else {
tx->setText(t);
}
tx->setCursorPosition (pos); tx->setCursorPosition (pos);
} }