Add "gridOK()" functiion, used for PSKreporter and double-clock on call.

Double-click on decoded line copies valid grid to dxGrid box.
Add button workd with an empty call3.txt file.
QSO start/stop times rationalized (somewhat).


git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3056 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2013-03-19 13:18:23 +00:00
parent c1dab73dfd
commit 3dd94595c3
2 changed files with 41 additions and 30 deletions

View File

@ -1064,16 +1064,7 @@ void MainWindow::readFromStdout() //readFromStdout
QString g2=c2.mid(i2+1,4);
c2=c2.mid(0,i2);
QString remote="call," + c2 + ",";
if(g2.mid(0,1).compare("A")>=0 and
g2.mid(0,1).compare("R")<=0 and
g2.mid(1,1).compare("A")>=0 and
g2.mid(1,1).compare("R")<=0 and
g2.mid(2,1).compare("0")>=0 and
g2.mid(2,1).compare("9")<=0 and
g2.mid(3,1).compare("0")>=0 and
g2.mid(3,1).compare("9")<=0) {
remote += "gridsquare," + g2 + ",";
}
if(gridOK(g2)) remote += "gridsquare," + g2 + ",";
int nHz=t.mid(22,4).toInt();
uint nfreq=1000000.0*g_pWideGraph->dialFreq() + nHz + 0.5;
remote += "freq," + QString::number(nfreq);
@ -1090,9 +1081,6 @@ void MainWindow::readFromStdout() //readFromStdout
wchar_t tlocal[256];
local.toWCharArray(tlocal);
// qDebug() << "A:" << QString::fromWCharArray(tlocal,local.length());
// qDebug() << "B:" << QString::fromWCharArray(tremote,remote.length());
int flags=REPORTER_SOURCE_AUTOMATIC;
rc=ReporterSeenCallsign(tremote,tlocal,flags);
if(rc!=0) {
@ -1427,7 +1415,11 @@ void MainWindow::doubleClickOnCall(bool shift, bool ctrl)
g_pWideGraph->setQSOfreq(nfreq);
}
QString hiscall=t4.at(7);
QString hisgrid="";
if(t4.length()>=9) hisgrid=t4.at(8);
ui->dxCallEntry->setText(hiscall);
lookup();
if(ui->dxGridEntry->text()=="" and gridOK(hisgrid)) ui->dxGridEntry->setText(hisgrid);
int n = 60*t2.mid(0,2).toInt() + t2.mid(2,2).toInt();
int nmod=n%(m_TRperiod/30);
m_txFirst=(nmod!=0);
@ -1438,13 +1430,6 @@ void MainWindow::doubleClickOnCall(bool shift, bool ctrl)
if(rpt.indexOf(" ")==0) rpt="+" + rpt.mid(1,2);
if(rpt.toInt()<-50) rpt="-50";
if(rpt.toInt()>49) rpt="+49";
if(ctrl) {
int i4=t.mid(i2,20).indexOf(" ");
QString hisgrid=t.mid(i2,20).mid(i4+1,4);
ui->dxGridEntry->setText(hisgrid);
} else {
lookup();
}
genStdMsgs(rpt);
if(t2.indexOf(m_myCall)>0) {
m_ntx=2;
@ -1551,6 +1536,14 @@ void MainWindow::on_addButton_clicked() //Add button
msgBox("Cannot open " + call3File);
return;
}
if(f1.size()==0) {
f1.close();
f1.open(QIODevice::WriteOnly | QIODevice::Text);
QTextStream out(&f1);
out << "ZZZZZZ" << endl;
f1.close();
f1.open(QIODevice::ReadOnly | QIODevice::Text);
}
QString tmpFile = m_appDir + "/CALL3.TMP";
QFile f2(tmpFile);
if(!f2.open(QIODevice::WriteOnly | QIODevice::Text)) {
@ -1731,17 +1724,20 @@ void MainWindow::on_logQSOButton_clicked() //Log QSO button
QTextStream out(&f2);
if(f2.size()==0) out << "WSJT-X ADIF Export<eoh>" << endl;
if(m_qsoStop=="") m_qsoStop=m_qsoStart;
if(m_qsoStart=="") m_qsoStart=m_qsoStop;
QString t;
t="<call:" + QString::number(m_hisCall.length()) + ">" + m_hisCall;
t+= "<gridsquare:" + QString::number(m_hisGrid.length()) + ">" + m_hisGrid;
t+= "<mode:" + QString::number(m_mode.length()) + ">" + m_mode;
t+= "<rst_sent:" + QString::number(m_rptSent.length()) + ">" + m_rptSent;
t+= "<rst_rcvd:" + QString::number(m_rptRcvd.length()) + ">" + m_rptRcvd;
t+= "<qso_date:0>";
t+= "<time_on:4>" + m_qsoStart;
t+= "<time_off:4>" + m_qsoStop;
t+= "<station_callsign:" + QString::number(m_myCall.length()) + ">" + m_myCall;
t+= "<my_gridsquare:" + QString::number(m_myGrid.length()) + ">" + m_myGrid;
t+=" <gridsquare:" + QString::number(m_hisGrid.length()) + ">" + m_hisGrid;
t+=" <mode:" + QString::number(m_mode.length()) + ">" + m_mode;
t+=" <rst_sent:" + QString::number(m_rptSent.length()) + ">" + m_rptSent;
t+=" <rst_rcvd:" + QString::number(m_rptRcvd.length()) + ">" + m_rptRcvd;
t+=" <qso_date:8>" + date;
t+=" <time_on:4>" + m_qsoStart;
t+=" <time_off:4>" + m_qsoStop;
t+=" <station_callsign:" + QString::number(m_myCall.length()) + ">" + m_myCall;
t+=" <my_gridsquare:" + QString::number(m_myGrid.length()) + ">" + m_myGrid;
out << t << endl;
f2.close();
}
@ -1911,7 +1907,7 @@ void MainWindow::showMacros(const QPoint &pos)
popupMenu.addAction(popup2);
connect(popup1,SIGNAL(triggered()), this, SLOT(onPopup1()));
connect(popup2,SIGNAL(triggered()), this, SLOT(onPopup2()));
QAction* selectedItem = popupMenu.exec(globalPos);
popupMenu.exec(globalPos);
}
void MainWindow::onPopup1()
@ -1923,3 +1919,16 @@ void MainWindow::onPopup2()
{
ui->tx5->setText("TNX 73 GL");
}
bool MainWindow::gridOK(QString g)
{
bool b=g.mid(0,1).compare("A")>=0 and
g.mid(0,1).compare("R")<=0 and
g.mid(1,1).compare("A")>=0 and
g.mid(1,1).compare("R")<=0 and
g.mid(2,1).compare("0")>=0 and
g.mid(2,1).compare("9")<=0 and
g.mid(3,1).compare("0")>=0 and
g.mid(3,1).compare("9")<=0;
return b;
}

View File

@ -230,6 +230,8 @@ private slots:
void msgtype(QString t, QLineEdit* tx);
void stub();
void statusChanged();
bool gridOK(QString g);
};
extern void getfile(QString fname, int ntrperiod);