forked from jtdx-project/jtdx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Configuration.cpp
5785 lines (5316 loc) · 347 KB
/
Configuration.cpp
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
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#include "Configuration.hpp"
//
// Read me!
//
// This file defines a configuration dialog with the user. The general
// strategy is to expose agreed configuration parameters via a custom
// interface (See Configuration.hpp). The state exposed through this
// public interface reflects stored or derived data in the
// Configuration::impl object. The Configuration::impl structure is
// an implementation of the PIMPL (a.k.a. Cheshire Cat or compilation
// firewall) implementation hiding idiom that allows internal state to
// be completely removed from the public interface.
//
// There is a secondary level of parameter storage which reflects
// current settings UI state, these parameters are not copied to the
// state store that the public interface exposes until the
// Configuration:impl::accept() operation is successful. The accept()
// operation is tied to the settings OK button. The normal and most
// convenient place to store this intermediate settings UI state is in
// the data models of the UI controls, if that is not convenient then
// separate member variables must be used to store that state. It is
// important for the user experience that no publicly visible settings
// are changed while the settings UI are changed i.e. all settings
// changes must be deferred until the "OK" button is
// clicked. Conversely, all changes must be discarded if the settings
// UI "Cancel" button is clicked.
//
// There is a complication related to the radio interface since the
// this module offers the facility to test the radio interface. This
// test means that the public visibility to the radio being tested
// must be changed. To maintain the illusion of deferring changes
// until they are accepted, the original radio related settings are
// stored upon showing the UI and restored if the UI is dismissed by
// canceling.
//
// It should be noted that the settings UI lives as long as the
// application client that uses it does. It is simply shown and hidden
// as it is needed rather than creating it on demand. This strategy
// saves a lot of expensive UI drawing at the expense of a little
// storage and gives a convenient place to deliver settings values
// from.
//
// Here is an overview of the high level flow of this module:
//
// 1) On construction the initial environment is initialized and
// initial values for settings are read from the QSettings
// database. At this point default values for any new settings are
// established by providing a default value to the QSettings value
// queries. This should be the only place where a hard coded value for
// a settings item is defined. Any remaining one-time UI
// initialization is also done. At the end of the constructor a method
// initialize_models() is called to load the UI with the current
// settings values.
//
// 2) When the settings UI is displayed by a client calling the exec()
// operation, only temporary state need be stored as the UI state will
// already mirror the publicly visible settings state.
//
// 3) As the user makes changes to the settings UI only validation
// need be carried out since the UI control data models are used as
// the temporary store of unconfirmed settings. As some settings will
// depend on each other a validate() operation is available, this
// operation implements a check of any complex multi-field values.
//
// 4) If the user discards the settings changes by dismissing the UI
// with the "Cancel" button; the reject() operation is called. The
// reject() operation calls initialize_models() which will revert all
// the UI visible state to the values as at the initial exec()
// operation. No changes are moved into the data fields in
// Configuration::impl that reflect the settings state published by
// the public interface (Configuration.hpp).
//
// 5) If the user accepts the settings changes by dismissing the UI
// with the "OK" button; the accept() operation is called which calls
// the validate() operation again and, if it passes, the fields that
// are used to deliver the settings state are updated from the UI
// control models or other temporary state variables. At the end of
// the accept() operation, just before hiding the UI and returning
// control to the caller; the new settings values are stored into the
// settings database by a call to the write_settings() operation, thus
// ensuring that settings changes are saved even if the application
// crashes or is subsequently killed.
//
// 6) On destruction, which only happens when the application
// terminates, the settings are saved to the settings database by
// calling the write_settings() operation. This is largely redundant
// but is still done to save the default values of any new settings on
// an initial run.
//
// To add a new setting:
//
// 1) Update the UI with the new widget to view and change the value.
//
// 2) Add a member to Configuration::impl to store the accepted
// setting state. If the setting state is dynamic; add a new signal to
// broadcast the setting value.
//
// 3) Add a query method to the public interface (Configuration.hpp)
// to access the new setting value. If the settings is dynamic; this
// step is optional since value changes will be broadcast via a
// signal.
//
// 4) Add a forwarding operation to implement the new query (3) above.
//
// 5) Add a settings read call to read_settings() with a sensible
// default value. If the setting value is dynamic, add a signal emit
// call to broadcast the setting value change.
//
// 6) Add code to initialize_models() to load the widget control's
// data model with the current value.
//
// 7) If there is no convenient data model field, add a data member to
// store the proposed new value. Ensure this member has a valid value
// on exit from read_settings().
//
// 8) Add any required inter-field validation to the validate()
// operation.
//
// 9) Add code to the accept() operation to extract the setting value
// from the widget control data model and load it into the
// Configuration::impl member that reflects the publicly visible
// setting state. If the setting value is dynamic; add a signal emit
// call to broadcast any changed state of the setting.
//
// 10) Add a settings write call to save the setting value to the
// settings database.
//
#include <stdexcept>
#include <iterator>
#include <algorithm>
#include <functional>
#include <limits>
#include <cmath>
#include <QApplication>
#include <QMetaType>
#include <QList>
#include <QSettings>
#include <QAudioDeviceInfo>
#include <QAudioInput>
#include <QDialog>
#include <QAction>
#include <QFileDialog>
#include <QFileSystemModel>
#include <QDir>
#include <QTemporaryFile>
#include <QFormLayout>
#include <QString>
#include <QStringList>
#include <QStringListModel>
#include <QLineEdit>
#include <QRegExpValidator>
#include <QIntValidator>
#include <QThread>
#include <QTimer>
#include <QStandardPaths>
#include <QFont>
#include <QFontDialog>
#include <QColorDialog>
#include <QSerialPortInfo>
#include <QScopedPointer>
#include <QDebug>
#include <QtGui>
#include "qt_helpers.hpp"
#include "MetaDataRegistry.hpp"
#include "SettingsGroup.hpp"
#include "FrequencyLineEdit.hpp"
#include "FrequencyDeltaLineEdit.hpp"
#include "CandidateKeyFilter.hpp"
#include "ForeignKeyDelegate.hpp"
#include "FrequencyDelegate.hpp"
#include "FrequencyDeltaDelegate.hpp"
#include "TransceiverFactory.hpp"
#include "Transceiver.hpp"
#include "Bands.hpp"
#include "IARURegions.hpp"
#include "Modes.hpp"
#include "FrequencyList.hpp"
#include "StationList.hpp"
#include "NetworkServerLookup.hpp"
#include "JTDXMessageBox.hpp"
#include "pimpl_impl.hpp"
#include "ui_Configuration.h"
#include "moc_Configuration.cpp"
namespace
{
// these undocumented flag values when stored in (Qt::UserRole - 1)
// of a ComboBox item model index allow the item to be enabled or
// disabled
int const combo_box_item_enabled (32 | 1);
int const combo_box_item_disabled (0);
QRegExp message_alphabet {"[- @A-Za-z0-9+./?#<>&^]*"};
// Magic numbers for file validation
constexpr quint32 qrg_magic {0xadbccbdb};
constexpr quint32 qrg_version {101}; // M.mm
}
//
// Dialog to get a new Frequency item
//
class FrequencyDialog final
: public QDialog
{
Q_OBJECT;
public:
using Item = FrequencyList_v2::Item;
explicit FrequencyDialog (IARURegions * regions_model, Modes * modes_model, QWidget * parent = nullptr)
: QDialog {parent}
{
setWindowTitle (QApplication::applicationName () + " - " +
tr ("Add Frequency"));
region_combo_box_.setModel (regions_model);
mode_combo_box_.setModel (modes_model);
auto form_layout = new QFormLayout ();
form_layout->addRow (tr ("IARU &Region:"), ®ion_combo_box_);
form_layout->addRow (tr ("&Mode:"), &mode_combo_box_);
form_layout->addRow (tr ("&Frequency (MHz):"), &frequency_line_edit_);
auto main_layout = new QVBoxLayout (this);
main_layout->addLayout (form_layout);
auto button_box = new QDialogButtonBox {QDialogButtonBox::Ok | QDialogButtonBox::Cancel};
button_box->button(QDialogButtonBox::Ok)->setText(tr("&OK"));
button_box->button(QDialogButtonBox::Cancel)->setText(tr("&Cancel"));
main_layout->addWidget (button_box);
connect (button_box, &QDialogButtonBox::accepted, this, &FrequencyDialog::accept);
connect (button_box, &QDialogButtonBox::rejected, this, &FrequencyDialog::reject);
}
Item item () const
{
return {frequency_line_edit_.frequency (), Modes::value (mode_combo_box_.currentText ()), IARURegions::value (region_combo_box_.currentText ()),false};
}
private:
QComboBox region_combo_box_;
QComboBox mode_combo_box_;
FrequencyLineEdit frequency_line_edit_;
};
//
// Dialog to get a new Station item
//
class StationDialog final
: public QDialog
{
Q_OBJECT;
public:
explicit StationDialog (StationList const * stations, Bands * bands, QWidget * parent = nullptr)
: QDialog {parent}
, filtered_bands_ {new CandidateKeyFilter {bands, stations, 0, 0}}
{
setWindowTitle (QApplication::applicationName () + " - " + tr ("Add Station"));
band_.setModel (filtered_bands_.data ());
auto form_layout = new QFormLayout ();
form_layout->addRow (tr ("&Band:"), &band_);
form_layout->addRow (tr ("&Offset (MHz):"), &delta_);
form_layout->addRow (tr ("&Antenna:"), &description_);
auto main_layout = new QVBoxLayout (this);
main_layout->addLayout (form_layout);
auto button_box = new QDialogButtonBox {QDialogButtonBox::Ok | QDialogButtonBox::Cancel};
button_box->button(QDialogButtonBox::Ok)->setText(tr("&OK"));
button_box->button(QDialogButtonBox::Cancel)->setText(tr("&Cancel"));
main_layout->addWidget (button_box);
connect (button_box, &QDialogButtonBox::accepted, this, &StationDialog::accept);
connect (button_box, &QDialogButtonBox::rejected, this, &StationDialog::reject);
if (delta_.text ().isEmpty ())
{
delta_.setText ("0");
}
}
StationList::Station station () const
{
return {band_.currentText (), delta_.frequency_delta (), description_.text ()};
}
int exec () override
{
filtered_bands_->set_active_key ();
return QDialog::exec ();
}
private:
QScopedPointer<CandidateKeyFilter> filtered_bands_;
QComboBox band_;
FrequencyDeltaLineEdit delta_;
QLineEdit description_;
};
class RearrangableMacrosModel
: public QStringListModel
{
public:
Qt::ItemFlags flags (QModelIndex const& index) const override
{
auto flags = QStringListModel::flags (index);
if (index.isValid ())
{
// disallow drop onto existing items
flags &= ~Qt::ItemIsDropEnabled;
}
return flags;
}
};
//
// Class MessageItemDelegate
//
// Item delegate for message entry such as free text message macros.
//
class MessageItemDelegate final
: public QStyledItemDelegate
{
public:
explicit MessageItemDelegate (QObject * parent = nullptr)
: QStyledItemDelegate {parent}
{
}
QWidget * createEditor (QWidget * parent
, QStyleOptionViewItem const& /* option*/
, QModelIndex const& /* index */
) const override
{
auto editor = new QLineEdit {parent};
editor->setFrame (false);
editor->setValidator (new QRegExpValidator {message_alphabet, editor});
return editor;
}
};
// Internal implementation of the Configuration class.
class Configuration::impl final
: public QDialog
{
Q_OBJECT;
public:
using FrequencyDelta = Radio::FrequencyDelta;
using port_type = Configuration::port_type;
explicit impl (Configuration * self, QSettings * settings, QWidget * parent);
~impl ();
bool have_rig ();
void transceiver_frequency (Frequency);
void transceiver_tx_frequency (Frequency);
void transceiver_mode (MODE);
void transceiver_ptt (bool);
void transceiver_ft4_mode (bool);
void sync_transceiver (bool force_signal);
Q_SLOT int exec () override;
Q_SLOT void accept () override;
Q_SLOT void reject () override;
Q_SLOT void done (int) override;
private:
typedef QList<QAudioDeviceInfo> AudioDevices;
void read_settings ();
void write_settings ();
bool load_audio_devices (QAudio::Mode, QComboBox *, QAudioDeviceInfo *);
void update_audio_channels (QComboBox const *, int, QComboBox *, bool);
void set_application_font (QFont const&);
void initialize_models ();
bool split_mode () const
{
return
(WSJT_RIG_NONE_CAN_SPLIT || !rig_is_dummy_) &&
(rig_params_.split_mode != TransceiverFactory::split_mode_none);
}
void set_cached_mode ();
bool open_rig (bool force = false);
//bool set_mode ();
void close_rig ();
TransceiverFactory::ParameterPack gather_rig_data ();
void enumerate_rigs ();
void set_rig_invariants ();
bool validate ();
void message_box_critical (QString const& reason, QString const& detail = QString ());
void fill_port_combo_box (QComboBox *);
Frequency apply_calibration (Frequency) const;
Frequency remove_calibration (Frequency) const;
void delete_frequencies ();
void load_frequencies ();
void merge_frequencies ();
void save_frequencies ();
void reset_frequencies ();
void insert_frequency ();
FrequencyList_v2::FrequencyItems read_frequencies_file (QString const&);
void delete_stations ();
void insert_station ();
Q_SLOT void on_font_push_button_clicked ();
Q_SLOT void on_decoded_text_font_push_button_clicked ();
Q_SLOT void on_PTT_port_combo_box_activated (int);
Q_SLOT void on_CAT_port_combo_box_activated (int);
Q_SLOT void on_CAT_serial_baud_combo_box_currentIndexChanged (int);
Q_SLOT void on_CAT_data_bits_button_group_buttonClicked (int);
Q_SLOT void on_CAT_stop_bits_button_group_buttonClicked (int);
Q_SLOT void on_CAT_handshake_button_group_buttonClicked (int);
Q_SLOT void on_CAT_poll_interval_spin_box_valueChanged (int);
Q_SLOT void on_split_mode_button_group_buttonClicked (int);
Q_SLOT void on_test_CAT_push_button_clicked ();
Q_SLOT void on_test_PTT_push_button_clicked (bool checked);
Q_SLOT void on_force_DTR_combo_box_currentIndexChanged (int);
Q_SLOT void on_force_RTS_combo_box_currentIndexChanged (int);
Q_SLOT void on_rig_combo_box_currentIndexChanged (int);
Q_SLOT void on_sound_input_combo_box_currentTextChanged (QString const&);
Q_SLOT void on_sound_output_combo_box_currentTextChanged (QString const&);
Q_SLOT void on_add_macro_push_button_clicked (bool = false);
Q_SLOT void on_delete_macro_push_button_clicked (bool = false);
Q_SLOT void on_PTT_method_button_group_buttonClicked (int);
Q_SLOT void on_callsign_line_edit_textChanged ();
Q_SLOT void on_grid_line_edit_textChanged ();
Q_SLOT void on_content_line_edit_textChanged(QString const&);
Q_SLOT void on_countries_line_edit_textChanged(QString const&);
Q_SLOT void on_callsigns_line_edit_textChanged(QString const&);
Q_SLOT void on_add_macro_line_edit_editingFinished ();
Q_SLOT void delete_macro ();
void delete_selected_macros (QModelIndexList);
Q_SLOT void on_save_path_select_push_button_clicked (bool);
Q_SLOT void on_content_reset_push_button_clicked ();
Q_SLOT void on_countries_clear_push_button_clicked ();
Q_SLOT void on_callsigns_clear_push_button_clicked ();
Q_SLOT void handle_transceiver_update (TransceiverState const&, unsigned sequence_number);
Q_SLOT void handle_transceiver_failure (QString const& reason);
Q_SLOT void on_countryName_check_box_clicked(bool checked);
Q_SLOT void on_callNotif_check_box_clicked(bool checked);
Q_SLOT void on_otherMessagesMarker_check_box_clicked(bool checked);
Q_SLOT void on_RR73_marker_check_box_clicked(bool checked);
Q_SLOT void on_redMarker_check_box_clicked(bool checked);
Q_SLOT void on_ShowCQ_check_box_clicked(bool checked);
Q_SLOT void on_ShowCQRRR73_check_box_clicked(bool checked);
Q_SLOT void on_ShowCQ73_check_box_clicked(bool checked);
Q_SLOT void on_prompt_to_log_check_box_clicked(bool checked);
Q_SLOT void on_autolog_check_box_clicked(bool checked);
Q_SLOT void on_write_decoded_check_box_clicked(bool checked);
Q_SLOT void on_write_decoded_debug_check_box_clicked(bool checked);
Q_SLOT void on_txtColor_check_box_clicked(bool checked);
Q_SLOT void on_workedStriked_check_box_clicked(bool checked);
Q_SLOT void on_workedUnderlined_check_box_clicked(bool checked);
Q_SLOT void on_workedColor_check_box_clicked(bool checked);
Q_SLOT void on_workedDontShow_check_box_clicked(bool checked);
Q_SLOT void on_newCQZ_check_box_clicked(bool checked);
Q_SLOT void on_newITUZ_check_box_clicked(bool checked);
Q_SLOT void on_newDXCC_check_box_clicked(bool checked);
Q_SLOT void on_newCall_check_box_clicked(bool checked);
Q_SLOT void on_newPx_check_box_clicked(bool checked);
Q_SLOT void on_newGrid_check_box_clicked(bool checked);
Q_SLOT void on_newCQZBand_check_box_clicked(bool checked);
Q_SLOT void on_newITUZBand_check_box_clicked(bool checked);
Q_SLOT void on_newDXCCBand_check_box_clicked(bool checked);
Q_SLOT void on_newCallBand_check_box_clicked(bool checked);
Q_SLOT void on_newPxBand_check_box_clicked(bool checked);
Q_SLOT void on_newGridBand_check_box_clicked(bool checked);
Q_SLOT void on_newCQZBandMode_check_box_clicked(bool checked);
Q_SLOT void on_newITUZBandMode_check_box_clicked(bool checked);
Q_SLOT void on_newDXCCBandMode_check_box_clicked(bool checked);
Q_SLOT void on_newCallBandMode_check_box_clicked(bool checked);
Q_SLOT void on_newPxBandMode_check_box_clicked(bool checked);
Q_SLOT void on_newGridBandMode_check_box_clicked(bool checked);
Q_SLOT void on_newPotential_check_box_clicked(bool checked);
Q_SLOT void on_eqsluser_edit_textEdited(const QString &arg1);
Q_SLOT void on_eqslpasswd_edit_textEdited(const QString &arg1);
Q_SLOT void on_eqslnick_edit_textEdited(const QString &arg1);
Q_SLOT void on_pbCQmsg_clicked();
Q_SLOT void on_pbMyCall_clicked();
Q_SLOT void on_pbTxMsg_clicked();
Q_SLOT void on_pbNewCQZ_clicked();
Q_SLOT void on_pbNewCQZBand_clicked();
Q_SLOT void on_pbNewITUZ_clicked();
Q_SLOT void on_pbNewITUZBand_clicked();
Q_SLOT void on_pbNewDXCC_clicked();
Q_SLOT void on_pbNewDXCCBand_clicked();
Q_SLOT void on_pbNewCall_clicked();
Q_SLOT void on_pbNewCallBand_clicked();
Q_SLOT void on_pbNewPx_clicked();
Q_SLOT void on_pbNewPxBand_clicked();
Q_SLOT void on_pbNewGrid_clicked();
Q_SLOT void on_pbNewGridBand_clicked();
Q_SLOT void on_pbStandardCall_clicked();
Q_SLOT void on_pbWorkedCall_clicked();
Q_SLOT void on_hhComboBox_1_currentIndexChanged (int);
Q_SLOT void on_mmComboBox_1_currentIndexChanged (int);
Q_SLOT void on_hhComboBox_2_currentIndexChanged (int);
Q_SLOT void on_mmComboBox_2_currentIndexChanged (int);
Q_SLOT void on_hhComboBox_3_currentIndexChanged (int);
Q_SLOT void on_mmComboBox_3_currentIndexChanged (int);
Q_SLOT void on_hhComboBox_4_currentIndexChanged (int);
Q_SLOT void on_mmComboBox_4_currentIndexChanged (int);
Q_SLOT void on_hhComboBox_5_currentIndexChanged (int);
Q_SLOT void on_mmComboBox_5_currentIndexChanged (int);
Q_SLOT void on_bandComboBox_1_currentIndexChanged (QString const&);
Q_SLOT void on_bandComboBox_2_currentIndexChanged (QString const&);
Q_SLOT void on_bandComboBox_3_currentIndexChanged (QString const&);
Q_SLOT void on_bandComboBox_4_currentIndexChanged (QString const&);
Q_SLOT void on_bandComboBox_5_currentIndexChanged (QString const&);
// typenames used as arguments must match registered type names :(
Q_SIGNAL void start_transceiver (unsigned seqeunce_number) const;
Q_SIGNAL void set_transceiver (Transceiver::TransceiverState const&,
unsigned sequence_number) const;
Q_SIGNAL void stop_transceiver () const;
Configuration * const self_; // back pointer to public interface
QThread * transceiver_thread_;
TransceiverFactory transceiver_factory_;
QList<QMetaObject::Connection> rig_connections_;
QScopedPointer<Ui::configuration_dialog> ui_;
QSettings * settings_;
JTDXDateTime * jtdxtime_;
QDir doc_dir_;
QDir data_dir_;
QDir temp_dir_;
QDir default_save_directory_;
QDir save_directory_;
QFont font_ = QGuiApplication::font ();
QFont next_font_;
QFont decoded_text_font_;
QFont next_decoded_text_font_;
bool restart_sound_input_device_;
bool restart_sound_output_device_;
Type2MsgGen type_2_msg_gen_;
QStringListModel macros_;
RearrangableMacrosModel next_macros_;
QAction * macro_delete_action_;
Bands bands_;
IARURegions regions_;
IARURegions::Region region_;
Modes modes_;
FrequencyList_v2 frequencies_;
FrequencyList_v2 next_frequencies_;
StationList stations_;
StationList next_stations_;
FrequencyDelta current_offset_;
FrequencyDelta current_tx_offset_;
QAction * frequency_delete_action_;
QAction * frequency_insert_action_;
QAction * load_frequencies_action_;
QAction * save_frequencies_action_;
QAction * merge_frequencies_action_;
QAction * reset_frequencies_action_;
FrequencyDialog * frequency_dialog_;
QAction * station_delete_action_;
QAction * station_insert_action_;
StationDialog * station_dialog_;
TransceiverFactory::ParameterPack rig_params_;
TransceiverFactory::ParameterPack saved_rig_params_;
TransceiverFactory::Capabilities::PortType last_port_type_;
bool rig_is_dummy_;
bool rig_active_;
bool have_rig_;
bool rig_changed_;
TransceiverState cached_rig_state_;
int rig_resolution_; // see Transceiver::resolution signal
double frequency_calibration_intercept_;
double frequency_calibration_slope_ppm_;
unsigned transceiver_command_number_;
// configuration fields that we publish
QString my_callsign_;
QString my_grid_;
QString timeFrom_;
QString content_;
QString countries_;
QString callsigns_;
QColor color_CQ_;
QColor next_color_CQ_;
QColor color_MyCall_;
QColor next_color_MyCall_;
QColor color_TxMsg_;
QColor next_color_TxMsg_;
QColor color_NewCQZ_;
QColor next_color_NewCQZ_;
QColor color_NewCQZBand_;
QColor next_color_NewCQZBand_;
QColor color_NewITUZ_;
QColor next_color_NewITUZ_;
QColor color_NewITUZBand_;
QColor next_color_NewITUZBand_;
QColor color_NewDXCC_;
QColor next_color_NewDXCC_;
QColor color_NewDXCCBand_;
QColor next_color_NewDXCCBand_;
QColor color_NewGrid_;
QColor next_color_NewGrid_;
QColor color_NewGridBand_;
QColor next_color_NewGridBand_;
QColor color_NewPx_;
QColor next_color_NewPx_;
QColor color_NewPxBand_;
QColor next_color_NewPxBand_;
QColor color_NewCall_;
QColor next_color_NewCall_;
QColor color_NewCallBand_;
QColor next_color_NewCallBand_;
QColor color_StandardCall_;
QColor next_color_StandardCall_;
QColor color_WorkedCall_;
QColor next_color_WorkedCall_;
qint32 id_interval_;
qint32 ntrials_;
qint32 ntrials10_;
qint32 ntrialsrxf10_;
qint32 npreampass_;
qint32 aggressive_;
qint32 harmonicsdepth_;
qint32 nsingdecatt_;
qint32 ntopfreq65_;
qint32 nAnswerCQCounter_;
qint32 nAnswerInCallCounter_;
qint32 nSentRReportCounter_;
qint32 nSentRR7373Counter_;
double txDelay_;
bool fmaskact_;
bool answerCQCount_;
bool answerInCallCount_;
bool sentRReportCount_;
bool sentRR7373Count_;
bool strictdirCQ_;
bool halttxreplyother_;
bool hidefree_;
bool hide2ndHash_;
bool showcq_;
bool showcqrrr73_;
bool showcq73_;
bool enableContent_;
bool enableCountryFilter_;
bool enableCallsignFilter_;
bool do_snr_;
bool do_pwr_;
bool rig_power_;
bool id_after_73_;
bool tx_QSY_allowed_;
bool spot_to_psk_reporter_;
bool spot_to_dxsummit_;
bool prevent_spotting_false_;
bool filterUDP_;
bool send_to_eqsl_;
QString eqsl_username_;
QString eqsl_passwd_;
QString eqsl_nickname_;
bool usesched_;
QString sched_hh_1_;
QString sched_mm_1_;
QString sched_band_1_;
bool sched_mix_1_;
QString sched_hh_2_;
QString sched_mm_2_;
QString sched_band_2_;
bool sched_mix_2_;
QString sched_hh_3_;
QString sched_mm_3_;
QString sched_band_3_;
bool sched_mix_3_;
QString sched_hh_4_;
QString sched_mm_4_;
QString sched_band_4_;
bool sched_mix_4_;
QString sched_hh_5_;
QString sched_mm_5_;
QString sched_band_5_;
bool sched_mix_5_;
bool monitor_off_at_startup_;
bool monitor_last_used_;
bool log_as_RTTY_;
bool report_in_comments_;
bool prompt_to_log_;
bool autolog_;
bool insert_blank_;
bool useDarkStyle_;
bool countryName_;
bool countryPrefix_;
bool callNotif_;
bool gridNotif_;
bool otherMessagesMarker_;
bool RR73Marker_;
bool redMarker_;
bool blueMarker_;
bool txtColor_;
bool workedColor_;
bool workedStriked_;
bool workedUnderlined_;
bool workedDontShow_;
bool newCQZ_;
bool newCQZBand_;
bool newCQZBandMode_;
bool newITUZ_;
bool newITUZBand_;
bool newITUZBandMode_;
bool newDXCC_;
bool newDXCCBand_;
bool newDXCCBandMode_;
bool newCall_;
bool newCallBand_;
bool newCallBandMode_;
bool newPx_;
bool newPxBand_;
bool newPxBandMode_;
bool newGrid_;
bool newGridBand_;
bool newGridBandMode_;
bool newPotential_;
bool hideAfrica_;
bool hideAntarctica_;
bool hideAsia_;
bool hideEurope_;
bool hideOceania_;
bool hideNAmerica_;
bool hideSAmerica_;
bool next_txtColor_;
bool next_workedColor_;
bool next_workedStriked_;
bool next_workedUnderlined_;
bool next_workedDontShow_;
bool next_newCQZ_;
bool next_newCQZBand_;
bool next_newCQZBandMode_;
bool next_newITUZ_;
bool next_newITUZBand_;
bool next_newITUZBandMode_;
bool next_newDXCC_;
bool next_newDXCCBand_;
bool next_newDXCCBandMode_;
bool next_newCall_;
bool next_newCallBand_;
bool next_newCallBandMode_;
bool next_newPx_;
bool next_newPxBand_;
bool next_newPxBandMode_;
bool next_newGrid_;
bool next_newGridBand_;
bool next_newGridBandMode_;
bool next_newPotential_;
bool clear_DX_;
bool clear_DX_exit_;
bool miles_;
int watchdog_;
int tunetimer_;
bool TX_messages_;
bool hide_TX_messages_;
bool decode_at_52s_;
bool beepOnMyCall_;
bool beepOnNewCQZ_;
bool beepOnNewITUZ_;
bool beepOnNewDXCC_;
bool beepOnNewGrid_;
bool beepOnNewCall_;
bool beepOnNewPx_;
bool beepOnFirstMsg_;
QString udp_server_name_;
port_type udp_server_port_;
QString tcp_server_name_;
port_type tcp_server_port_;
QString udp2_server_name_;
port_type udp2_server_port_;
bool accept_udp_requests_;
bool enable_udp1_adif_sending_;
bool enable_tcp_connection_;
bool enable_udp2_broadcast_;
bool write_decoded_;
bool write_decoded_debug_;
bool udpWindowToFront_;
bool udpWindowRestore_;
DataMode data_mode_;
bool pwrBandTxMemory_;
bool pwrBandTuneMemory_;
QAudioDeviceInfo audio_input_device_;
bool default_audio_input_device_selected_;
AudioDevice::Channel audio_input_channel_;
QAudioDeviceInfo audio_output_device_;
bool default_audio_output_device_selected_;
AudioDevice::Channel audio_output_channel_;
friend class Configuration;
};
#include "Configuration.moc"
// delegate to implementation class
Configuration::Configuration (QSettings * settings, QWidget * parent)
: m_ {this, settings, parent}
{
}
Configuration::~Configuration ()
{
}
QDir Configuration::doc_dir () const {return m_->doc_dir_;}
QDir Configuration::data_dir () const {return m_->data_dir_;}
QDir Configuration::temp_dir () const {return m_->temp_dir_;}
int Configuration::exec () {return m_->exec ();}
bool Configuration::is_active () const {return m_->isVisible ();}
QAudioDeviceInfo const& Configuration::audio_input_device () const {return m_->audio_input_device_;}
AudioDevice::Channel Configuration::audio_input_channel () const {return m_->audio_input_channel_;}
QAudioDeviceInfo const& Configuration::audio_output_device () const {return m_->audio_output_device_;}
AudioDevice::Channel Configuration::audio_output_channel () const {return m_->audio_output_channel_;}
bool Configuration::restart_audio_input () const {return m_->restart_sound_input_device_;}
bool Configuration::restart_audio_output () const {return m_->restart_sound_output_device_;}
auto Configuration::type_2_msg_gen () const -> Type2MsgGen {return m_->type_2_msg_gen_;}
QString Configuration::my_callsign () const {return m_->my_callsign_;}
QString Configuration::my_grid () const {return m_->my_grid_;}
QString Configuration::timeFrom () const {return m_->timeFrom_;}
QString Configuration::content () const {return m_->content_;}
QString Configuration::countries () const {return m_->countries_;}
QString Configuration::callsigns () const {return m_->callsigns_;}
QString Configuration::hideContinents () const
{
QString result;
if (m_->hideAfrica_) result.append("AF");
if (m_->hideAntarctica_) result.append("AN");
if (m_->hideEurope_) result.append("EU");
if (m_->hideAsia_) result.append("AS");
if (m_->hideSAmerica_) result.append("SA");
if (m_->hideOceania_) result.append("OC");
if (m_->hideNAmerica_) result.append("NA");
return result;
}
QColor Configuration::color_CQ () const {return m_->color_CQ_;}
QColor Configuration::color_MyCall () const {return m_->color_MyCall_;}
QColor Configuration::color_TxMsg () const {return m_->color_TxMsg_;}
QColor Configuration::color_NewCQZ () const {return m_->color_NewCQZ_;}
QColor Configuration::color_NewCQZBand () const {return m_->color_NewCQZBand_;}
QColor Configuration::color_NewITUZ () const {return m_->color_NewITUZ_;}
QColor Configuration::color_NewITUZBand () const {return m_->color_NewITUZBand_;}
QColor Configuration::color_NewDXCC () const {return m_->color_NewDXCC_;}
QColor Configuration::color_NewDXCCBand () const {return m_->color_NewDXCCBand_;}
QColor Configuration::color_NewGrid () const {return m_->color_NewGrid_;}
QColor Configuration::color_NewGridBand () const {return m_->color_NewGridBand_;}
QColor Configuration::color_NewCall () const {return m_->color_NewCall_;}
QColor Configuration::color_NewCallBand () const {return m_->color_NewCallBand_;}
QColor Configuration::color_NewPx () const {return m_->color_NewPx_;}
QColor Configuration::color_NewPxBand () const {return m_->color_NewPxBand_;}
QColor Configuration::color_StandardCall () const {return m_->color_StandardCall_;}
QColor Configuration::color_WorkedCall () const {return m_->color_WorkedCall_;}
QFont Configuration::decoded_text_font () const {return m_->decoded_text_font_;}
qint32 Configuration::id_interval () const {return m_->id_interval_;}
qint32 Configuration::ntrials() const {return m_->ntrials_;}
qint32 Configuration::ntrials10() const {return m_->ntrials10_;}
qint32 Configuration::ntrialsrxf10() const {return m_->ntrialsrxf10_;}
qint32 Configuration::npreampass() const {return m_->npreampass_;}
qint32 Configuration::aggressive() const {return m_->aggressive_;}
qint32 Configuration::harmonicsdepth() const {return m_->harmonicsdepth_;}
qint32 Configuration::nsingdecatt() const {return m_->nsingdecatt_;}
qint32 Configuration::ntopfreq65() const {return m_->ntopfreq65_;}
qint32 Configuration::nAnswerCQCounter() const {return m_->nAnswerCQCounter_;}
qint32 Configuration::nAnswerInCallCounter() const {return m_->nAnswerInCallCounter_;}
qint32 Configuration::nSentRReportCounter() const {return m_->nSentRReportCounter_;}
qint32 Configuration::nSentRR7373Counter() const {return m_->nSentRR7373Counter_;}
double Configuration::txDelay() const {return m_->txDelay_;}
bool Configuration::fmaskact () const {return m_->fmaskact_;}
bool Configuration::answerCQCount () const {return m_->answerCQCount_;}
bool Configuration::answerInCallCount () const {return m_->answerInCallCount_;}
bool Configuration::sentRReportCount () const {return m_->sentRReportCount_;}
bool Configuration::sentRR7373Count () const {return m_->sentRR7373Count_;}
bool Configuration::strictdirCQ () const {return m_->strictdirCQ_;}
bool Configuration::halttxreplyother () const {return m_->halttxreplyother_;}
bool Configuration::hidefree () const {return m_->hidefree_;}
bool Configuration::hide2ndHash () const {return m_->hide2ndHash_;}
bool Configuration::showcq () const {return m_->showcq_;}
bool Configuration::showcqrrr73 () const {return m_->showcqrrr73_;}
bool Configuration::showcq73 () const {return m_->showcq73_;}
bool Configuration::enableContent () const {return m_->enableContent_;}
bool Configuration::enableCountryFilter () const {return m_->enableCountryFilter_;}
bool Configuration::enableCallsignFilter () const {return m_->enableCallsignFilter_;}
bool Configuration::do_snr () const {return m_->do_snr_;}
bool Configuration::do_pwr () const {return m_->do_pwr_;}
bool Configuration::rig_power () const {return m_->rig_power_;}
bool Configuration::id_after_73 () const {return m_->id_after_73_;}
bool Configuration::tx_QSY_allowed () const {return m_->tx_QSY_allowed_;}
bool Configuration::spot_to_psk_reporter () const
{
// rig must be open and working to spot externally
return is_transceiver_online () && m_->spot_to_psk_reporter_;
}
bool Configuration::spot_to_dxsummit () const {return m_->spot_to_dxsummit_;}
bool Configuration::prevent_spotting_false () const {return m_->prevent_spotting_false_;}
bool Configuration::filterUDP () const {return m_->filterUDP_;}
bool Configuration::monitor_off_at_startup () const {return m_->monitor_off_at_startup_;}
bool Configuration::monitor_last_used () const {return m_->rig_is_dummy_ || m_->monitor_last_used_;}
bool Configuration::log_as_RTTY () const {return m_->log_as_RTTY_;}
bool Configuration::send_to_eqsl () const {return m_->send_to_eqsl_;}
QString Configuration::eqsl_username () const {return m_->eqsl_username_;}
QString Configuration::eqsl_passwd () const {return m_->eqsl_passwd_;}
QString Configuration::eqsl_nickname () const {return m_->eqsl_nickname_;}
bool Configuration::usesched () const {return m_->usesched_;}
QString Configuration::sched_hh_1 () const {return m_->sched_hh_1_;}
QString Configuration::sched_mm_1 () const {return m_->sched_mm_1_;}
QString Configuration::sched_band_1 () const {return m_->sched_band_1_;}
bool Configuration::sched_mix_1 () const {return m_->sched_mix_1_;}
QString Configuration::sched_hh_2 () const {return m_->sched_hh_2_;}
QString Configuration::sched_mm_2 () const {return m_->sched_mm_2_;}
QString Configuration::sched_band_2 () const {return m_->sched_band_2_;}
bool Configuration::sched_mix_2 () const {return m_->sched_mix_2_;}
QString Configuration::sched_hh_3 () const {return m_->sched_hh_3_;}
QString Configuration::sched_mm_3 () const {return m_->sched_mm_3_;}
QString Configuration::sched_band_3 () const {return m_->sched_band_3_;}
bool Configuration::sched_mix_3 () const {return m_->sched_mix_3_;}
QString Configuration::sched_hh_4 () const {return m_->sched_hh_4_;}
QString Configuration::sched_mm_4 () const {return m_->sched_mm_4_;}
QString Configuration::sched_band_4 () const {return m_->sched_band_4_;}
bool Configuration::sched_mix_4 () const {return m_->sched_mix_4_;}
QString Configuration::sched_hh_5 () const {return m_->sched_hh_5_;}
QString Configuration::sched_mm_5 () const {return m_->sched_mm_5_;}
QString Configuration::sched_band_5 () const {return m_->sched_band_5_;}
bool Configuration::sched_mix_5 () const {return m_->sched_mix_5_;}
bool Configuration::report_in_comments () const {return m_->report_in_comments_;}
bool Configuration::prompt_to_log () const {return m_->prompt_to_log_;}
bool Configuration::autolog () const {return m_->autolog_;}
bool Configuration::insert_blank () const {return m_->insert_blank_;}
bool Configuration::useDarkStyle () const {return m_->useDarkStyle_;}
bool Configuration::countryName () const {return m_->countryName_;}
bool Configuration::countryPrefix () const {return m_->countryPrefix_;}
bool Configuration::callNotif () const {return m_->callNotif_;}
bool Configuration::gridNotif () const {return m_->gridNotif_;}
bool Configuration::otherMessagesMarker () const {return m_->otherMessagesMarker_;}
bool Configuration::RR73Marker () const {return m_->RR73Marker_;}
bool Configuration::redMarker () const {return m_->redMarker_;}
bool Configuration::blueMarker () const {return m_->blueMarker_;}
bool Configuration::txtColor () const {return m_->txtColor_;}
bool Configuration::workedColor () const {return m_->workedColor_;}
bool Configuration::workedStriked () const {return m_->workedStriked_;}
bool Configuration::workedUnderlined () const {return m_->workedUnderlined_;}
bool Configuration::workedDontShow () const {return m_->workedDontShow_;}
bool Configuration::newCQZ () const {return m_->newCQZ_;}
bool Configuration::newCQZBand () const {return m_->newCQZBand_;}
bool Configuration::newCQZBandMode () const {return m_->newCQZBandMode_;}
bool Configuration::newITUZ () const {return m_->newITUZ_;}
bool Configuration::newITUZBand () const {return m_->newITUZBand_;}
bool Configuration::newITUZBandMode () const {return m_->newITUZBandMode_;}
bool Configuration::newDXCC () const {return m_->newDXCC_;}
bool Configuration::newDXCCBand () const {return m_->newDXCCBand_;}
bool Configuration::newDXCCBandMode () const {return m_->newDXCCBandMode_;}
bool Configuration::newCall () const {return m_->newCall_;}
bool Configuration::newCallBand () const {return m_->newCallBand_;}
bool Configuration::newCallBandMode () const {return m_->newCallBandMode_;}
bool Configuration::newPx () const {return m_->newPx_;}
bool Configuration::newPxBand () const {return m_->newPxBand_;}
bool Configuration::newPxBandMode () const {return m_->newPxBandMode_;}
bool Configuration::newGrid () const {return m_->newGrid_;}
bool Configuration::newGridBand () const {return m_->newGridBand_;}
bool Configuration::newGridBandMode () const {return m_->newGridBandMode_;}
bool Configuration::newPotential () const {return m_->newPotential_;}
bool Configuration::clear_DX () const {return m_->clear_DX_;}
bool Configuration::clear_DX_exit () const {return m_->clear_DX_exit_;}