2018-02-08 21:28:33 -05:00
|
|
|
/*
|
|
|
|
* Reads an ADIF log file into memory
|
|
|
|
* Searches log for call, band and mode
|
|
|
|
* VK3ACF July 2013
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef __ADIF_H
|
|
|
|
#define __ADIF_H
|
|
|
|
|
|
|
|
#if defined (QT5)
|
|
|
|
#include <QList>
|
|
|
|
#include <QString>
|
2019-06-04 17:05:33 -04:00
|
|
|
#include <QStringList>
|
2018-02-08 21:28:33 -05:00
|
|
|
#include <QMultiHash>
|
2019-06-05 11:33:21 -04:00
|
|
|
#include <QVariant>
|
2018-02-08 21:28:33 -05:00
|
|
|
#else
|
|
|
|
#include <QtGui>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
class QDateTime;
|
|
|
|
|
2019-06-04 17:05:33 -04:00
|
|
|
extern const QStringList ADIF_FIELDS;
|
|
|
|
|
2018-02-08 21:28:33 -05:00
|
|
|
class ADIF
|
|
|
|
{
|
|
|
|
public:
|
2019-03-10 23:48:56 -04:00
|
|
|
|
|
|
|
struct QSO;
|
|
|
|
|
2018-02-08 21:28:33 -05:00
|
|
|
void init(QString const& filename);
|
|
|
|
void load();
|
2019-06-13 09:35:53 -04:00
|
|
|
void add(QString const& call, QString const& band, QString const& mode, const QString &submode, QString const& grid, QString const& date, const QString &name, const QString &comment);
|
2018-11-30 17:02:14 -05:00
|
|
|
bool match(QString const& call, QString const& band) const;
|
2019-03-10 23:48:56 -04:00
|
|
|
QList<ADIF::QSO> find(QString const& call) const;
|
2018-02-08 21:28:33 -05:00
|
|
|
QList<QString> getCallList() const;
|
|
|
|
int getCount() const;
|
|
|
|
|
|
|
|
// open ADIF file and append the QSO details. Return true on success
|
2018-03-05 14:49:51 -05:00
|
|
|
bool addQSOToFile(QByteArray const& ADIF_record);
|
2018-02-08 21:28:33 -05:00
|
|
|
|
2019-06-04 17:05:33 -04:00
|
|
|
QByteArray QSOToADIF(QString const& hisCall, QString const& hisGrid, QString const& mode, QString const& submode, QString const& rptSent
|
2019-02-10 09:37:26 -05:00
|
|
|
, 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
|
2019-06-05 11:33:21 -04:00
|
|
|
, QString const& operator_call, const QMap<QString, QVariant> &additionalFields);
|
2018-03-05 14:49:51 -05:00
|
|
|
|
|
|
|
|
2019-06-04 17:05:33 -04:00
|
|
|
struct QSO
|
|
|
|
{
|
2019-06-13 09:35:53 -04:00
|
|
|
QString call,band,mode,submode,grid,date,name,comment;
|
2019-06-04 17:05:33 -04:00
|
|
|
};
|
2018-02-08 21:28:33 -05:00
|
|
|
|
2019-03-10 23:48:56 -04:00
|
|
|
private:
|
2018-02-08 21:28:33 -05:00
|
|
|
QMultiHash<QString, QSO> _data;
|
|
|
|
QString _filename;
|
|
|
|
|
|
|
|
QString extractField(QString const& line, QString const& fieldName) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|