summaryrefslogtreecommitdiff
path: root/qmap/mainwindow.h
blob: 7ad76d5cc29919e1696fac2a71db02b2afcd07e1 (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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QtGui>
#include <QtWidgets>
#include <QPointer>
#include <QScopedPointer>
#include <QLabel>
#include <QDateTime>
#include <QHash>
#include <memory>
#include "getfile.h"
#include "soundin.h"
#include "signalmeter.h"
#include "commons.h"
#include "sleep.h"
#include <QtConcurrent/QtConcurrent>

#define NFFT 32768
#define NSMAX 5760000

//--------------------------------------------------------------- MainWindow
namespace Ui {
  class MainWindow;
}

class QTimer;
class Astro;
class WideGraph;
class VertWaterfall;
class LiveCQUpload;
enum class DecodeClickGesture;

class MainWindow : public QMainWindow
{
  Q_OBJECT

public:
  explicit MainWindow(QWidget *parent = 0);
  ~MainWindow();
  bool m_network;

public slots:
  void showSoundInError(const QString& errorMsg);
  void showStatusMessage(const QString& statusMsg);
  void dataSink(int k);
  void diskDat(int iret);
  void decoderFinished();
  void freezeDecode(int n);
  void decodeLabelClicked(QByteArray decodeRow, DecodeClickGesture gesture);
  void guiUpdate();

private:
  virtual void keyPressEvent (QKeyEvent *) override;
  virtual bool eventFilter (QObject *, QEvent *) override;
  virtual void closeEvent (QCloseEvent *) override;

private slots:
  void on_monitorButton_clicked();
  void on_stopButton_clicked();
  void on_actionExit_triggered();
  void on_actionAbout_triggered();
  void on_actionLinrad_triggered();
  void on_actionCuteSDR_triggered();
  void on_tolSpinBox_valueChanged(int arg1);
  void on_actionAstro_Data_triggered();
  void on_actionWide_Waterfall_triggered();
  void on_actionVertical_Waterfall_triggered();
  void on_actionOpen_triggered();
  void on_actionOpen_next_in_directory_triggered();
  void on_actionDecode_remaining_files_in_directory_triggered();
  void on_actionDelete_all_iq_files_in_SaveDir_triggered();
  void on_actionNone_triggered();
  void on_actionSave_all_triggered();
  void on_DecodeButton_clicked();
  void decode();
  void decodeBusy(bool b);
  void on_EraseButton_clicked();
  void bumpDF(int n);
  void on_actionSettings_triggered();
  void on_NBcheckBox_toggled(bool checked);
  void on_NBslider_valueChanged(int value);
  void on_actionAFMHot_triggered();
  void on_actionBlue_triggered();
  void on_actionQ65A_triggered();
  void on_actionQ65B_triggered();
  void on_actionQ65C_triggered();
  void on_actionQ65D_triggered();
  void on_actionQ65E_triggered();
  void on_actionQuick_Start_Guide_to_Q65_triggered();
  void on_actionCopyright_Notice_triggered();
  void on_actionTrademark_Policy_triggered();
  void on_actionQuick_Start_Guide_to_WSJT_X_2_7_and_QMAP_triggered();
  void on_actionAlso_Q65_30x_toggled(bool b);
  void on_sbMaxDrift_valueChanged(int arg1);
  void on_actionSave_decoded_triggered();
  void on_actionExport_wav_file_at_fQSO_triggered();
  void on_actionExport_wav_file_at_fQSO_30a_triggered();
  void on_actionExport_wav_file_at_fQSO_30b_triggered();
  void on_actionFadd_controls_triggered();
  void on_fAddComboBox_activated();
  void on_pbSet_clicked();
  void on_pbAdd_clicked();

private:
  Ui::MainWindow *ui;
  QString m_appDir;
  QString m_dataDir;
  QString m_settings_filename;
  QScopedPointer<Astro> m_astro_window;
  QScopedPointer<WideGraph> m_wide_graph_window;
  QScopedPointer<VertWaterfall> m_vert_waterfall_window;
  QPointer<QTimer> m_gui_timer;
  qint32  m_waterfallAvg;
  qint32  m_DF;
  qint32  m_tol;
  qint32  m_astroFont;
  qint32  m_fCal;
  qint32  m_sec0;
  qint32  m_nutc0;
  qint32  m_nrx;
  qint32  m_hsym0;
  qint32  m_paInDevice;
  qint32  m_udpPort;
  qint32  m_NBslider;
  qint32  m_TRperiod;
  qint32  m_modeQ65;
  qint32  m_dB;
  qint32  m_fetched=0;
  qint32  m_hsymStop=390;             //390*0.15 = 58.5 s
  qint32  m_nTx30a=0;
  qint32  m_nTx30b=0;
  qint32  m_nTx60=0;
  qint32  m_nDoubleClicked=0;
  qint32  m_nline=0;
  qint32  m_WSJTX_TRperiod=0;
  qint32  m_dop00=0;
  qint32  m_dop58=0;
  qint32  m_n60;

  double  m_fAdd;
  double  m_xavg;

  bool    m_monitoring;
  bool    m_diskData;
  bool    m_loopall;
  bool    m_decoderBusy=false;
  bool    m_restart;
  bool    m_startAnother;
  bool    m_saveAll;
  bool    m_saveDecoded;
  bool    m_NB;
  bool    m_decode_called=false;
  bool    m_bAlso30=true;
  bool    m_bDiskDatBusy=false;
  bool    m_bWTransmitting=false;
  bool    m_bDecodeAgain=false;
  
  bool    m_w3szUrl = true; //liveCQ
  QString m_otherUrl="";    //liveCQ
  QString w3szUrlAddr="https://w3sz.com/livecq_update.php"; //liveCQ

  float   m_pctZap;

  int     m_myCallColor;

  QRect   m_wideGraphGeom;

  QLabel* lab1;                            // labels in status bar
  QLabel* lab2;                            // labels in status bar
  QLabel* lab3;                            // labels in status bar
  QLabel* lab4;
  QLabel* lab5;
  QLabel* lab6;
  QLabel* lab7;                   //Why still needed?

  QMessageBox msgBox0;

  QFutureWatcher<void> watcher3;     //For decoder

  QString m_path;
  QString m_pbdecoding_style1;
  QString m_pbmonitor_style;
  QString m_pbmonitor_style2;
  QString m_pbAutoOn_style;
  QString m_myCall;
  QString m_myGrid;
  QString m_hisCall;
  QString m_hisGrid;
  QString m_saveDir;
  QString m_azelDir;
  QString m_palette;
  QString m_dateTime;
  QString m_mode;
  QString m_UTC0="";
  QString m_revision;
  QString m_saveFileName;

  QDateTime m_dateTimeSeqStart;        //Nominal start time of Rx sequence about to be decoded
  QHash<QString,bool> m_worked;
  SignalMeter *xSignalMeter;
  SoundInThread soundInThread;             //Instantiate the audio threads
  bool doLiveCQ = true;  //liveCQ
  QFile *cqlfi;          //liveCQ
  std::unique_ptr<LiveCQUpload> m_livecq;

  //---------------------------------------------------- private functions
  void readSettings();
  void writeSettings();
  void createStatusBar();
  void updateStatusBar();
  void msgBox(QString t);
  bool isGrid4(QString g);
  void clearDecodeLabels();
  void CreateLiveCQ(QStringList cqliveText);           //liveCQ
  void sendLiveCQData(QList<QStringList> decodeList);  //liveCQ
};

extern void getfile(QString fname, bool xpol, int idInt);
extern void save_iq(QString fname);
extern int killbyname(const char* progName);

extern "C" {
//----------------------------------------------------- C and Fortran routines
  void symspec_(int* k, int* ndiskdat, int* nb, int* m_NBslider, int* nfsample,
                float* px, float s[], int* nkhz, int* nhsym,
                int* nzap, float* slimit, uchar lstrong[]);

  void astrosub00_ (int* nyear, int* month, int* nday, double* uth, int* nfreq,
                    const char* mygrid, int* ndop00, int len1);

  void q65c_();

  void all_done_();

  void zaptx_(float d4[], int* k0, int* k);

  void save_qm_(const char* fname, const char* prog_id, const char* mycall, const char* mygrid,
                float d4[], int* ntx30a, int* ntx30b, double* fcenter, int* nutc,
                int* dop00, int* dop58, int len1, int len2, int len3, int len4);

  void read_qm_(const char* fname, int* iret, int len);

  }

#endif // MAINWINDOW_H