2013-07-31 07:29:42 -04:00
|
|
|
/*
|
|
|
|
* Reads an ADIF log file into memory
|
|
|
|
* Searches log for call, band and mode
|
|
|
|
* VK3ACF July 2013
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef __ADIF_H
|
|
|
|
#define __ADIF_H
|
|
|
|
|
2013-08-07 19:03:18 -04:00
|
|
|
#if defined (QT5)
|
|
|
|
#include <QList>
|
|
|
|
#include <QString>
|
2013-08-08 19:51:53 -04:00
|
|
|
#include <QMultiHash>
|
2018-08-24 15:51:29 -04:00
|
|
|
#include <QRegularExpression>
|
2013-08-07 19:03:18 -04:00
|
|
|
#else
|
2013-07-31 07:29:42 -04:00
|
|
|
#include <QtGui>
|
2013-08-07 19:03:18 -04:00
|
|
|
#endif
|
2013-07-31 07:29:42 -04:00
|
|
|
|
2017-07-09 16:45:53 -04:00
|
|
|
class QDateTime;
|
2013-07-31 07:29:42 -04:00
|
|
|
|
|
|
|
class ADIF
|
|
|
|
{
|
|
|
|
public:
|
2017-08-29 22:27:57 -04:00
|
|
|
void init(QString const& filename);
|
|
|
|
void load();
|
2018-08-24 15:51:29 -04:00
|
|
|
void add(QString const& call, const QString &grid, QString const& band, QString const& mode,
|
|
|
|
QString const& date);
|
2017-08-29 22:27:57 -04:00
|
|
|
bool match(QString const& call, QString const& band, QString const& mode) const;
|
|
|
|
QList<QString> getCallList() const;
|
|
|
|
int getCount() const;
|
2013-07-31 07:29:42 -04:00
|
|
|
|
2013-09-06 01:00:28 -04:00
|
|
|
// open ADIF file and append the QSO details. Return true on success
|
2018-02-04 17:42:35 -05:00
|
|
|
bool addQSOToFile(QByteArray const& ADIF_record);
|
2013-09-06 01:00:28 -04:00
|
|
|
|
2018-10-02 15:52:25 -04:00
|
|
|
QByteArray QSOToADIF(QString const& hisCall, QString const& hisGrid, QString const& mode,
|
|
|
|
QString const& rptSent, QString const& rptRcvd, QDateTime const& dateTimeOn,
|
|
|
|
QDateTime const& dateTimeOff, QString const& band, QString const& comments,
|
|
|
|
QString const& name, QString const& strDialFreq, QString const& m_myCall,
|
|
|
|
QString const& m_myGrid, QString const& m_txPower, QString const& operator_call,
|
|
|
|
QString const& xSent, QString const& xRcvd);
|
2017-11-29 16:05:27 -05:00
|
|
|
|
|
|
|
private:
|
2013-07-31 07:29:42 -04:00
|
|
|
struct QSO
|
|
|
|
{
|
2018-08-24 15:51:29 -04:00
|
|
|
QString call,grid,band,mode,date;
|
2013-07-31 07:29:42 -04:00
|
|
|
};
|
|
|
|
|
2018-08-24 15:51:29 -04:00
|
|
|
QMultiHash<QString, QSO> _data;
|
|
|
|
QMultiHash<QString, QSO> _data2;
|
|
|
|
QString _filename;
|
2017-09-16 16:27:05 -04:00
|
|
|
QString extractField(QString const& line, QString const& fieldName) const;
|
2013-07-31 07:29:42 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|