forked from 7h0ma5/QLog
-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathAlertEvaluator.h
74 lines (62 loc) · 1.43 KB
/
AlertEvaluator.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#ifndef QLOG_CORE_ALERTEVALUATOR_H
#define QLOG_CORE_ALERTEVALUATOR_H
#include <QObject>
#include "data/DxSpot.h"
#include "data/WsjtxEntry.h"
#include "data/SpotAlert.h"
#include <QRegularExpression>
class AlertRule : public QObject
{
Q_OBJECT
public:
explicit AlertRule(QObject *parent = nullptr);
~AlertRule() {};
bool save();
bool load(const QString &);
bool match(const WsjtxEntry &wsjtx) const;
bool match(const DxSpot & spot) const;
bool isValid() const;
operator QString() const;
public:
QString ruleName;
bool enabled;
int sourceMap;
QString dxCallsign;
int dxCountry;
int dxLogStatusMap;
QString dxContinent;
QString dxComment;
QStringList dxMember;
QString mode;
QString band;
int spotterCountry;
QString spotterContinent;
int ituz;
int cqz;
bool pota;
bool sota;
bool iota;
bool wwff;
private:
bool ruleValid;
QRegularExpression callsignRE;
QRegularExpression commentRE;
QSet<QString> dxMemberSet;
};
class AlertEvaluator : public QObject
{
Q_OBJECT
public:
explicit AlertEvaluator(QObject *parent = nullptr);
~AlertEvaluator() {clearRules();}
void clearRules();
public slots:
void dxSpot(const DxSpot&);
void WSJTXCQSpot(const WsjtxEntry&);
void loadRules();
signals:
void spotAlert(SpotAlert alert);
private:
QList<AlertRule *>ruleList;
};
#endif // QLOG_CORE_ALERTEVALUATOR_H