mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-22 04:11:16 -05:00
Finish connecting "New DXCC on Band", "New Grid", "New Grid on Band". Needs more testing!
This commit is contained in:
parent
68ec268fef
commit
ef3f084c5c
@ -178,6 +178,7 @@ QString DisplayText::appendWorkedB4(QString message, QString const& callsign, QS
|
||||
logBook.match(/*in*/call,grid,/*out*/countryName,callWorkedBefore,countryWorkedBefore,gridB4);
|
||||
logBook.match(/*in*/call,grid,/*out*/countryName,callB4onBand,countryB4onBand,gridB4onBand,
|
||||
/*in*/ currentBand);
|
||||
// if(gridB4) qDebug() << "aa" << grid << gridB4 << gridB4onBand;
|
||||
|
||||
message = message.trimmed ();
|
||||
QString appendage{""};
|
||||
@ -187,17 +188,29 @@ QString DisplayText::appendWorkedB4(QString message, QString const& callsign, QS
|
||||
appendage += "!";
|
||||
*bg = m_color_DXCC;
|
||||
} else {
|
||||
if (!callWorkedBefore) {
|
||||
// but have worked the country
|
||||
appendage += "~";
|
||||
*bg = m_color_NewCall;
|
||||
if(!countryB4onBand) {
|
||||
*bg = m_color_DXCCband;
|
||||
} else {
|
||||
if(!callB4onBand) {
|
||||
appendage += "~";
|
||||
*bg = m_color_NewCallBand;
|
||||
if(!gridB4) {
|
||||
*bg = m_color_NewGrid;
|
||||
} else {
|
||||
appendage += " "; // have worked this call before
|
||||
*bg = m_color_CQ;
|
||||
if(!gridB4onBand) {
|
||||
*bg = m_color_NewGridBand;
|
||||
} else {
|
||||
if (!callWorkedBefore) {
|
||||
// but have worked the country
|
||||
appendage += "~";
|
||||
*bg = m_color_NewCall;
|
||||
} else {
|
||||
if(!callB4onBand) {
|
||||
appendage += "~";
|
||||
*bg = m_color_NewCallBand;
|
||||
} else {
|
||||
appendage += " "; // have worked this call before
|
||||
*bg = m_color_CQ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -269,8 +282,8 @@ void DisplayText::displayDecodedText(DecodedText const& decodedText, QString con
|
||||
QString dxCall;
|
||||
QString dxGrid;
|
||||
decodedText.deCallAndGrid (/*out*/ dxCall, dxGrid);
|
||||
QRegularExpression m_grid_regexp {"\\A(?![Rr]{2}73)[A-Ra-r]{2}[0-9]{2}([A-Xa-x]{2}){0,1}\\z"};
|
||||
if(!dxGrid.contains(m_grid_regexp)) dxGrid="";
|
||||
QRegularExpression grid_regexp {"\\A(?![Rr]{2}73)[A-Ra-r]{2}[0-9]{2}([A-Xa-x]{2}){0,1}\\z"};
|
||||
if(!dxGrid.contains(grid_regexp)) dxGrid="";
|
||||
message = message.left (message.indexOf (QChar::Nbsp)); // strip appended info
|
||||
if (displayDXCCEntity && CQcall)
|
||||
// if enabled add the DXCC entity and B4 status to the end of the
|
||||
|
@ -15,6 +15,7 @@ void ADIF::init(QString const& filename)
|
||||
{
|
||||
_filename = filename;
|
||||
_data.clear();
|
||||
_data2.clear();
|
||||
}
|
||||
|
||||
|
||||
@ -54,7 +55,8 @@ QString ADIF::extractField(QString const& record, QString const& fieldName) cons
|
||||
|
||||
void ADIF::load()
|
||||
{
|
||||
_data.clear();
|
||||
_data.clear();
|
||||
_data2.clear();
|
||||
QFile inputFile(_filename);
|
||||
if (inputFile.open(QIODevice::ReadOnly))
|
||||
{
|
||||
@ -98,6 +100,7 @@ void ADIF::load()
|
||||
buffer.remove (0, next_record >=0 ? next_record : buffer.size ());
|
||||
record = record.mid (record.indexOf (QChar {'<'}));
|
||||
add (extractField (record, "CALL")
|
||||
, extractField (record, "GRIDSQUARE")
|
||||
, extractField (record, "BAND")
|
||||
, extractField (record, "MODE")
|
||||
, extractField (record, "QSO_DATE"));
|
||||
@ -107,24 +110,33 @@ void ADIF::load()
|
||||
}
|
||||
|
||||
|
||||
void ADIF::add(QString const& call, QString const& band, QString const& mode, QString const& date)
|
||||
void ADIF::add(QString const& call, QString const& grid, QString const& band,
|
||||
QString const& mode, QString const& date)
|
||||
{
|
||||
QSO q;
|
||||
q.call = call;
|
||||
q.band = band;
|
||||
q.mode = mode;
|
||||
q.date = date;
|
||||
if (q.call.size ())
|
||||
{
|
||||
_data.insert(q.call,q);
|
||||
// qDebug() << "Added as worked:" << call << band << mode << date;
|
||||
}
|
||||
QSO q;
|
||||
q.call = call;
|
||||
q.grid = grid;
|
||||
q.band = band;
|
||||
q.mode = mode;
|
||||
q.date = date;
|
||||
if(q.call.size ()) {
|
||||
_data.insert(q.call,q);
|
||||
_data2.insert(q.grid,q);
|
||||
// qDebug() << "In the log:" << call << grid << band << mode << date;
|
||||
}
|
||||
}
|
||||
|
||||
// return true if in the log same band and mode (where JT65 == JT9 == FT8)
|
||||
bool ADIF::match(QString const& call, QString const& band, QString const& mode) const
|
||||
{
|
||||
QList<QSO> qsos = _data.values(call);
|
||||
QList<QSO> qsos;
|
||||
QRegularExpression grid_regexp {"\\A(?![Rr]{2}73)[A-Ra-r]{2}[0-9]{2}([A-Xa-x]{2}){0,1}\\z"};
|
||||
if(!call.contains(grid_regexp)) {
|
||||
qsos = _data.values(call);
|
||||
} else {
|
||||
qsos = _data2.values(call);
|
||||
}
|
||||
// qDebug() << "AA" << call << qsos.size();
|
||||
if (qsos.size()>0) {
|
||||
QSO q;
|
||||
foreach(q,qsos) {
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
#include <QMultiHash>
|
||||
#include <QRegularExpression>
|
||||
#else
|
||||
#include <QtGui>
|
||||
#endif
|
||||
@ -23,7 +24,8 @@ class ADIF
|
||||
public:
|
||||
void init(QString const& filename);
|
||||
void load();
|
||||
void add(QString const& call, QString const& band, QString const& mode, QString const& date);
|
||||
void add(QString const& call, const QString &grid, QString const& band, QString const& mode,
|
||||
QString const& date);
|
||||
bool match(QString const& call, QString const& band, QString const& mode) const;
|
||||
QList<QString> getCallList() const;
|
||||
int getCount() const;
|
||||
@ -37,19 +39,17 @@ class ADIF
|
||||
, QString const& strDialFreq, QString const& m_myCall, QString const& m_myGrid
|
||||
, QString const& m_txPower, QString const& operator_call);
|
||||
|
||||
|
||||
private:
|
||||
struct QSO
|
||||
{
|
||||
QString call,band,mode,date;
|
||||
QString call,grid,band,mode,date;
|
||||
};
|
||||
|
||||
QMultiHash<QString, QSO> _data;
|
||||
QString _filename;
|
||||
|
||||
QMultiHash<QString, QSO> _data;
|
||||
QMultiHash<QString, QSO> _data2;
|
||||
QString _filename;
|
||||
QString extractField(QString const& line, QString const& fieldName) const;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -71,13 +71,14 @@ void LogBook::match(/*in*/const QString call,QString grid,
|
||||
bool &gridWorkedBefore,
|
||||
QString currentBand) const
|
||||
{
|
||||
if(currentBand=="") qDebug() << "aa" << grid;
|
||||
if(currentBand!="") qDebug() << "bb" << grid << currentBand;
|
||||
// if(currentBand=="") qDebug() << "aa" << grid;
|
||||
// if(currentBand!="") qDebug() << "bb" << grid << currentBand;
|
||||
|
||||
if (call.length() > 0) {
|
||||
QString currentMode = "JT9"; // JT65 == JT9 == FT8 in ADIF::match()
|
||||
// QString currentBand = ""; // match any band
|
||||
callWorkedBefore = _log.match(call,currentBand,currentMode);
|
||||
gridWorkedBefore = _log.match(grid,currentBand,currentMode);
|
||||
countryName = _countries.find(call);
|
||||
|
||||
if (countryName.length() > 0) { // country was found
|
||||
@ -90,10 +91,11 @@ void LogBook::match(/*in*/const QString call,QString grid,
|
||||
}
|
||||
}
|
||||
|
||||
void LogBook::addAsWorked(const QString call, const QString band, const QString mode, const QString date)
|
||||
void LogBook::addAsWorked(const QString call, const QString grid, const QString band,
|
||||
const QString mode, const QString date)
|
||||
{
|
||||
//qDebug() << "adding " << call << " as worked";
|
||||
_log.add(call,band,mode,date);
|
||||
_log.add(call,grid,band,mode,date);
|
||||
QString countryName = _countries.find(call);
|
||||
if (countryName.length() > 0)
|
||||
_worked.setAsWorked(countryName);
|
||||
|
@ -23,7 +23,8 @@ public:
|
||||
void match(/*in*/ const QString call, QString grid,
|
||||
/*out*/ QString &countryName, bool &callWorkedBefore, bool &countryWorkedBefore,
|
||||
bool &gridWorkedBefore, QString currentBand="") const;
|
||||
void addAsWorked(const QString call, const QString band, const QString mode, const QString date);
|
||||
void addAsWorked(const QString call, const QString grid, const QString band,
|
||||
const QString mode, const QString date);
|
||||
|
||||
private:
|
||||
CountryDat _countries;
|
||||
|
@ -5184,7 +5184,7 @@ void MainWindow::acceptQSO (QDateTime const& QSO_date_off, QString const& call,
|
||||
, QString const& my_call, QString const& my_grid, QByteArray const& ADIF)
|
||||
{
|
||||
QString date = QSO_date_on.toString("yyyyMMdd");
|
||||
m_logBook.addAsWorked (m_hisCall, m_config.bands ()->find (m_freqNominal), m_modeTx, date);
|
||||
m_logBook.addAsWorked (m_hisCall,grid,m_config.bands()->find(m_freqNominal),m_modeTx,date);
|
||||
|
||||
m_messageClient->qso_logged (QSO_date_off, call, grid, dial_freq, mode, rpt_sent, rpt_received, tx_power, comments, name, QSO_date_on, operator_call, my_call, my_grid);
|
||||
m_messageClient->logged_ADIF (ADIF);
|
||||
|
Loading…
Reference in New Issue
Block a user