1. Decoded text should now remain left justified even if the font is too large for the window

2. The main window can be expanded wider to allow those with large screens to use larger fonts
3. New class DecodedText handles the formatted text from decoder.f90.


git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3564 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Murray Curtis 2013-08-25 01:48:45 +00:00
parent 0a67803476
commit 13dba2b1ba
10 changed files with 426 additions and 155 deletions

View File

@ -35,6 +35,7 @@ set (CXXSRCS
Detector.cpp
logqso.cpp
displaytext.cpp
decodedtext.cpp
getfile.cpp
soundout.cpp
soundin.cpp

145
decodedtext.cpp Normal file
View File

@ -0,0 +1,145 @@
#include <QStringList>
#include <QDebug>
#include "decodedtext.h"
QString DecodedText::CQersCall()
{
// extract the CQer's call TODO: does this work with all call formats? What about 'CQ DX'?
int s1 = 4 + _string.indexOf(" CQ ");
int s2 = _string.indexOf(" ",s1);
QString call = _string.mid(s1,s2-s1);
return call;
}
bool DecodedText::isJT65()
{
return _string.indexOf("#") == column_mode;
}
bool DecodedText::isJT9()
{
return _string.indexOf("@") == column_mode;
}
bool DecodedText::isTX()
{
int i = _string.indexOf("Tx");
return (i >= 0 && i < 15); // TODO guessing those numbers. Does Tx ever move?
}
int DecodedText::frequencyOffset()
{
return _string.mid(column_freq,4).toInt();
}
int DecodedText::snr()
{
return _string.mid(column_snr,3).toInt();
}
/*
2343 -11 0.8 1259 # YV6BFE F6GUU R-08
2343 -19 0.3 718 # VE6WQ SQ2NIJ -14
2343 -7 0.3 815 # KK4DSD W7VP -16
2343 -13 0.1 3627 @ CT1FBK IK5YZT R+02
0605 Tx 1259 # CQ VK3ACF QF22
*/
// find and extract any report. Returns true if this is a standard message
bool DecodedText::report(const QString myCall, /*mod*/QString& report)
{
QString msg=_string.mid(column_qsoText);
int i1=msg.indexOf("\r");
if (i1>0)
msg=msg.mid(0,i1-1) + " ";
bool b = stdmsg_(msg.mid(0,22).toLatin1().constData(),22); // stdmsg is a fortran routine that packs the text, unpacks it and compares the result
QStringList w=msg.split(" ",QString::SkipEmptyParts);
if(b and w[0]==myCall)
{
QString tt="";
if(w.length()>=3) tt=w[2];
bool ok;
i1=tt.toInt(&ok);
if (ok and i1>=-50 and i1<50)
{
report = tt;
// qDebug() << "report for " << _string << "::" << report;
}
else
{
if (tt.mid(0,1)=="R")
{
i1=tt.mid(1).toInt(&ok);
if(ok and i1>=-50 and i1<50)
{
report = tt.mid(1);
// qDebug() << "report for " << _string << "::" << report;
}
}
}
}
return b;
}
// get the first text word, usually the call
QString DecodedText::call()
{
QString call = _string.mid(column_qsoText);
int i = call.indexOf(" ");
call = call.mid(0,i);
return call;
}
// get the second word, most likely the de call and the third word, most likely grid
void DecodedText::deCallAndGrid(/*out*/QString& call, QString& grid)
{
QString msg=_string.mid(column_qsoText);
int i1 = msg.indexOf(" ");
call = msg.mid(i1+1);
int i2 = call.indexOf(" ");
grid = call.mid(i2+1,4);
call = call.mid(0,i2);
}
int DecodedText::timeInSeconds()
{
return 60*_string.mid(column_time,2).toInt() + _string.mid(2,2).toInt();
}
/*
2343 -11 0.8 1259 # YV6BFE F6GUU R-08
2343 -19 0.3 718 # VE6WQ SQ2NIJ -14
2343 -7 0.3 815 # KK4DSD W7VP -16
2343 -13 0.1 3627 @ CT1FBK IK5YZT R+02
0605 Tx 1259 # CQ VK3ACF QF22
*/
QString DecodedText::report() // returns a string of the SNR field with a leading + or - followed by two digits
{
int sr = snr();
if (sr<-50)
sr = -50;
else
if (sr > 49)
sr = 49;
QString rpt;
rpt.sprintf("%d",abs(sr));
if (sr > 9)
rpt = "+" + rpt;
else
if (sr >= 0)
rpt = "+0" + rpt;
else
if (sr >= -9)
rpt = "-0" + rpt;
else
rpt = "-" + rpt;
return rpt;
}

90
decodedtext.h Normal file
View File

@ -0,0 +1,90 @@
/*
* Class to handle the formatted string as returned from the fortran decoder
*
* VK3ACF August 2013
*/
#ifndef DECODEDTEXT_H
#define DECODEDTEXT_H
#include <QString>
/*
0123456789012345678901234567890123456789
^ ^ ^ ^ ^ ^
2343 -11 0.8 1259 # YV6BFE F6GUU R-08
2343 -19 0.3 718 # VE6WQ SQ2NIJ -14
2343 -7 0.3 815 # KK4DSD W7VP -16
2343 -13 0.1 3627 @ CT1FBK IK5YZT R+02
0605 Tx 1259 # CQ VK3ACF QF22
*/
class DecodedText
{
public:
// These define the columns in the decoded text where fields are to be found.
// We rely on these columns being the same in the fortran code (lib/decode.f90) that formats the decoded text
enum Columns { column_time = 0,
column_snr = 5,
column_freq = 14,
column_mode = 19,
column_qsoText = 21 };
void operator=(const QString &rhs)
{
_string = rhs;
};
void operator=(const QByteArray &rhs)
{
_string = rhs;
};
void operator+=(const QString &rhs)
{
_string += rhs;
};
QString string() { return _string; };
int indexOf(QString s) { return _string.indexOf(s); };
int indexOf(QString s, int i) { return _string.indexOf(s,i); };
QString mid(int f, int t) { return _string.mid(f,t); };
QString left(int i) { return _string.left(i); };
void clear() { _string.clear(); };
QString CQersCall();
bool isJT65();
bool isJT9();
bool isTX();
int frequencyOffset(); // hertz offset from the tuned dial or rx frequency, aka audio frequency
int snr();
// find and extract any report. Returns true if this is a standard message
bool report(const QString myCall, /*mod*/QString& report);
// get the first text word, usually the call
QString call();
// get the second word, most likely the de call and the third word, most likely grid
void deCallAndGrid(/*out*/QString& call, QString& grid);
int timeInSeconds();
// returns a string of the SNR field with a leading + or - followed by two digits
QString report();
private:
QString _string;
};
extern "C" { bool stdmsg_(const char* msg, int len); }
#endif // DECODEDTEXT_H

View File

@ -1,7 +1,7 @@
#include "displaytext.h"
#include <QDebug>
#include <QMouseEvent>
#include <QDateTime>
DisplayText::DisplayText(QWidget *parent) :
QTextBrowser(parent)
@ -37,27 +37,33 @@ void DisplayText::resizeEvent(QResizeEvent * event)
void DisplayText::insertLineSpacer()
{
QTextCursor cursor;
QTextBlockFormat bf;
QString bg="#d3d3d3";
bf.setBackground(QBrush(QColor(bg)));
QString tt="----------------------------------------";
QString bg="#d3d3d3";
_insertText(tt,bg);
}
void DisplayText::_insertText(const QString text, const QString bg)
{
QString tt = text.mid(0,_maxDisplayedCharacters); //truncate to max display chars
QString s = "<table border=0 cellspacing=0 width=100%><tr><td bgcolor=\"" +
bg + "\"><pre>" + tt + "</pre></td></tr></table>";
cursor = this->textCursor();
bg + "\"><pre>" + tt + "</pre></td></tr></table>";
QTextCursor cursor = textCursor();
cursor.movePosition(QTextCursor::End);
bf = cursor.blockFormat();
QTextBlockFormat bf = cursor.blockFormat();
bf.setBackground(QBrush(QColor(bg)));
cursor.insertHtml(s);
this->setTextCursor(cursor);
}
void DisplayText::_appendDXCCWorkedB4(/*mod*/QString& t1, QString& bg, /*uses*/LogBook logBook)
void DisplayText::_appendDXCCWorkedB4(/*mod*/DecodedText& t1, QString& bg, /*uses*/LogBook logBook)
{
// extract the CQer's call TODO: does this work with all call formats? What about 'CQ DX'?
int s1 = 4 + t1.indexOf(" CQ ");
int s2 = t1.indexOf(" ",s1);
QString call = t1.mid(s1,s2-s1);
QString countryName;
bool callWorkedBefore;
bool countryWorkedBefore;
@ -94,7 +100,7 @@ void DisplayText::_appendDXCCWorkedB4(/*mod*/QString& t1, QString& bg, /*uses*/L
}
}
void DisplayText::displayDecodedText(QString decodedText, QString myCall, bool displayDXCCEntity, LogBook logBook)
void DisplayText::displayDecodedText(DecodedText decodedText, QString myCall, bool displayDXCCEntity, LogBook logBook)
{
QString bg="white";
bool CQcall = false;
@ -110,14 +116,19 @@ void DisplayText::displayDecodedText(QString decodedText, QString myCall, bool d
if (displayDXCCEntity && CQcall)
_appendDXCCWorkedB4(/*mod*/decodedText,bg,logBook);
QString s = "<table border=0 cellspacing=0 width=100%><tr><td bgcolor=\"" +
bg + "\"><pre>" + decodedText + "</pre></td></tr></table>";
QTextCursor cursor = textCursor();
cursor.movePosition(QTextCursor::End);
QTextBlockFormat bf = cursor.blockFormat();
bf.setBackground(QBrush(QColor(bg)));
cursor.insertHtml(s);
this->setTextCursor(cursor);
_insertText(decodedText.string(),bg);
}
void DisplayText::displayTransmittedText(QString text, QString modeTx, qint32 txFreq)
{
QString bg="yellow";
QString t1=" @ ";
if(modeTx=="JT65") t1=" # ";
QString t2;
t2.sprintf("%4d",txFreq);
QString t = QDateTime::currentDateTimeUtc().toString("hhmm") + \
" Tx " + t2 + t1 + text; // The position of the 'Tx' is searched for in DecodedText and in MainWindow. Not sure if thats required anymore? VK3ACF
_insertText(t,bg);
}

View File

@ -3,6 +3,8 @@
#include <QTextBrowser>
#include "logbook/logbook.h"
#include "decodedtext.h"
class DisplayText : public QTextBrowser
{
@ -13,7 +15,8 @@ public:
void setFont(QFont font);
void insertLineSpacer();
void displayDecodedText(QString decodedText, QString myCall, bool displayDXCCEntity, LogBook logBook);
void displayDecodedText(DecodedText decodedText, QString myCall, bool displayDXCCEntity, LogBook logBook);
void displayTransmittedText(QString text, QString modeTx, qint32 txFreq);
signals:
void selectCallsign(bool shift, bool ctrl);
@ -28,7 +31,8 @@ protected:
private:
int _fontWidth;
int _maxDisplayedCharacters;
void _appendDXCCWorkedB4(/*mod*/QString& t1, QString &bg, LogBook logBook);
void _insertText(const QString text, const QString bg);
void _appendDXCCWorkedB4(/*mod*/DecodedText& t1, QString &bg, LogBook logBook);
};

View File

@ -72,7 +72,7 @@ void LogBook::match(/*in*/const QString call,
void LogBook::addAsWorked(const QString call)
{
qDebug() << "adding " << call << " as worked";
//qDebug() << "adding " << call << " as worked";
_log.add(call);
QString countryName = _countries.find(call);
if (countryName.length() > 0)

View File

@ -14,6 +14,8 @@
#include "getfile.h"
#include "logqso.h"
#ifdef QT5
#include <QtConcurrent/QtConcurrentRun>
#endif
@ -268,7 +270,7 @@ MainWindow::MainWindow(QSettings * settings, QSharedMemory *shdmem, QString *the
m_dontReadFreq=false;
m_lockTxFreq=false;
ui->readFreq->setEnabled(false);
m_QSOmsg="";
m_QSOText.clear();
m_CATerror=false;
decodeBusy(false);
@ -1390,9 +1392,11 @@ void MainWindow::readFromStderr() //readFromStderr
void MainWindow::readFromStdout() //readFromStdout
{
while(proc_jt9.canReadLine()) {
while(proc_jt9.canReadLine())
{
QByteArray t=proc_jt9.readLine();
if(t.indexOf("<DecodeFinished>") >= 0) {
if(t.indexOf("<DecodeFinished>") >= 0)
{
m_bdecoded = (t.mid(23,1).toInt()==1);
bool keepFile=m_saveAll or (m_saveDecoded and m_bdecoded);
if(!keepFile and !m_diskData) killFileTimer->start(45*1000); //Kill in 45 s
@ -1426,75 +1430,46 @@ void MainWindow::readFromStdout() //readFromStdout
m_blankLine=false;
}
QString t1=t.replace("\n","").mid(0,t.length()-4);
DecodedText decodedtext;
decodedtext = t.replace("\n",""); //t.replace("\n","").mid(0,t.length()-4);
// the left band display
ui->decodedTextBrowser->displayDecodedText(t1,m_myCall,m_displayDXCCEntity,m_logBook);
ui->decodedTextBrowser->displayDecodedText(decodedtext,m_myCall,m_displayDXCCEntity,m_logBook);
if (abs(t1.mid(14,4).toInt() - m_wideGraph->rxFreq()) <= 10) // this msg is within 10 hertz of our tuned frequency
if (abs(decodedtext.frequencyOffset() - m_wideGraph->rxFreq()) <= 10) // this msg is within 10 hertz of our tuned frequency
{
// the right QSO window
ui->decodedTextBrowser2->displayDecodedText(t1,m_myCall,false,m_logBook);
ui->decodedTextBrowser2->displayDecodedText(decodedtext,m_myCall,false,m_logBook);
bool b65=t1.indexOf("#")==19;
bool b65=decodedtext.isJT65();
if(b65 and m_modeTx!="JT65") on_pbTxMode_clicked();
if(!b65 and m_modeTx=="JT65") on_pbTxMode_clicked();
m_QSOmsg=t1;
m_QSOText=decodedtext;
}
// find and extract any report
QString msg=t.mid(21);
int i1=msg.indexOf("\r");
if(i1>0) msg=msg.mid(0,i1-1) + " ";
bool b=stdmsg_(msg.mid(0,22).toLatin1().constData(),22);
QStringList w=msg.split(" ",QString::SkipEmptyParts);
if(b and w[0]==m_myCall) {
QString tt="";
if(w.length()>=3) tt=w[2];
bool ok;
i1=tt.toInt(&ok);
if(ok and i1>=-50 and i1<50) {
m_rptRcvd=tt;
} else {
if(tt.mid(0,1)=="R") {
i1=tt.mid(1).toInt(&ok);
if(ok and i1>=-50 and i1<50) {
m_rptRcvd=tt.mid(1);
}
}
}
}
// find and extract any report for myCall
bool stdMsg = decodedtext.report(m_myCall,/*mod*/m_rptRcvd);
// extract details and send to PSKreporter
int nsec=QDateTime::currentMSecsSinceEpoch()/1000-m_secBandChanged;
bool okToPost=(nsec>50);
QString msgmode="JT9";
bool b65=t1.indexOf("#")==19;
if(b65) msgmode="JT65";
i1=msg.indexOf(" ");
QString c2=msg.mid(i1+1);
int i2=c2.indexOf(" ");
QString g2=c2.mid(i2+1,4);
c2=c2.mid(0,i2);
QString remote="call," + c2 + ",";
if(gridOK(g2)) remote += "gridsquare," + g2 + ",";
int nHz=t.mid(14,4).toInt();
uint nfreq=1000000.0*m_dialFreq + nHz + 0.5;
remote += "freq," + QString::number(nfreq);
int nsnr=t.mid(5,3).toInt();
remote += ",mode," + msgmode + ",snr," + QString::number(nsnr) + ",,";
wchar_t tremote[256];
remote.toWCharArray(tremote);
if(m_pskReporter and stdMsg and !m_diskData and okToPost)
{
QString msgmode="JT9";
if (decodedtext.isJT65())
msgmode="JT65";
if(m_pskReporter and b and !m_diskData and okToPost) {
psk_Reporter->setLocalStation(m_myCall, m_myGrid, m_antDescription[m_band], "WSJT-X r" + rev.mid(6,4) );
QString freq = QString::number(nfreq);
QString snr= QString::number(nsnr);
if(gridOK(g2)) {
psk_Reporter->addRemoteStation(c2,g2,freq,msgmode,snr,
QString::number(QDateTime::currentDateTime().toTime_t()));
}
QString deCall;
QString grid;
decodedtext.deCallAndGrid(/*out*/deCall,grid);
int audioFrequency = decodedtext.frequencyOffset();
int snr = decodedtext.snr();
uint frequency = 1000000.0*m_dialFreq + audioFrequency + 0.5;
psk_Reporter->setLocalStation(m_myCall, m_myGrid, m_antDescription[m_band], "WSJT-X r" + rev.mid(6,4) );
if(gridOK(grid))
psk_Reporter->addRemoteStation(deCall,grid,QString::number(frequency),msgmode,QString::number(snr),
QString::number(QDateTime::currentDateTime().toTime_t()));
}
}
}
@ -1513,7 +1488,7 @@ void MainWindow::on_EraseButton_clicked() //Erase
{
qint64 ms=QDateTime::currentMSecsSinceEpoch();
ui->decodedTextBrowser2->clear();
m_QSOmsg="";
m_QSOText.clear();
if((ms-m_msErase)<500) {
ui->decodedTextBrowser->clear();
QFile f(m_appDir + "/decoded.txt");
@ -1640,7 +1615,8 @@ void MainWindow::guiUpdate()
<< " Transmitting " << m_dialFreq << " MHz " << m_modeTx
<< ": " << t << endl;
f.close();
if(m_tx2QSO) displayTxMsg(t);
if(m_tx2QSO)
ui->decodedTextBrowser2->displayTransmittedText(t,m_modeTx,m_txFreq);
}
QStringList w=t.split(" ",QString::SkipEmptyParts);
@ -1717,7 +1693,8 @@ void MainWindow::guiUpdate()
<< ": " << t << endl;
f.close();
}
if(m_tx2QSO and !m_tune) displayTxMsg(t);
if(m_tx2QSO and !m_tune)
ui->decodedTextBrowser2->displayTransmittedText(t,m_modeTx,m_txFreq);
}
if(!m_btxok && btxok0 && g_iptt==1) stopTx();
@ -1801,26 +1778,6 @@ void MainWindow::guiUpdate()
btxok0=m_btxok;
} //End of GUIupdate
void MainWindow::displayTxMsg(QString t)
{
QString bg="yellow";
QTextBlockFormat bf;
QTextCursor cursor;
QString t1=" @ ";
if(m_modeTx=="JT65") t1=" # ";
QString t2;
t2.sprintf("%4d",m_txFreq);
t=QDateTime::currentDateTimeUtc().toString("hhmm") + \
" Tx " + t2 + t1 + t;
QString s = "<table border=0 cellspacing=0 width=100%><tr><td bgcolor=\"" +
bg + "\"><pre>" + t + "</pre></td></tr></table>";
cursor = ui->decodedTextBrowser2->textCursor();
cursor.movePosition(QTextCursor::End);
bf = cursor.blockFormat();
bf.setBackground(QBrush(QColor(bg)));
cursor.insertHtml(s);
ui->decodedTextBrowser2->setTextCursor(cursor);
}
void MainWindow::startTx2()
{
@ -1966,12 +1923,13 @@ void MainWindow::doubleClickOnCall(bool shift, bool ctrl)
QString t1 = t.mid(0,i2); //contents up to \n on selected line
int i1=t1.lastIndexOf("\n") + 1; //points to first char of line
QString t2 = t1.mid(i1,i2-i1); //selected line
DecodedText decodedtext;
decodedtext = t1.mid(i1,i2-i1); //selected line
if (t2.indexOf(" CQ ") > 0)
t2 = t2.left(36); // to remove DXCC entity and worked B4 status. TODO need a better way to do this
if (decodedtext.indexOf(" CQ ") > 0)
decodedtext = decodedtext.left(36); // to remove DXCC entity and worked B4 status. TODO need a better way to do this
// if(t2.indexOf("Tx")==6) return; //Ignore Tx line
// if(decodedtext.indexOf("Tx")==6) return; //Ignore Tx line
int i4=t.mid(i1).length();
if(i4>55) i4=55;
QString t3=t.mid(i1,i4);
@ -1980,46 +1938,74 @@ void MainWindow::doubleClickOnCall(bool shift, bool ctrl)
QStringList t4=t3.split(" ",QString::SkipEmptyParts);
if(t4.length() <5) return; //Skip the rest if no decoded text
int i9=m_QSOmsg.indexOf(t2);
if(i9<0 and t2.indexOf("Tx")==-1) {
QString bg="white";
if(t2.indexOf(" CQ ")>0) bg="#66ff66"; //green
if(m_myCall!="" and t2.indexOf(" "+m_myCall+" ")>0) bg="#ff6666"; //red
QTextBlockFormat bf;
QString s = "<table border=0 cellspacing=0 width=100%><tr><td bgcolor=\"" +
bg + "\"><pre>" + t2 + "</pre></td></tr></table>";
cursor = ui->decodedTextBrowser2->textCursor();
cursor.movePosition(QTextCursor::End);
bf = cursor.blockFormat();
bf.setBackground(QBrush(QColor(bg)));
cursor.insertHtml(s);
ui->decodedTextBrowser2->setTextCursor(cursor);
m_QSOmsg=t2;
int i9=m_QSOText.indexOf(decodedtext.string());
if (i9<0 and !decodedtext.isTX())
{
ui->decodedTextBrowser2->displayDecodedText(decodedtext,m_myCall,false,m_logBook);
m_QSOText=decodedtext;
}
int nfreq=t4.at(3).toInt();
if(t4.at(1)=="Tx") nfreq=t4.at(2).toInt();
m_wideGraph->setRxFreq(nfreq); //Set Rx freq
if(t4.at(1)=="Tx") {
if(ctrl) ui->TxFreqSpinBox->setValue(nfreq); //Set Tx freq
/*
int nfreq=t4.at(3).toInt();
if(t4.at(1)=="Tx") nfreq=t4.at(2).toInt();
m_wideGraph->setRxFreq(nfreq); //Set Rx freq
if(t4.at(1)=="Tx") {
if(ctrl) ui->TxFreqSpinBox->setValue(nfreq); //Set Tx freq
return;
}
*/
int frequency = decodedtext.frequencyOffset();
m_wideGraph->setRxFreq(frequency); //Set Rx freq
if (decodedtext.isTX())
{
if (ctrl)
ui->TxFreqSpinBox->setValue(frequency); //Set Tx freq
return;
}
if(t4.at(4)=="@") {
/*
QString firstcall=t4.at(5);
// Don't change Tx freq if a station is calling me, unless m_lockTxFreq
// is true or CTRL is held down or
if((firstcall!=m_myCall) or m_lockTxFreq or ctrl) {
ui->TxFreqSpinBox->setValue(nfreq);
}
*/
QString firstcall = decodedtext.call();
// Don't change Tx freq if a station is calling me, unless m_lockTxFreq
// is true or CTRL is held down
if ((firstcall!=m_myCall) or m_lockTxFreq or ctrl)
ui->TxFreqSpinBox->setValue(frequency);
/*
if(t4.at(4)=="@") {
m_modeTx="JT9";
ui->pbTxMode->setText("Tx JT9 @");
m_wideGraph->setModeTx(m_modeTx);
}
if(t4.at(4)=="#") {
m_modeTx="JT65";
ui->pbTxMode->setText("Tx JT65 #");
m_wideGraph->setModeTx(m_modeTx);
}
*/
if (decodedtext.isJT9())
{
m_modeTx="JT9";
ui->pbTxMode->setText("Tx JT9 @");
m_wideGraph->setModeTx(m_modeTx);
}
if(t4.at(4)=="#") {
m_modeTx="JT65";
ui->pbTxMode->setText("Tx JT65 #");
m_wideGraph->setModeTx(m_modeTx);
}
QString firstcall=t4.at(5);
// Don't change Tx freq if a station is calling me, unless m_lockTxFreq
// is true or CTRL is held down or
if((firstcall!=m_myCall) or m_lockTxFreq or ctrl) {
ui->TxFreqSpinBox->setValue(nfreq);
}
else
if (decodedtext.isJT65())
{
m_modeTx="JT65";
ui->pbTxMode->setText("Tx JT65 #");
m_wideGraph->setModeTx(m_modeTx);
}
/*
QString hiscall=t4.at(6);
QString hisgrid="";
if(t4.length()>=8) hisgrid=t4.at(7);
@ -2028,10 +2014,32 @@ void MainWindow::doubleClickOnCall(bool shift, bool ctrl)
if(gridOK(hisgrid)) ui->dxGridEntry->setText(hisgrid);
if(ui->dxGridEntry->text()=="") lookup();
m_hisGrid=ui->dxGridEntry->text();
int n = 60*t2.mid(0,2).toInt() + t2.mid(2,2).toInt();
*/
QString hiscall;
QString hisgrid;
decodedtext.deCallAndGrid(/*out*/hiscall,hisgrid);
if (hiscall != ui->dxCallEntry->text())
ui->dxGridEntry->setText("");
ui->dxCallEntry->setText(hiscall);
if (gridOK(hisgrid))
ui->dxGridEntry->setText(hisgrid);
if (ui->dxGridEntry->text()=="")
lookup();
m_hisGrid = ui->dxGridEntry->text();
/*
int n = 60*decodedtext.mid(0,2).toInt() + decodedtext.mid(2,2).toInt();
int nmod=n%(m_TRperiod/30);
m_txFirst=(nmod!=0);
ui->txFirstCheckBox->setChecked(m_txFirst);
*/
int n = decodedtext.timeInSeconds();
int nmod=n%(m_TRperiod/30);
m_txFirst=(nmod!=0);
ui->txFirstCheckBox->setChecked(m_txFirst);
/*
QString rpt=t4.at(1);
if(rpt.indexOf(" ")==0) rpt="+" + rpt.mid(2,2);
if(rpt.indexOf(" -")==0) rpt=rpt.mid(1,2);
@ -2042,10 +2050,17 @@ void MainWindow::doubleClickOnCall(bool shift, bool ctrl)
if(nr>=-9 and nr<=-1) rpt="-0" + rpt.mid(1);
if(nr>=0 and nr<=9) rpt="+0" + rpt;
if(nr>=10) rpt="+" + rpt;
*/
QString rpt = decodedtext.report();
ui->rptSpinBox->setValue(rpt.toInt());
genStdMsgs(rpt);
if(t2.indexOf(m_myCall)>=0) {
if(t4.length()>=7 and !gridOK(t4.at(7))) {
// determine the appropriate response to the received msg
if(decodedtext.indexOf(m_myCall)>=0)
{
if (t4.length()>=7 // enough fields for a normal msg
and !gridOK(t4.at(7))) // but no grid on end of msg
{
QString r=t4.at(7);
if(r.mid(0,3)=="RRR") {
m_ntx=5;
@ -2090,7 +2105,9 @@ void MainWindow::doubleClickOnCall(bool shift, bool ctrl)
}
}
} else {
}
else // myCall not in msg
{
m_ntx=1;
ui->txrb1->setChecked(true);
if(ui->tabWidget->currentIndex()==1) {

View File

@ -21,6 +21,8 @@
#include "logbook/logbook.h"
#include "Detector.hpp"
#include "Modulator.hpp"
#include "decodedtext.h"
#define NUM_JT65_SYMBOLS 126
#define NUM_JT9_SYMBOLS 85
@ -372,7 +374,6 @@ private:
QString m_cmnd;
QString m_msgSent0;
QString m_fileToSave;
QString m_QSOmsg;
QStringList m_macro;
QStringList m_dFreq; // per band frequency in MHz as a string
@ -387,6 +388,7 @@ private:
PSK_Reporter *psk_Reporter;
SignalMeter *signalMeter;
LogBook m_logBook;
DecodedText m_QSOText;
//---------------------------------------------------- private functions
@ -403,7 +405,6 @@ private:
void statusChanged();
void dialFreqChanged2(double f);
void freeText();
void displayTxMsg(QString t);
void rigOpen();
void pollRigFreq();
bool gridOK(QString g);

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>760</width>
<height>523</height>
<width>780</width>
<height>491</height>
</rect>
</property>
<property name="sizePolicy">
@ -24,7 +24,7 @@
</property>
<property name="maximumSize">
<size>
<width>936</width>
<width>1280</width>
<height>1028</height>
</size>
</property>
@ -60,7 +60,7 @@
</property>
<property name="maximumSize">
<size>
<width>500</width>
<width>600</width>
<height>1000</height>
</size>
</property>
@ -104,7 +104,7 @@ p, li { white-space: pre-wrap; }
</property>
<property name="maximumSize">
<size>
<width>500</width>
<width>600</width>
<height>20</height>
</size>
</property>
@ -193,7 +193,7 @@ p, li { white-space: pre-wrap; }
</property>
<property name="maximumSize">
<size>
<width>500</width>
<width>600</width>
<height>20</height>
</size>
</property>
@ -288,7 +288,7 @@ p, li { white-space: pre-wrap; }
</property>
<property name="maximumSize">
<size>
<width>500</width>
<width>600</width>
<height>1000</height>
</size>
</property>
@ -2278,8 +2278,8 @@ p, li { white-space: pre-wrap; }
<rect>
<x>0</x>
<y>0</y>
<width>760</width>
<height>21</height>
<width>780</width>
<height>20</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">

View File

@ -58,7 +58,8 @@ SOURCES += \
devsetup.cpp \
about.cpp \
mainwindow.cpp \
main.cpp
main.cpp \
decodedtext.cpp
win32 {
SOURCES += killbyname.cpp
@ -75,6 +76,7 @@ HEADERS += mainwindow.h plotter.h soundin.h soundout.h \
logbook/countriesworked.h \
logbook/adif.h
FORMS += mainwindow.ui about.ui devsetup.ui widegraph.ui \
logqso.ui