From 354cebbb5e72dd60ffe4646c9ce94c7feeba5920 Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Sat, 5 Nov 2016 19:41:03 +0000 Subject: [PATCH] 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 --- decodedtext.cpp | 9 +++++---- mainwindow.cpp | 13 ++----------- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/decodedtext.cpp b/decodedtext.cpp index d453886d9..342977286 100644 --- a/decodedtext.cpp +++ b/decodedtext.cpp @@ -1,7 +1,8 @@ -#include -#include #include "decodedtext.h" +#include +#include + QString DecodedText::CQersCall() { // 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() { 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(" "); return call.mid(0,i); } @@ -132,7 +133,7 @@ QString DecodedText::call() void DecodedText::deCallAndGrid(/*out*/QString& call, QString& grid) { 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(" "); call = msg.mid(i1+1); int i2 = call.indexOf(" "); diff --git a/mainwindow.cpp b/mainwindow.cpp index c5fa8e3ce..2dabc4594 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -3278,7 +3278,7 @@ void MainWindow::processMessage(QString const& messages, int position, bool ctrl } 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 int frequency = decodedtext.frequencyOffset(); @@ -3794,9 +3794,6 @@ void MainWindow::msgtype(QString t, QLineEdit* tx) //msgtype() 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(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()); if(text) { p.setColor(QPalette::Base,"#ffccff"); @@ -3811,14 +3808,8 @@ void MainWindow::msgtype(QString t, QLineEdit* tx) //msgtype() } } tx->setPalette(p); - int len=t.length(); auto pos = tx->cursorPosition (); - if(text && m_mode!="MSK144" && t.mid(0,1)!="<") { - len=qMin(len,13); - tx->setText(t.mid(0,len).toUpper()); - } else { - tx->setText(t); - } + tx->setText(t.toUpper()); tx->setCursorPosition (pos); }