klog
qso.h
1 #ifndef KLOG_QSO_H
2 #define KLOG_QSO_H
3 /***************************************************************************
4  qso.h - description
5  -------------------
6  begin : may 2020
7  copyright : (C) 2020 by Jaime Robles
8  email : jaime@robles.es
9  ***************************************************************************/
10 
11 /*****************************************************************************
12  * This file is part of KLog. *
13  * *
14  * KLog is free software: you can redistribute it and/or modify *
15  * it under the terms of the GNU General Public License as published by *
16  * the Free Software Foundation, either version 3 of the License, or *
17  * (at your option) any later version. *
18  * *
19  * KLog is distributed in the hope that it will be useful, *
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
22  * GNU General Public License for more details. *
23  * *
24  * You should have received a copy of the GNU General Public License *
25  * along with KLog. If not, see <https://www.gnu.org/licenses/>. *
26  * *
27  *****************************************************************************/
28 
29 
30 #include <QString>
31 #include <QDate>
32 #include <QTime>
33 #include <QObject>
34 #include "utilities.h"
35 #include "klogdefinitions.h"
36 #include "adif.h"
37 #include "frequency.h"
38 
39 
40 class QSO : public QObject
41 {
42  Q_OBJECT
43  friend class tst_QSO;
44 
45 public:
46  QSO(QObject *parent = nullptr);
47  QSO(const QSO& other);
48  ~QSO();
49  void operator=(QSO const &_other);
50 
51  bool copy(const QSO& other);
52  void setLogLevel (const DebugLogLevel _b);
53  void setRealTime(const bool _rt); // Not QSO info but KLog status
54  bool getRealTime() const;
55  void setManualMode(const bool _rt); // Not QSO info but KLog status
56  bool getManualMode() const;
57 
58  void setBackup(const bool _rt);
59  bool getBackup() const;
60 
61  void setModifying(const bool _mod);
62  bool getModifying() const;
63 
64  bool setData(const QString &_adifPair, bool _lotw = false);
65 
66  void clear();
67  bool isValid();
68  void setLoTWUpdating(bool _lotw);
69  bool getLoTWUpdating() const;
70 
71  bool setCall(const QString &_c);
72  QString getCall() const;
73  bool setBand(const QString &_c);
74  QString getBand() const;
75  bool setMode(const QString &_c);
76  QString getMode() const;
77 
78  bool setDateTimeOn(const QDateTime &_c);
79  QDateTime getDateTimeOn() const;
80  bool setDate(const QDate &_c);
81  QDate getDate() const;
82  bool setTimeOn(const QTime &_c);
83  QTime getTimeOn() const;
84 
85  bool setQSOid(const int _i);
86  int getQSOid() const;
87 
88  bool setLogId(const int _i);
89  int getLogId() const;
90 
91  bool setBandRX(const QString &_c);
92  QString getBandRX() const;
93 
94  bool setRSTTX(const QString &_c);
95  QString getRSTTX() const;
96  bool setRSTRX(const QString &_c);
97  QString getRSTRX() const;
98  bool setFreq(const double _f);
99  bool setFreqRX(const double _f);
100  double getFreqTX() const;
101  double getFreqRX() const;
102  bool setQTH(const QString &_c);
103  QString getQTH() const;
104  bool setGridSquare(const QString &_c);
105  QString getGridSquare() const;
106  bool setGridSquare_ext(const QString &_c);
107  QString getGridSquare_ext() const;
108  bool setName(const QString &_c);
109  QString getName() const;
110  bool setRXPwr(const double _f);
111  double getRXPwr() const;
112 
113  // QSL TAB
114  bool setQSL_SENT(const QString &_c);
115  QString getQSL_SENT() const;
116  bool setQSLSDate(const QDate &_c);
117  QDate getQSLSDate() const;
118  bool setQSLSenVia(const QString &_qs);
119  QString getQSLSentVia() const;
120 
121  bool setQSL_RCVD(const QString &_c);
122  QString getQSL_RCVD() const;
123  bool setQSLRDate(const QDate &_c);
124  QDate getQSLRDate() const;
125  bool setQSLRecVia(const QString &_qs);
126  QString getQSLRecVia() const;
127 
128  bool setQSLVia(const QString &_qs);
129  QString getQSLVia() const;
130  bool setQSLMsg(const QString &_qs);
131  QString getQSLMsg() const;
132 
133  // eQSL tab
134  bool setClubLogStatus(const QString &_c);
135  QString getClubLogStatus() const;
136 
137  bool setClubLogDate(const QDate &_c);
138  bool setClubLogDate(const QString& data);
139 
140  QDate getClubLogDate() const;
141 
142  bool setEQSLQSL_RCVD(const QString &_c);
143  QString getEQSLQSL_RCVD() const;
144  bool setEQSLQSL_SENT(const QString &_c);
145  QString getEQSLQSL_SENT() const;
146  bool setEQSLQSLRDate(const QDate &_c);
147  QDate getEQSLQSLRDate() const;
148  bool setEQSLQSLSDate(const QDate &_c);
149  QDate getEQSLQSLSDate() const;
150 
151  bool setLoTWQSL_RCVD(const QString &_c);
152  QString getLoTWQSL_RCVD() const;
153  bool setLoTWQSL_SENT(const QString &_c);
154  QString getLoTWQSL_SENT() const;
155  bool setLoTWQSLRDate(const QDate &_c);
156  QDate getLoTWQSLRDate() const;
157  bool setLoTWQSLSDate(const QDate &_c);
158  QDate getLoTWQSLSDate() const;
159 
160  bool setQRZCOMStatus(const QString &_c);
161  QString getQRZCOMStatus() const;
162  bool setQRZCOMDate(const QDate &_c);
163  QDate getQRZCOMDate() const;
164 
165  void setDefaultEQSLSentServices(const bool _send);
166 
167  // Comment Tab
168  bool setComment(const QString &_c);
169  QString getComment() const;
170  bool setKeepComment(bool _k);
171  bool getKeepComment() const;
172 
173  // Others Tab
174  bool setDXCC(const int _i);
175  int getDXCC() const;
176  bool setKlogDxcc(const int _i);
177  bool setKlogDxcc(const QString &data);
178  int getKlogDxcc() const;
179  bool setPropMode(const QString &_c);
180  QString getPropMode() const;
181  bool setSOTA_REF(const QString &_c);
182  QString getSOTA_REF() const;
183  bool setAge(const double _c);
184  double getAge() const;
185  bool setIOTA(const QString &_c);
186  QString getIOTA() const;
187  bool setKeepOthers(bool _k);
188  bool getKeepOthers() const;
189  bool setVUCCGrids(const QString &_c);
190  QString getVUCCGrids() const;
191 
192  bool setPOTA_Ref(const QString &_c);
193  QString getPOTA_Ref() const;
194  bool setWWFF_Ref(const QString &_c);
195  QString getWWFF_Ref() const;
196  bool setSIG(const QString &_c);
197  QString getSIG() const;
198  bool setSIG_INFO(const QString &_c);
199  QString getSIG_INFO() const;
200 
201  // My data Tab
202  bool setTXPwr(double _f);
203  double getTXPwr() const;
204  bool setOperatorCallsign(const QString &_c);
205  QString getOperatorCallsign() const;
206  bool setStationCallsign(const QString &_c);
207  QString getStationCallsign() const;
208  bool setMyGridSquare(const QString &_c);
209  QString getMyGridSquare() const;
210  bool setMyGridSquare_ext(const QString &_c);
211  QString getMyGridSquare_ext() const;
212  bool setKeepMyData(bool _k);
213  bool getKeepMyData() const;
214 
215  bool setMySOTA_REF(const QString &_c);
216  QString getMySOTA_REF() const;
217  bool setMyRig(const QString &_c);
218  QString getMyRig() const;
219  bool setMyAntenna(const QString &_c);
220  QString getMyAntenna() const;
221  bool setMyVUCCGrids(const QString &_c);
222  QString getMyVUCCGrids() const;
223 
224  bool setMyPOTA_Ref(const QString &_c);
225  QString getMyPOTA_Ref() const;
226  bool setMyWWFF_Ref(const QString &_c);
227  QString getMyWWFF_Ref() const;
228 
229 
230 
231  // Satellite Tab
232  bool setSatName(const QString &_c);
233  QString getSatName() const;
234  bool setSatMode(const QString &_c);
235  QString getSatMode() const;
236  bool setKeepSatTab(bool _k);
237  bool getKeepSatTab() const;
238 
239  bool setAddress(const QString &_c);
240  QString getAddress() const;
241  bool setAltitude(const double _c);
242  double getAltitude() const;
243  bool setA_Index(const double _i);
244  double getA_Index() const;
245  bool setAnt_az(const double _c);
246  double getAnt_az() const;
247  bool setAnt_el(const double _c);
248  double getAnt_el() const;
249  bool setAnt_Path(const QString &_c);
250  QString getAnt_Path() const;
251  bool setARRL_Sect(const QString &_c);
252  QString getARRL_Sect() const;
253  bool setCheck(const QString &_c);
254  QString getCheck() const;
255  bool setClass(const QString &_c);
256  QString getClass() const;
257  bool setContinent(const QString &_c);
258  QString getContinent() const;
259  bool setDistance(const double _i); // In Km
260  double getDistance() const; // In Km
261  bool setOwnerCallsign(const QString &_c);
262  QString getOwnerCallsign() const;
263  bool setEQ_Call(const QString &_c); // Contacted station owner
264  QString getEQ_Call() const; // Contacted station owner
265  bool setHRDUpdateDate(const QDate &_c);
266  QDate getHRDUpdateDate() const;
267  bool setHRDLogStatus(const QString &_c);
268  QString getHRDLogStatus() const;
269 
270  bool setHamLogEUStatus(const QString &_c);
271  QString getHamLogEUStatus() const;
272  bool setHamLogEUUpdateDate(const QDate &_c);
273  QDate getHamLogEUUpdateDate() const;
274  bool setHamQTHStatus(const QString &_c);
275  QString getHamQTHStatus() const;
276  bool setHamQTHUpdateDate(const QDate &_c);
277  QDate getHamQTHUpdateDate() const;
278 
279 
280  bool setK_Index(const int _i);
281  int getK_Index() const;
282 
283  bool setDateTimeOff(const QDateTime &_c);
284  QDateTime getDateTimeOff() const;
285  bool setDateOff(const QDate &_c);
286  QDate getDateOff() const;
287  bool setTimeOff(const QTime &_c);
288  QTime getTimeOff() const;
289 
290  bool setRig(const QString &_c);
291  QString getRig() const;
292  bool setCountry(const QString &_c);
293  QString getCountry() const;
294  bool setAwardGranted(const QString &_c);
295  QString getAwardGranted() const;
296  bool setAwardSubmitted(const QString &_c);
297  QString getAwardSubmitted() const;
298  bool setCounty(const QString &_c);
299  QString getCounty() const;
300  bool setContactedOperator(const QString &_c);
301  QString getContactedOperator() const;
302  bool setContestID(const QString &_c);
303  QString getContestID() const;
304  bool setCQZone(const int _i);
305  int getCQZone() const;
306  bool setCreditGranted(const QString &_c);
307  QString getCreditGranted() const;
308  bool setCreditSubmitted(const QString &_c);
309  QString getCreditSubmitted() const;
310  bool setDarcDok(const QString &_c);
311  QString getDarcDok() const;
312  bool setEmail(const QString &_c);
313  QString getEmail() const;
314  bool setFists(const int _i);
315  int getFists() const;
316  bool setFistsCC(const int _i);
317  int getFistsCC() const;
318  bool setForceInit(bool _k);
319  bool getForceInit() const;
320  bool setIotaID(const int _i);
321  int getIotaID() const;
322  bool setItuZone(const int _i);
323  int getItuZone() const;
324  bool setLatitude(const QString &_c);
325  QString getLatitude() const;
326  bool setLongitude(const QString &_c);
327  QString getLongitude() const;
328  bool setQSOComplete(const QString &_c); // Receives valid ADIF data (Y/N/NIL/?)
329  QString getQSOComplete() const;
330  bool setNrBursts(const int _i);
331  int getNrBursts() const;
332  bool setMaxBursts(const int _i);
333  int getMaxBursts() const;
334  bool setNrPings(const int _i);
335  int getNrPings() const;
336  bool setMsShower(const QString &_c);
337  QString getMsShower() const;
338  bool setQSORandom(bool _k);
339  bool getQSORandom() const;
340  bool setMyAltitude(const double _c);
341  double getMyAltitude() const;
342  bool setMyARRL_Sect(const QString &_c);
343  QString getMyARRL_Sect() const;
344  bool setMyCity(const QString &_c);
345  QString getMyCity() const;
346  bool setMyCounty(const QString &_c);
347  QString getMyCounty() const;
348  bool setMyCountry(const QString &_c);
349  QString getMyCountry() const;
350  bool setMyCQZone(const int _i);
351  int getMyCQZone() const;
352  bool setMyDXCC(const int _i);
353  int getMyDXCC() const;
354  bool setMyFists(const int _c);
355  int getMyFists() const;
356  bool setMyIOTA(const QString &_c);
357  QString getMyIOTA() const;
358  bool setMyIotaID(const int _i);
359  int getMyIotaID() const;
360  bool setMyITUZone(const int _i);
361  int getMyITUZone() const;
362  bool setMyLatitude(const QString &_c);
363  QString getMyLatitude() const;
364  bool setMyLongitude(const QString &_c);
365  QString getMyLongitude() const;
366  bool setMyName(const QString &_c);
367  QString getMyName() const;
368  bool setMyPostalCode(const QString &_c);
369  QString getMyPostalCode() const;
370  bool setMySig(const QString &_c);
371  QString getMySig() const;
372  bool setMySigInfo(const QString &_c);
373  QString getMySigInfo() const;
374  bool setMyState(const QString &_c);
375  QString getMyState() const;
376  bool setMyStreet(const QString &_c);
377  QString getMyStreet() const;
378  bool setMyUsacaCounties(const QString &_c);
379  QString getMyUsacaCounties() const;
380  bool setNotes(const QString &_c);
381  QString getNotes() const;
382  bool setPrefix(const QString &_c); // ADIF - PFX - WPX Prefix
383  QString getPrefix() const;
384  bool setPrecedence(const QString &_c);
385  QString getPrecedence() const;
386  bool setPublicKey(const QString &_c);
387  QString getPublicKey() const;
388  bool setRegion(const QString &_c);
389  QString getRegion() const;
390  bool setTenTen(const int _i);
391  int getTenTen() const;
392  bool setSFI(const int _i);
393  int getSFI() const;
394 
395  bool setSilentKey(bool _k);
396  bool getSilentKey() const;
397  bool setSkcc(const QString &_c);
398  QString getSkcc() const;
399  bool setSrx(const int _i);
400  int getSrx() const;
401  bool setSrxString(const QString &_c);
402  QString getSrxString() const;
403  bool setState(const QString &_c); // ADIF - STATE - Primary subdivision
404  QString getState() const;
405  bool setStx(const int _i);
406  int getStx() const;
407  bool setStxString(const QString &_c);
408  QString getStxString() const;
409  bool setSubmode(const QString &_c);
410  QString getSubmode() const;
411  bool setSwl(bool _k);
412  bool getSwl() const;
413  bool setUksmg(const int _i);
414  int getUksmg() const;
415  bool setUsacaCounties(const QString &_c);
416  QString getUsacaCounties() const;
417  bool setVeProv(const QString &_c);
418  QString getVeProv() const;
419  bool setWeb(const QString &_c);
420  QString getWeb() const;
421 
422  //Overloaded helper functions to accept string data for nonstring functions
423  bool setAge(const QString &data);
424  bool setAltitude(const QString &data);
425  bool setA_Index(const QString &data);
426  bool setAnt_az(const QString &data);
427  bool setAnt_el(const QString &data);
428  bool setCQZone(const QString &data);
429  bool setDistance(const QString &data); // In Km
430  bool setDXCC(const QString &data);
431  bool setFists(const QString &data);
432  bool setFistsCC(const QString &data);
433  bool setMyFists(const QString &data);
434  bool setIotaID(const QString &data);
435  bool setItuZone(const QString &data);
436  bool setK_Index(const QString &data);
437  bool setMaxBursts(const QString &data);
438  bool setMyAltitude(const QString &data);
439  bool setMyCQZone(const QString &data);
440  bool setMyDXCC(const QString &data);
441  bool setMyIotaID(const QString &data);
442  bool setMyITUZone(const QString &data);
443  bool setNrBursts(const QString &data);
444  bool setNrPings(const QString &data);
445  bool setSFI(const QString &data);
446  bool setSrx(const QString &data);
447  bool setStx(const QString &data);
448  bool setTenTen(const QString &data);
449  bool setUksmg(const QString &data);
450  bool setFreq(const QString& data);
451  bool setFreqRX(const QString& data);
452  bool setRXPwr(const QString& data);
453  bool setTXPwr(const QString& data);
454  bool setEQSLQSLRDate(const QString& data);
455  bool setEQSLQSLSDate(const QString& data);
456  bool setForceInit(const QString& data);
457  bool setHRDUpdateDate(const QString& data);
458  bool setHamLogEUUpdateDate(const QString& data);
459  bool setHamQTHUpdateDate(const QString& data);
460  bool setLoTWQSLRDate(const QString& data);
461  bool setLoTWQSLSDate(const QString& data);
462  //bool setLoTWRXQSO(const QString& string); // Receives the string date/time in LOTW format (APP_LoTW_RXQSO)
463  bool setLoTWRXQSO(const QString& data);
464  bool setLoTWRXQSL(const QString& data);
465  bool setQRZCOMDate(const QString& data);
466  bool setQSLRDate(const QString& data);
467  bool setQSLSDate(const QString& data);
468  bool setDate(const QString& data);
469  bool setDateOff(const QString& data);
470  bool setQSORandom(const QString& data);
471  bool setSilentKey(const QString& data);
472  bool setSwl(const QString& data);
473  bool setTimeOff(const QString& data);
474  bool setTimeOn(const QString& data);
475 
476 
477 
478  void clearQSLDateIfNeeded(); // Prevents a date when not ADIF compatible
479  bool isComplete() const;
480  QString getADIF(ExportMode _em = ModeADIF);
481 
482  bool mergeLoTWData(const QSO &_lotw); // Updates a QSO with the data obtained from LoTW
483  void printQSO(); //TODO: Complete: Prints all QSO fields - DEBUG ONLY
484 
485 signals:
486  void debugLog (QString _func, QString _msg, DebugLogLevel _level);
487  void getModeSignal (QString submode); // Request the mode to be filled for a given submode
488  void queryError(QString functionFailed, QString errorCodeS, QString nativeError, QString failedQuery); // To alert about any failed query execution
489 
490 private:
491  // qTime startT;
492  QString getADIFStandard();
493  QString getADIFLoTW();
494  QString getADIFClubLog();
495  QString getADIFeQSL();
496 
497 
498  bool isValidCall() const;
499  bool isValidDateTime() const;
500 
501  void logEvent(const QString &_func, const QString &_msg, DebugLogLevel _level);
502  void cleanMode(); // Cleans mode & submode
503 
504  int qsoId, logId, dxcc, klogDxcc, k_index, cqz, fists, fists_cc, my_fists, iota_ID, itu_zone, nr_bursts, max_bursts, nr_pings, my_cqz, my_itu_zone, my_dxcc, my_iota_ID, srx, stx, uksmg;
505  int ten_ten, sfi;
506  double pwr_rx, pwr_tx, age, ant_el, ant_az, distance, altitude, my_altitude, a_index;
507  Frequency freq_tx, freq_rx;
508 
509  QString satName, satMode, callsign, stationCallsign, operatorCall, propMode, band, band_rx, mode, gridsquare, my_gridsquare, gridsquare_ext, my_gridsquare_ext, qth, name, RST_tx, RST_rx;
510  QString qsl_rcvd, qsl_sent, qslSenVia, qslRecVia, qslVia, check, clase;
511  QString lotw_qsl_sent, lotw_qsl_rcvd, sota_ref, my_sota_ref, my_rig, my_antenna, my_arrl_sect, vucc_grids, my_vucc_grids;
512  QString pota_ref, my_pota_ref;
513  QString clublog_status, hrdlog_status, QRZCom_status;
514  QString hamlogeu_status, hamqth_status;
515 
516  QString eqsl_qsl_sent, eqsl_qsl_rcvd;
517  QString comment, address, ant_path, arrl_sect, continent, rig, country, award_granted, award_submitted, county, contacted_op, contacted_owner, contest_id;
518  QString credit_granted, credit_submitted,darc_dok, email, qso_complete, usaca_counties, ve_prov, web, wwff_ref;
519  QString iota, ownerCall, latitude, longitude, ms_shower, notes, prefix, precedence, public_key, qslmsg, region, sig, sig_info, skcc, srx_string, stx_string, state, submode;
520  QString my_city, my_county, my_country, my_iota, my_latitude, my_longitude, my_name, my_postal_code, my_sig, my_sig_info, my_state, my_street, my_usaca_counties, my_wwff_ref;
521 
522  // qTime qso_time_off;
523  QDateTime qso_dateTime;
524  QDateTime qso_dateTime_off;
525 
526  QDate QSLRDate, QSLSDate, QSLLoTWRDate, QSLLoTWSDate;//, qso_date_off;
527  QDate eQSLRDate, eQSLSDate, clublogQSOUpdateDate, hrdlogUploadDate;
528  QDate hamlogeuUpdateDate, hamqthUpdateDate;
529 
530  QDate QRZComDate;
531 
532  bool backup, lotwUpdating, realTime, manualMode, silent_key;
533  bool keepComment, keepOther, keepMyData, keepSat, modifying, isValidDistance, forceInit, qso_random, swl;
534  bool haveBand, haveMode, haveSubMode, haveDateTime, haveCall;
535 
536  Utilities *util;
537  Adif *adif;
538  DebugLogLevel logLevel;
539 
540  bool decltype_function(const QString& _c); //empty function to find correct typenames for mem_fn, DO NOT RENAME
541  static QHash<QString, decltype(std::mem_fn(&QSO::decltype_function))> SetDataHash;
542  void InitializeHash();
543 };
544 
545 #endif // QSO_H
Definition: utilities.h:54
Definition: adif.h:50
Definition: qso.h:40
Definition: tst_qso.cpp:38
Definition: frequency.h:36