30 #include "ui_mainwindow.h" 32 #include <boost/version.hpp> 33 #include <uhd/version.hpp> 35 #include <boost/format.hpp> 38 #include <QMessageBox> 39 #include <QtCoreVersion> 43 #include "../common/GuiParams.hxx" 71 [=](
const QString & hw) {
72 this->setWindowTitle(QString(
"SoDa Radio V %1 -- SDR %2").arg(SoDaRadio_VERSION).arg(hw));
75 connect(
listener, SIGNAL(initSetupComplete()),
78 connect(
listener, SIGNAL(fatalError(
const QString &)),
84 connect(
ui->aboutSoDa_btn, SIGNAL(clicked(
bool)),
87 settings_p =
new QSettings(
"kb1vc.org",
"SoDaRadioQT",
this);
109 QMessageBox::about(
this, QString(
"SoDaRadio"),
110 QString(
"<h1>SoDaRadio</h1> \ 111 <p>An all-mode SDR application for the Ettus USRP platform.</p> \ 113 <li>SoDaRadio Version: %1</li><li>Git ID: %2</li>\ 114 <li>USRP Hardware Driver Version: %3</li>\ 115 <li>Qt Version: %4</li> \ 116 <li>Boost Version: %5</li> \ 117 <li>Sources and Such: https://kb1vc.github.io/SoDaRadio/</li> \ 118 <li>Maintainer: kb1vc@kb1vc.org</li> \ 122 Copyright (c) 2017 Matthew H. Reilly (kb1vc) \ 123 All rights reserved.</p> \ 124 <p>Redistribution and use in source and binary forms, with or without \ 125 modification, are permitted provided that the following conditions are \ 127 <p><b>Redistributions of source code must retain the above copyright \ 128 notice, this list of conditions and the following disclaimer. \ 129 Redistributions in binary form must reproduce the above copyright \ 130 notice, this list of conditions and the following disclaimer in \ 131 the documentation and/or other materials provided with the \ 132 distribution.</b></p> \ 133 <p>THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \ 134 \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT \ 135 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR \ 136 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT \ 137 HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, \ 138 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT \ 139 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, \ 140 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY \ 141 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT \ 142 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE \ 143 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ 144 </p>").arg(SoDaRadio_VERSION).arg(SoDaRadio_GIT_ID).arg(UHD_VERSION_ABI_STRING).arg(QTCORE_VERSION_STR).arg(BOOST_LIB_VERSION));
149 QObjectList wlist = op->children();
150 for(QObjectList::iterator cp = wlist.begin(); cp != wlist.end(); ++cp) {
151 QString my_name = (*cp)->objectName();
152 QString my_class = (*cp)->metaObject()->className();
154 QString my_pathname = par +
"." + my_name;
155 if(my_class ==
"QComboBox") {
156 if(QComboBox * cb = qobject_cast<QComboBox*>(*cp)) {
158 int ci = cb->currentIndex();
163 int nvalue =
settings_p->value(my_pathname, 0).toInt();
164 cb->setCurrentIndex(nvalue);
168 else if(my_class ==
"QSlider") {
169 if(QSlider * cb = qobject_cast<QSlider*>(*cp)) {
171 double cv = cb->value();
176 double nvalue =
settings_p->value(my_pathname, 0).toDouble();
177 cb->setValue(nvalue);
181 else if(my_class ==
"GUISoDa::FreqLabel") {
182 if(
FreqLabel * cb = qobject_cast<FreqLabel *>(*cp)) {
184 double cv = cb->getFreq();
189 double nvalue =
settings_p->value(my_pathname, 144.2e6).toDouble();
190 cb->setFreqUpdate(nvalue);
194 else if(my_class ==
"QCheckBox") {
195 if(QCheckBox * cb = qobject_cast<QCheckBox *>(*cp)) {
197 bool cv = cb->isChecked();
202 bool nvalue =
settings_p->value(my_pathname, 0).toBool();
203 cb->setChecked(nvalue);
207 else if((my_class ==
"QSpinBox") || (my_class ==
"SoDaNoEditSpinbox")) {
208 if(QSpinBox * cb = qobject_cast<QSpinBox*>(*cp)) {
210 int cv = cb->value();
215 int nvalue =
settings_p->value(my_pathname, 0).toInt();
216 cb->setValue(nvalue);
220 else if(my_class ==
"QLineEdit") {
221 if(QLineEdit * cb = qobject_cast<QLineEdit*>(*cp)) {
223 QString cv = cb->text();
228 QString nvalue =
settings_p->value(my_pathname,
"").toString();
233 else if(my_class ==
"GUISoDa::WFall") {
236 double cv = cb->freqCenter();
241 double nvalue =
settings_p->value(my_pathname, 0).toDouble();
242 cb->setFreqCenter(nvalue);
246 else if(my_class ==
"GUISoDa::Spect") {
249 double cv = cb->freqCenter();
254 double nvalue =
settings_p->value(my_pathname, 0).toDouble();
255 cb->setFreqCenter(nvalue);
259 else if(my_class ==
"GUISoDa::IntValComboBox") {
262 int cv = cb->value();
267 int nvalue =
settings_p->value(my_pathname, 0).toInt();
268 cb->setValue(nvalue);
272 else if((my_class ==
"GUISoDa::WFallSpanComboBox") ||
273 (my_class ==
"GUISoDa::WFallDynRangeComboBox")) {
276 double cv = cb->value();
281 double nvalue =
settings_p->value(my_pathname, 0).toDouble();
282 cb->setValue(nvalue);
286 else if(my_class ==
"QTabBar") {
287 if(QTabBar * cb = qobject_cast<QTabBar*>(*cp)) {
289 int cv = cb->currentIndex();
294 int nvalue =
settings_p->value(my_pathname, 0).toInt();
295 cb->setCurrentIndex(nvalue);
299 else if((my_class ==
"QAction") ||
300 (my_class ==
"QBoxLayout") ||
301 (my_class ==
"QDoubleValidator") ||
302 (my_class ==
"QFormLayout") ||
303 (my_class ==
"QGroupBox") ||
304 (my_class ==
"QHBoxLayout") ||
305 (my_class ==
"QHeaderView") ||
306 (my_class ==
"QItemSelectionModel") ||
307 (my_class ==
"QLabel") ||
308 (my_class ==
"QLocalSocket") ||
309 (my_class ==
"QMainWindowLayout") ||
310 (my_class ==
"QNativeSocketEngine") ||
311 (my_class ==
"QPlainTextDocumentLayout") ||
312 (my_class ==
"QPlainTextEdit") ||
313 (my_class ==
"QPlainTextEditControl") ||
314 (my_class ==
"QPropertyAnimation") ||
315 (my_class ==
"QPushButton") ||
316 (my_class ==
"QScrollBar") ||
317 (my_class ==
"QSettings") ||
318 (my_class ==
"QSocketNotifier") ||
319 (my_class ==
"QSplitter") ||
320 (my_class ==
"QSplitterHandle") ||
321 (my_class ==
"QStackedLayout") ||
322 (my_class ==
"QStackedWidget") ||
323 (my_class ==
"QStandardItemModel") ||
324 (my_class ==
"QStyledItemDelegate") ||
325 (my_class ==
"QTableCornerButton") ||
326 (my_class ==
"QTableModel") ||
327 (my_class ==
"QTabWidget") ||
328 (my_class ==
"QTcpSocket") ||
329 (my_class ==
"QTextDocument") ||
330 (my_class ==
"QTextDocumentLayout") ||
331 (my_class ==
"QTextFrame") ||
332 (my_class ==
"QTextImageHandler") ||
333 (my_class ==
"QToolButton") ||
334 (my_class ==
"QValidator") ||
335 (my_class ==
"QVBoxLayout") ||
336 (my_class ==
"QWidget") ||
337 (my_class ==
"QWidgetLineControl") ||
338 (my_class ==
"QWidgetTextControl") ||
339 (my_class ==
"QwtPlotCanvas") ||
340 (my_class ==
"QwtPlotPicker") ||
341 (my_class ==
"QwtScaleWidget") ||
342 (my_class ==
"QwtTextLabel")) {
359 QMessageBox mbox(QMessageBox::Critical,
361 tr(
"%1 has encountered an error that is beyond safe recovery.\n" 362 "Please press OK button to quit. (Though this is -not- OK.\n" 363 "Send a note when you get a chance to kb1vc@kb1vc.org").arg(qApp->applicationDisplayName()),
364 QMessageBox::Ok,
this);
365 mbox.setDetailedText(err_string);
GUISoDa::Listener * listener
QString auto_bandswitch_target
MainWindow(QWidget *parent, SoDa::GuiParams ¶ms)
void handleFatalError(const QString &err_string)
pop up a notification box and then bail out.
bool init()
connect to radio server sockets and initialize listener state
void displayAppInfo(bool dummy)
void widgetSaveRestore(QObject *op, const QString &par, bool save)
void repHWMBVersion(const QString &version)
GUISoDa::HamlibServer * hlib_server
void start()
initiate transfers on the socket.
GUISoDa::BandMap band_map
void bandMapSaveRestore(GUISoDa::BandMap &bmap, bool save)
QString current_band_selector