summaryrefslogtreecommitdiff
path: root/map65/messages.h
blob: 891705450ff011252b281b6bc94015f2300cc2b0 (plain)
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
75
#ifndef MESSAGES_H
#define MESSAGES_H

#include <QDialog>
#include "commons.h"
#include "PSKReporter.hpp"
#include <memory>
#include <QNetworkReply>
#include <QDateTime>

namespace Ui {
  class Messages;
}

class PSKReporter; // Forward declaration — avoids including PSKReporter.h here

class Messages : public QDialog
{
  Q_OBJECT

public:
  explicit Messages (QString const& settings_filename, QWidget * parent = nullptr);
  void setText(QString t, QString t2);
  void setColors(QString t);
  void init_psk_reporter(bool const& param1, bool const& param2, QString const& param3);
  void setClosingForShutdown(bool value) { m_closingForShutdown = value; }

  ~Messages();
  
signals:
  void click2OnCallsign(QString hiscall, QString t2, bool ctrl);
  void errorOccurred(const QString &error);  // Emitted on error
  void sendLocalStationData(QString const& call, QString const& grid, QString const& antenna, QString const& rigInformation);
  void sendRemoteStationData (QString const& call, QString const& grid, quint64 freq, QString const& mode, int snr, QDateTime qSpotTime);
  void sendLocalStationData2(QString const& call, QString const& grid, QString const& theUrl);
  void sendRemoteStationData2 (QByteArray const& postByteArray, QString const& theUrl);

protected:  
  void closeEvent(QCloseEvent *event);
  
private slots:
  void selectCallsign2(bool ctrl);
  void on_cbCQ_toggled(bool checked);
  void on_cbCQstar_toggled(bool checked);
  void onFinished(QNetworkReply *reply);     // Handles the reply from web request

private:
  Ui::Messages *ui;
  QString m_settings_filename;
  QString m_t;
  QString m_t2;
  QString m_colorBackground;
  QString m_color0;
  QString m_color1;
  QString m_color2;
  QString m_color3;
  
  QThread* pskThread; 
  QThread* livecqThread; 

  bool m_closingForShutdown = false;
  bool m_cqOnly;
  bool m_cqStarOnly;
  bool doLiveCQ=true; //liveCQ
  void CreateLiveCQ(QStringList cqliveText);  //liveCQ
  void sendPSKReporterData(QStringList decodeList);  //PSKReporter
  void sendLiveCQData(QStringList decodeList);  // This will trigger the web request
  void initializePSKReporting();
  bool testCall(QString w);  //liveCQ

  QString w3szUrlAddr="https://w3sz.com/livecq_update.php"; //liveCQ

};

#endif