SoDaRadio-5.0.3-master:8901fb5
main_setup_mid.cpp
Go to the documentation of this file.
1 /*
2 Copyright (c) 2017 Matthew H. Reilly (kb1vc)
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are
7 met:
8 
9  Redistributions of source code must retain the above copyright
10  notice, this list of conditions and the following disclaimer.
11  Redistributions in binary form must reproduce the above copyright
12  notice, this list of conditions and the following disclaimer in
13  the documentation and/or other materials provided with the
14  distribution.
15 
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28 
29 #include "mainwindow.hpp"
30 #include "ui_mainwindow.h"
31 #include <iostream>
32 #include <boost/format.hpp>
33 #include "soda_comboboxes.hpp"
34 #include "soda_listener.hpp"
35 
37 {
38  // These controls include band selection, PTT, TX display,
39  // antenna selection, CW QSO buttons, and the navigation panel
40 
42  [this](const QString & v){
43  ui->RXAnt_sel->addItem(v); });
45  [this](const QString & v){
46  ui->TXAnt_sel->addItem(v); });
47 
48  connect(ui->RXAnt_sel, SIGNAL(currentTextChanged(const QString &)),
49  listener, SLOT(setRXAnt(const QString &)));
50  connect(ui->TXAnt_sel, SIGNAL(currentTextChanged(const QString &)),
51  listener, SLOT(setTXAnt(const QString &)));
52 
53  connect(ui->PTT_btn, SIGNAL(toggled(bool)),
54  listener, SLOT(setPTT(bool)));
55 
57  [=](bool on) { ui->TXState_lab->setText(on ? "TX ON" : "TX OFF"); });
58 
59  connect(ui->CWCurLine_le, &QLineEdit::returnPressed,
60  [=]()
61  { ui->CWOutBound_te->appendPlainText(ui->CWCurLine_le->text());
62  listener->sendCW(ui->CWCurLine_le->text());
63  ui->CWCurLine_le->clear(); });
64 
65 
66  connect(ui->ClrBuff_btn, SIGNAL(released()),
67  listener, SLOT(clearCWBuffer()));
68 
69  connect(ui->MyCall_btn, &QPushButton::pressed,
70  [=]() {
71  int i;
72  for(i = 0; i < ui->RptCount_spin->value(); i++) {
73  sendCannedCW(ui->FromCall_le->text());
74  }
75  });
76 
77  connect(ui->MyGrid_btn, &QPushButton::pressed,
78  [=]() {
79  int i;
80  for(i = 0; i < ui->RptCount_spin->value(); i++) {
81  sendCannedCW(ui->FromGrid_le->text());
82  }
83  });
84 
85  connect(ui->MyInfo_btn, &QPushButton::pressed,
86  [=]() {
87  int i;
88  for(i = 0; i < ui->RptCount_spin->value(); i++) {
89  sendCannedCW(" " + ui->FromCall_le->text());
90  }
91  for(i = 0; i < ui->RptCount_spin->value(); i++) {
92  sendCannedCW(" " + ui->FromGrid_le->text());
93  }
94  });
95 
96  connect(ui->Exchange_btn, &QPushButton::pressed,
97  [=]() {
98  int i;
99  for(i = 0; i < ui->RptCount_spin->value(); i++) {
100  sendCannedCW(" " + ui->ToCall_le->text());
101  }
102  sendCannedCW(" de ");
103  for(i = 0; i < ui->RptCount_spin->value(); i++) {
104  sendCannedCW(" " + ui->FromCall_le->text());
105  }
106  for(i = 0; i < ui->RptCount_spin->value(); i++) {
107  sendCannedCW(" " + ui->FromGrid_le->text());
108  }
109  });
110 
111  connect(ui->CWV_btn, &QPushButton::pressed,
112  [=]() {
113  int i;
114  for(i = 0; i < ui->RptCount_spin->value(); i++) {
115  sendCannedCW("VVVVVVVVVVVV");
116  }
117  });
118 
119  connect(ui->CW73_btn, &QPushButton::pressed,
120  [=]() {
121  sendCannedCW(" TNX es 73 de " + ui->FromCall_le->text());
122  });
123 
124  connect(ui->CWQSL_btn, &QPushButton::pressed,
125  [=]() {
126  sendCannedCW(" R R R QSL QSL QSL de " + ui->FromCall_le->text());
127  });
128 
129  connect(ui->CWBK_btn, &QPushButton::pressed,
130  [=]() {
131  sendCannedCW(" _bk ");
132  });
133 }
134 
135 void MainWindow::sendCannedCW(const QString & txt)
136 {
137  listener->sendCW(txt);
138  ui->CWOutBound_te->appendPlainText(txt);
139 }
GUISoDa::Listener * listener
Definition: mainwindow.hpp:151
Ui::MainWindow * ui
Definition: mainwindow.hpp:149
void sendCW(const QString &txt)
void repPTT(bool on)
void addTXAntName(const QString &ant_name)
void setupMidControls()
void sendCannedCW(const QString &txt)
void addRXAntName(const QString &ant_name)