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>
|
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();
|
|
|
|
void add(QString const& call, 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;
|
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
|
2017-08-29 22:27:57 -04:00
|
|
|
bool addQSOToFile(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);
|
2013-09-06 01:00:28 -04:00
|
|
|
|
2017-08-29 22:27:57 -04:00
|
|
|
static QString bandFromFrequency(double dialFreq);
|
2013-09-06 01:00:28 -04:00
|
|
|
|
2013-07-31 07:29:42 -04:00
|
|
|
private:
|
|
|
|
struct QSO
|
|
|
|
{
|
|
|
|
QString call,band,mode,date;
|
|
|
|
};
|
|
|
|
|
2017-07-09 16:45:53 -04:00
|
|
|
QMultiHash<QString, QSO> _data;
|
2013-07-31 07:29:42 -04:00
|
|
|
QString _filename;
|
|
|
|
|
2017-08-29 22:27:57 -04:00
|
|
|
QString _extractField(QString const& line, QString const& fieldName) const;
|
2013-07-31 07:29:42 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|