mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-20 02:52:00 -05:00
Cleaning up the "Log QSO" function. (Not finished, yet...)
git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3342 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
5ca4e1153f
commit
593e05337d
79
logqso.cpp
79
logqso.cpp
@ -5,22 +5,21 @@
|
|||||||
|
|
||||||
|
|
||||||
LogQSO::LogQSO(QWidget *parent) :
|
LogQSO::LogQSO(QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::LogQSO)
|
ui(new Ui::LogQSO)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
LogQSO::~LogQSO()
|
LogQSO::~LogQSO()
|
||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LogQSO::initLogQSO(QString hisCall, QString hisGrid, QString mode,
|
void LogQSO::initLogQSO(QString hisCall, QString hisGrid, QString mode,
|
||||||
QString rptSent, QString rptRcvd, QString date,
|
QString rptSent, QString rptRcvd, QDateTime dateTime,
|
||||||
QString qsoStart, QString qsoStop, double dialFreq,
|
double dialFreq, QString myCall, QString myGrid,
|
||||||
QString myCall, QString myGrid, bool noSuffix,
|
bool noSuffix, bool toRTTY, bool dBtoComments)
|
||||||
bool toRTTY, bool dBtoComments)
|
|
||||||
{
|
{
|
||||||
ui->call->setText(hisCall);
|
ui->call->setText(hisCall);
|
||||||
ui->grid->setText(hisGrid);
|
ui->grid->setText(hisGrid);
|
||||||
@ -35,10 +34,11 @@ void LogQSO::initLogQSO(QString hisCall, QString hisGrid, QString mode,
|
|||||||
ui->mode->setText(mode);
|
ui->mode->setText(mode);
|
||||||
ui->sent->setText(rptSent);
|
ui->sent->setText(rptSent);
|
||||||
ui->rcvd->setText(rptRcvd);
|
ui->rcvd->setText(rptRcvd);
|
||||||
date=date.mid(0,4) + "-" + date.mid(4,2) + "-" + date.mid(6,2);
|
m_dateTime=dateTime;
|
||||||
|
QString date=dateTime.toString("yyyy-MM-dd");
|
||||||
ui->date->setText(date);
|
ui->date->setText(date);
|
||||||
ui->time->setText(qsoStart);
|
QString time=dateTime.toString("hhmm");
|
||||||
if(qsoStart=="") ui->time->setText(qsoStop); //Silence compiler warning
|
ui->time->setText(time);
|
||||||
m_dialFreq=dialFreq;
|
m_dialFreq=dialFreq;
|
||||||
m_myCall=myCall;
|
m_myCall=myCall;
|
||||||
m_myGrid=myGrid;
|
m_myGrid=myGrid;
|
||||||
@ -74,31 +74,29 @@ void LogQSO::initLogQSO(QString hisCall, QString hisGrid, QString mode,
|
|||||||
|
|
||||||
void LogQSO::accept()
|
void LogQSO::accept()
|
||||||
{
|
{
|
||||||
|
QString hisCall,hisGrid,mode,rptSent,rptRcvd,date,time,band;
|
||||||
|
QString comments,name;
|
||||||
|
|
||||||
|
hisCall=ui->call->text();
|
||||||
|
hisGrid=ui->grid->text();
|
||||||
|
mode=ui->mode->text();
|
||||||
|
rptSent=ui->sent->text();
|
||||||
|
rptRcvd=ui->rcvd->text();
|
||||||
|
date=ui->date->text();
|
||||||
|
date=date.mid(0,4) + date.mid(5,2) + date.mid(8,2);
|
||||||
|
time=ui->time->text();
|
||||||
|
band=ui->band->text();
|
||||||
|
name=ui->name->text();
|
||||||
|
comments=ui->comments->text();
|
||||||
|
QString strDialFreq(QString::number(m_dialFreq,'f',6));
|
||||||
|
|
||||||
|
//Log this QSO to file wsjtx_log.adi
|
||||||
QFile f2("wsjtx_log.adi");
|
QFile f2("wsjtx_log.adi");
|
||||||
if(!f2.open(QIODevice::Text | QIODevice::Append)) {
|
if(!f2.open(QIODevice::Text | QIODevice::Append)) {
|
||||||
QMessageBox m;
|
QMessageBox m;
|
||||||
m.setText("Cannot open file \"wsjtx_log.adi\".");
|
m.setText("Cannot open file \"wsjtx_log.adi\".");
|
||||||
m.exec();
|
m.exec();
|
||||||
} else {
|
} else {
|
||||||
QString hisCall,hisGrid,mode,rptSent,rptRcvd,date,qsoStart,band;
|
|
||||||
QString comments,name;
|
|
||||||
// if(qsoStart=="") qsoStart=qsoStop;
|
|
||||||
// if(qsoStop=="") qsoStop=qsoStart;
|
|
||||||
|
|
||||||
hisCall=ui->call->text();
|
|
||||||
hisGrid=ui->grid->text();
|
|
||||||
mode=ui->mode->text();
|
|
||||||
rptSent=ui->sent->text();
|
|
||||||
rptRcvd=ui->rcvd->text();
|
|
||||||
date=ui->date->text();
|
|
||||||
date=date.mid(0,4) + date.mid(5,2) + date.mid(8,2);
|
|
||||||
qsoStart=ui->time->text();
|
|
||||||
band=ui->band->text();
|
|
||||||
name=ui->name->text();
|
|
||||||
comments=ui->comments->text();
|
|
||||||
|
|
||||||
QString strDialFreq(QString::number(m_dialFreq,'f',6));
|
|
||||||
|
|
||||||
QTextStream out(&f2);
|
QTextStream out(&f2);
|
||||||
if(f2.size()==0) out << "WSJT-X ADIF Export<eoh>" << endl;
|
if(f2.size()==0) out << "WSJT-X ADIF Export<eoh>" << endl;
|
||||||
|
|
||||||
@ -109,8 +107,7 @@ void LogQSO::accept()
|
|||||||
t+=" <rst_sent:" + QString::number(rptSent.length()) + ">" + rptSent;
|
t+=" <rst_sent:" + QString::number(rptSent.length()) + ">" + rptSent;
|
||||||
t+=" <rst_rcvd:" + QString::number(rptRcvd.length()) + ">" + rptRcvd;
|
t+=" <rst_rcvd:" + QString::number(rptRcvd.length()) + ">" + rptRcvd;
|
||||||
t+=" <qso_date:8>" + date;
|
t+=" <qso_date:8>" + date;
|
||||||
t+=" <time_on:4>" + qsoStart;
|
t+=" <time_on:4>" + time;
|
||||||
// t+=" <time_off:4>" + qsoStop;
|
|
||||||
t+=" <band:" + QString::number(band.length()) + ">" + band;
|
t+=" <band:" + QString::number(band.length()) + ">" + band;
|
||||||
t+=" <freq:" + QString::number(strDialFreq.length()) + ">" + strDialFreq;
|
t+=" <freq:" + QString::number(strDialFreq.length()) + ">" + strDialFreq;
|
||||||
t+=" <station_callsign:" + QString::number(m_myCall.length()) + ">" +
|
t+=" <station_callsign:" + QString::number(m_myCall.length()) + ">" +
|
||||||
@ -125,6 +122,24 @@ void LogQSO::accept()
|
|||||||
out << t << endl;
|
out << t << endl;
|
||||||
f2.close();
|
f2.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Log this QSO to file wsjtx.log
|
||||||
|
QFile f("wsjtx.log");
|
||||||
|
if(!f.open(QIODevice::Text | QIODevice::Append)) {
|
||||||
|
QMessageBox m;
|
||||||
|
m.setText("Cannot open file \"wsjtx.log\".");
|
||||||
|
m.exec();
|
||||||
|
} else {
|
||||||
|
QString logEntry=m_dateTime.date().toString("yyyy-MMM-dd,") +
|
||||||
|
m_dateTime.time().toString("hh:mm,") + hisCall + "," +
|
||||||
|
hisGrid + "," + strDialFreq + "," + mode +
|
||||||
|
"," + rptSent + "," + rptRcvd + "," + comments;
|
||||||
|
QTextStream out(&f);
|
||||||
|
out << logEntry << endl;
|
||||||
|
f.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
//Clean up and finish logging
|
||||||
emit(acceptQSO(true));
|
emit(acceptQSO(true));
|
||||||
QDialog::accept();
|
QDialog::accept();
|
||||||
}
|
}
|
||||||
|
10
logqso.h
10
logqso.h
@ -19,15 +19,17 @@ public:
|
|||||||
explicit LogQSO(QWidget *parent = 0);
|
explicit LogQSO(QWidget *parent = 0);
|
||||||
~LogQSO();
|
~LogQSO();
|
||||||
void initLogQSO(QString hisCall, QString hisGrid, QString mode,
|
void initLogQSO(QString hisCall, QString hisGrid, QString mode,
|
||||||
QString rptSent, QString rptRcvd, QString date,
|
QString rptSent, QString rptRcvd, QDateTime dateTime,
|
||||||
QString qsoStart, QString qsoStop, double dialFreq,
|
double dialFreq, QString myCall, QString myGrid,
|
||||||
QString myCall, QString myGrid, bool noSuffix,
|
bool noSuffix, bool toRTTY, bool dBtoComments);
|
||||||
bool toRTTY, bool dBtoComments);
|
|
||||||
|
|
||||||
double m_dialFreq;
|
double m_dialFreq;
|
||||||
|
|
||||||
QString m_myCall;
|
QString m_myCall;
|
||||||
QString m_myGrid;
|
QString m_myGrid;
|
||||||
|
|
||||||
|
QDateTime m_dateTime;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void accept();
|
void accept();
|
||||||
void reject();
|
void reject();
|
||||||
|
@ -2339,13 +2339,12 @@ void MainWindow::on_genStdMsgsPushButton_clicked() //genStdMsgs button
|
|||||||
void MainWindow::on_logQSOButton_clicked() //Log QSO button
|
void MainWindow::on_logQSOButton_clicked() //Log QSO button
|
||||||
{
|
{
|
||||||
if(m_hisCall=="") return;
|
if(m_hisCall=="") return;
|
||||||
dateTimeQSO = QDateTime::currentDateTimeUtc();
|
m_dateTimeQSO=QDateTime::currentDateTimeUtc();
|
||||||
QString date=dateTimeQSO.toString("yyyyMMdd");
|
|
||||||
|
|
||||||
logDlg = new LogQSO(0);
|
logDlg = new LogQSO(0);
|
||||||
logDlg->initLogQSO(m_hisCall,m_hisGrid,m_mode,m_rptSent,m_rptRcvd,date,
|
logDlg->initLogQSO(m_hisCall,m_hisGrid,m_mode,m_rptSent,m_rptRcvd,
|
||||||
m_qsoStart,m_qsoStop,m_dialFreq + m_txFreq / 1e6,m_myCall,m_myGrid,
|
m_dateTimeQSO,m_dialFreq,m_myCall,m_myGrid,
|
||||||
m_noSuffix,m_toRTTY,m_dBtoComments);
|
m_noSuffix,m_toRTTY,m_dBtoComments);
|
||||||
connect(logDlg, SIGNAL(acceptQSO(bool)),this,SLOT(acceptQSO2(bool)));
|
connect(logDlg, SIGNAL(acceptQSO(bool)),this,SLOT(acceptQSO2(bool)));
|
||||||
if(m_logQSOgeom != QRect(500,400,424,283)) logDlg->setGeometry(m_logQSOgeom);
|
if(m_logQSOgeom != QRect(500,400,424,283)) logDlg->setGeometry(m_logQSOgeom);
|
||||||
logDlg->show();
|
logDlg->show();
|
||||||
@ -2355,19 +2354,6 @@ void MainWindow::acceptQSO2(bool accepted)
|
|||||||
{
|
{
|
||||||
if(accepted) {
|
if(accepted) {
|
||||||
m_logQSOgeom=logDlg->geometry();
|
m_logQSOgeom=logDlg->geometry();
|
||||||
QString date=dateTimeQSO.toString("yyyyMMdd");
|
|
||||||
QFile f("wsjtx.log");
|
|
||||||
if(!f.open(QIODevice::Text | QIODevice::Append)) {
|
|
||||||
msgBox("Cannot open file \"wsjtx.log\".");
|
|
||||||
} else {
|
|
||||||
QString logEntry=dateTimeQSO.date().toString("yyyy-MMM-dd,") +
|
|
||||||
dateTimeQSO.time().toString("hh:mm,") + m_hisCall + "," +
|
|
||||||
m_hisGrid + "," + QString::number(m_dialFreq) + "," + m_mode +
|
|
||||||
"," + m_rptSent + "," + m_rptRcvd;
|
|
||||||
QTextStream out(&f);
|
|
||||||
out << logEntry << endl;
|
|
||||||
f.close();
|
|
||||||
}
|
|
||||||
if(m_clearCallGrid) {
|
if(m_clearCallGrid) {
|
||||||
m_hisCall="";
|
m_hisCall="";
|
||||||
ui->dxCallEntry->setText("");
|
ui->dxCallEntry->setText("");
|
||||||
|
@ -322,7 +322,7 @@ private:
|
|||||||
QStringList m_macro;
|
QStringList m_macro;
|
||||||
QStringList m_dFreq;
|
QStringList m_dFreq;
|
||||||
|
|
||||||
QDateTime dateTimeQSO;
|
QDateTime m_dateTimeQSO;
|
||||||
|
|
||||||
SoundInThread soundInThread; //Instantiate the audio threads
|
SoundInThread soundInThread; //Instantiate the audio threads
|
||||||
SoundOutThread soundOutThread;
|
SoundOutThread soundOutThread;
|
||||||
|
Loading…
Reference in New Issue
Block a user