source: ntrip/trunk/BNS/bnswindow.cpp@ 1728

Last change on this file since 1728 was 1728, checked in by weber, 13 years ago

* empty log message *

File size: 49.6 KB
Line 
1
2/* -------------------------------------------------------------------------
3 * BKG NTRIP Server
4 * -------------------------------------------------------------------------
5 *
6 * Class: bnsWindow
7 *
8 * Purpose: This class implements the main application window.
9 *
10 * Author: L. Mervart
11 *
12 * Created: 29-Mar-2008
13 *
14 * Changes:
15 *
16 * -----------------------------------------------------------------------*/
17
18#include <iostream>
19
20#include "bnswindow.h"
21#include "bnshlpdlg.h"
22#include "bnssettings.h"
23
24using namespace std;
25
26// About Dialog - Constructor
27////////////////////////////////////////////////////////////////////////////
28bnsAboutDlg::bnsAboutDlg(QWidget* parent) :
29 QDialog(parent) {
30
31 QTextBrowser* tb = new QTextBrowser;
32 QUrl url; url.setPath(":bnsabout.html");
33 tb->setSource(url);
34 tb->setReadOnly(true);
35
36 int ww = QFontMetrics(font()).width('w');
37 QPushButton* _closeButton = new QPushButton("Close");
38 _closeButton->setMaximumWidth(10*ww);
39 connect(_closeButton, SIGNAL(clicked()), this, SLOT(close()));
40
41 QGridLayout* dlgLayout = new QGridLayout();
42 QLabel* img = new QLabel();
43 img->setPixmap(QPixmap(":ntrip-logo.png"));
44 dlgLayout->addWidget(img, 0,0);
45 dlgLayout->addWidget(new QLabel("BKG Ntrip State Space Server (BNS) Version 1.1"), 0,1);
46 dlgLayout->addWidget(tb,1,0,1,2);
47 dlgLayout->addWidget(_closeButton,2,1,Qt::AlignRight);
48
49 setLayout(dlgLayout);
50 resize(60*ww, 60*ww);
51 show();
52}
53
54// About Dialog - Destructor
55////////////////////////////////////////////////////////////////////////////
56bnsAboutDlg::~bnsAboutDlg() {
57};
58
59// Flowchart Dialog - Constructor
60////////////////////////////////////////////////////////////////////////////
61bnsFlowchartDlg::bnsFlowchartDlg(QWidget* parent) :
62 QDialog(parent) {
63
64 int ww = QFontMetrics(font()).width('w');
65 QPushButton* _closeButton = new QPushButton("Close");
66 _closeButton->setMaximumWidth(10*ww);
67 connect(_closeButton, SIGNAL(clicked()), this, SLOT(close()));
68
69 QGridLayout* dlgLayout = new QGridLayout();
70 QLabel* img = new QLabel();
71 img->setPixmap(QPixmap(":bnsflowchart.png"));
72 dlgLayout->addWidget(img, 0,0);
73 dlgLayout->addWidget(_closeButton,1,0,Qt::AlignLeft);
74
75 setLayout(dlgLayout);
76 show();
77}
78
79// Flowchart Dialog - Destructor
80////////////////////////////////////////////////////////////////////////////
81bnsFlowchartDlg::~bnsFlowchartDlg() {
82};
83
84// Constructor
85////////////////////////////////////////////////////////////////////////////
86bnsWindow::bnsWindow() {
87
88 _bns = 0;
89
90 bnsSettings settings;
91 QPalette palette;
92 QColor lightGray(230, 230, 230);
93
94 QString fontString = settings.value("font").toString();
95 if ( !fontString.isEmpty() ) {
96 QFont newFont;
97 if (newFont.fromString(fontString)) {
98 QApplication::setFont(newFont);
99 }
100 }
101
102 int ww = QFontMetrics(this->font()).width('w');
103 setMinimumSize(77*ww, 65*ww);
104 setWindowTitle(tr("BKG Ntrip State Space Server (BNS) Version 1.1"));
105 setWindowIcon(QPixmap(":ntrip-logo.png"));
106
107 // Create Actions
108 // --------------
109 _actHelp = new QAction(tr("&Help Contents"),this);
110 connect(_actHelp, SIGNAL(triggered()), SLOT(slotHelp()));
111
112 _actAbout = new QAction(tr("&About BNS"),this);
113 connect(_actAbout, SIGNAL(triggered()), SLOT(slotAbout()));
114
115 _actFlowchart = new QAction(tr("&Flow Chart"),this);
116 connect(_actFlowchart, SIGNAL(triggered()), SLOT(slotFlowchart()));
117
118 _actFontSel = new QAction(tr("Select &Font"),this);
119 connect(_actFontSel, SIGNAL(triggered()), SLOT(slotFontSel()));
120
121 _actSaveOpt = new QAction(tr("&Save Options"),this);
122 connect(_actSaveOpt, SIGNAL(triggered()), SLOT(slotSaveOptions()));
123
124 _actQuit = new QAction(tr("&Quit"),this);
125 connect(_actQuit, SIGNAL(triggered()), SLOT(close()));
126
127 _actWhatsThis= new QAction(tr("Help=Shift+F1"),this);
128 connect(_actWhatsThis, SIGNAL(triggered()), SLOT(slotWhatsThis()));
129
130 _actStart = new QAction(tr("Sta&rt"),this);
131 connect(_actStart, SIGNAL(triggered()), SLOT(slotStart()));
132
133 _actStop = new QAction(tr("Sto&p"),this);
134 connect(_actStop, SIGNAL(triggered()), SLOT(slotStop()));
135 _actStop->setEnabled(false);
136
137 CreateMenu();
138 AddToolbar();
139
140 // Canvas with Editable Fields
141 // ---------------------------
142 _canvas = new QWidget;
143 setCentralWidget(_canvas);
144
145 // Proxy Options
146 // -------------
147 _proxyHostLineEdit = new QLineEdit(settings.value("proxyHost").toString());
148 _proxyPortLineEdit = new QLineEdit(settings.value("proxyPort").toString());
149
150 // General Options
151 // ---------------
152 _logFileLineEdit = new QLineEdit(settings.value("logFile").toString());
153 _fileAppendCheckBox = new QCheckBox();
154 _fileAppendCheckBox->setCheckState(Qt::CheckState(settings.value("fileAppend").toInt()));
155 _autoStartCheckBox = new QCheckBox();
156 _autoStartCheckBox->setCheckState(Qt::CheckState(
157 settings.value("autoStart").toInt()));
158
159 // RINEX Ephemeris Options
160 // -----------------------
161 _ephHostLineEdit = new QLineEdit(settings.value("ephHost").toString());
162 _ephPortLineEdit = new QLineEdit(settings.value("ephPort").toString());
163 _ephEchoLineEdit = new QLineEdit(settings.value("ephEcho").toString());
164
165 // Clocks & Orbits Options
166 // -----------------------
167 _clkPortLineEdit = new QLineEdit(settings.value("clkPort").toString());
168 _inpEchoLineEdit = new QLineEdit(settings.value("inpEcho").toString());
169
170
171 // Broadcast Corrections I Options
172 // -------------------------------
173 _outHost_1_LineEdit = new QLineEdit(settings.value("outHost1").toString());
174 _outPort_1_LineEdit = new QLineEdit(settings.value("outPort1").toString());
175 _password_1_LineEdit = new QLineEdit(settings.value("password1").toString());
176 _password_1_LineEdit->setEchoMode(QLineEdit::Password);
177 _mountpoint_1_LineEdit = new QLineEdit(settings.value("mountpoint_1").toString());
178 _refSys_1_ComboBox = new QComboBox;
179 _refSys_1_ComboBox->setEditable(false);
180 _refSys_1_ComboBox->addItems(QString("IGS05,ETRF2000").split(","));
181 int ii = _refSys_1_ComboBox->findText(settings.value("refSys_1").toString());
182 if (ii != -1) {
183 _refSys_1_ComboBox->setCurrentIndex(ii);
184 }
185 _outFile_1_LineEdit = new QLineEdit(settings.value("outFile_1").toString());
186 _beClocks1CheckBox = new QCheckBox();
187 _beClocks1CheckBox->setCheckState(Qt::CheckState(settings.value("beClocks1").toInt()));
188
189 // Broadcast Corrections II Options
190 // --------------------------------
191 _outHost_2_LineEdit = new QLineEdit(settings.value("outHost2").toString());
192 _outPort_2_LineEdit = new QLineEdit(settings.value("outPort2").toString());
193 _password_2_LineEdit = new QLineEdit(settings.value("password2").toString());
194 _password_2_LineEdit->setEchoMode(QLineEdit::Password);
195 _mountpoint_2_LineEdit = new QLineEdit(settings.value("mountpoint_2").toString());
196 _refSys_2_ComboBox = new QComboBox;
197 _refSys_2_ComboBox->setEditable(false);
198 _refSys_2_ComboBox->addItems(QString("IGS05,ETRF2000").split(","));
199 ii = _refSys_2_ComboBox->findText(settings.value("refSys_2").toString());
200 if (ii != -1) {
201 _refSys_2_ComboBox->setCurrentIndex(ii);
202 }
203 _outFile_2_LineEdit = new QLineEdit(settings.value("outFile_2").toString());
204 _beClocks2CheckBox = new QCheckBox();
205 _beClocks2CheckBox->setCheckState(Qt::CheckState(settings.value("beClocks2").toInt()));
206
207 // Broadcast Corrections III Options
208 // ---------------------------------
209 _outHost_3_LineEdit = new QLineEdit(settings.value("outHost3").toString());
210 _outPort_3_LineEdit = new QLineEdit(settings.value("outPort3").toString());
211 _password_3_LineEdit = new QLineEdit(settings.value("password3").toString());
212 _password_3_LineEdit->setEchoMode(QLineEdit::Password);
213 _mountpoint_3_LineEdit = new QLineEdit(settings.value("mountpoint_3").toString());
214 _refSys_3_ComboBox = new QComboBox;
215 _refSys_3_ComboBox->setEditable(false);
216 _refSys_3_ComboBox->addItems(QString("IGS05,ETRF2000").split(","));
217 ii = _refSys_3_ComboBox->findText(settings.value("refSys_3").toString());
218 if (ii != -1) {
219 _refSys_3_ComboBox->setCurrentIndex(ii);
220 }
221 _outFile_3_LineEdit = new QLineEdit(settings.value("outFile_3").toString());
222 _beClocks3CheckBox = new QCheckBox();
223 _beClocks3CheckBox->setCheckState(Qt::CheckState(settings.value("beClocks3").toInt()));
224
225 // RINEX Clocks Options
226 // --------------------
227 _rnxPathLineEdit = new QLineEdit(settings.value("rnxPath").toString());
228 _rnxIntrComboBox = new QComboBox;
229 _rnxIntrComboBox->setEditable(false);
230 _rnxIntrComboBox->addItems(QString("1 min,2 min,5 min,10 min,15 min,30 min,1 hour,1 day").split(","));
231 ii = _rnxIntrComboBox->findText(settings.value("rnxIntr").toString());
232 if (ii != -1) {
233 _rnxIntrComboBox->setCurrentIndex(ii);
234 }
235 _rnxSamplSpinBox = new QSpinBox;
236 _rnxSamplSpinBox->setMinimum(0);
237 _rnxSamplSpinBox->setMaximum(60);
238 _rnxSamplSpinBox->setSingleStep(5);
239 _rnxSamplSpinBox->setMaximumWidth(9*ww);
240 _rnxSamplSpinBox->setValue(settings.value("rnxSampl").toInt());
241 _rnxSamplSpinBox->setSuffix(" sec");
242
243 // SP3 Orbits Options
244 // ------------------
245 _sp3PathLineEdit = new QLineEdit(settings.value("sp3Path").toString());
246 _sp3IntrComboBox = new QComboBox;
247 _sp3IntrComboBox->setEditable(false);
248 _sp3IntrComboBox->addItems(QString("1 min,2 min,5 min,10 min,15 min,30 min,1 hour,1 day").split(","));
249 ii = _sp3IntrComboBox->findText(settings.value("sp3Intr").toString());
250 if (ii != -1) {
251 _sp3IntrComboBox->setCurrentIndex(ii);
252 }
253 _sp3SamplSpinBox = new QSpinBox;
254 _sp3SamplSpinBox->setMinimum(0);
255 _sp3SamplSpinBox->setMaximum(900);
256 _sp3SamplSpinBox->setSingleStep(60);
257 _sp3SamplSpinBox->setMaximumWidth(9*ww);
258 _sp3SamplSpinBox->setValue(settings.value("sp3Sampl").toInt());
259 _sp3SamplSpinBox->setSuffix(" sec");
260
261 // Whats This
262 // ----------
263 _proxyHostLineEdit->setWhatsThis(tr("<p>If you are running BNS within a protected Local Area Network (LAN), you might need to use a proxy server to access the Internet. Enter your proxy server IP and port number in case one is operated in front of BNS. If you do not know the IP and port of your proxy server, check the proxy server settings in your Internet browser or ask your network administrator.</p><p>Note that IP streaming is sometimes not allowed in a LAN. In this case you need to ask your network administrator for an appropriate modification of the local security policy or for the installation of a TCP relay to the NTRIP broadcasters. If these are not possible, you might need to run BNS outside your LAN on a network that has unobstructed connection to the Internet.</p>"));
264 _proxyPortLineEdit->setWhatsThis(tr("<p>Enter your proxy server port number in case one is operated in front of BNS.</p>"));
265 _logFileLineEdit->setWhatsThis(tr("<p>Records of BNS activities are shown in the Log section on the bottom of this window. They can be saved into a file when a valid path is specified in the 'Logfile (full path)' field.</p>"));
266 _fileAppendCheckBox->setWhatsThis(tr("<p>When BNS is started, new files are created by default and any existing files with the same name will be overwritten. However, users might want to append already existing files following a restart of BNS, a system crash or when BNS crashed. Tick 'Append files' to continue with existing files and keep what has been recorded so far.</p>"));
267 _inpEchoLineEdit->setWhatsThis(tr("Specify the full path to a file where incoming clocks and orbits are saved. Beware that the size of this file can rapidly increase. Default is an empty option field meaning that incoming clocks and orbits are not saved."));
268 _ephHostLineEdit->setWhatsThis(tr("BNS reads Broadcast Ephemeris in RINEX Version 3 Navigation file format from an IP address. Specify the host IP e.g. of a BNC installation providing this information."));
269 _ephPortLineEdit->setWhatsThis(tr("BNS reads Broadcast Ephemeris in RINEX Version 3 Navigation file format from an IP address. Specify the IP port e.g. of a BNC installation providing this information."));
270 _ephEchoLineEdit->setWhatsThis(tr("Specify the full path to a file where incoming Broadcast Ephemeris are saved. Beware that the size of this file can rapidly increase. Default is an empty option field meaning that incoming Broadcast Ephemeris are not saved."));
271 _clkPortLineEdit->setWhatsThis(tr("BNS reads Clocks & Orbits referring to the IGS system (X,Y,Z, ECEF) in SP3 format from an IP port. Specify a local IP port e.g. for an RTNet installation to provide this information."));
272 _outHost_1_LineEdit->setWhatsThis(tr("BNS can stream clock and orbit corrections to Broadcast Ephemeris in RTCM Version 3 format. Specify the host IP of an NTRIP Broadcaster to upload the stream. An empty option field means that you don't want to upload corrections."));
273 _outPort_1_LineEdit->setWhatsThis(tr("Specify the IP port of an NTRIP Broadcaster to upload the stream. Default is port 80."));
274 _mountpoint_1_LineEdit->setWhatsThis(tr("Specify the mounpoint for stream upload to an NTRIP Broadcaster."));
275 _password_1_LineEdit->setWhatsThis(tr("Specify the stream upload password protecting the mounpoint on an NTRIP Broadcaster."));
276 _refSys_1_ComboBox->setWhatsThis(tr("Select the target reference system for outgoing clock and orbit corrections."));
277 _outFile_1_LineEdit->setWhatsThis(tr("Specify the full path to a file where outgoing clock and orbit corrections to Broadcast Ephemeris are saved. Beware that the size of this file can rapidly increase. Default is an empty option field meaning that outgoing corrections are not saved."));
278 _outHost_2_LineEdit->setWhatsThis(tr("BNS can stream clock and orbit corrections to Broadcast Ephemeris in RTCM Version 3 format. Specify the host IP of an NTRIP Broadcaster to upload the stream. An empty option field means that you don't want to upload corrections."));
279 _outPort_2_LineEdit->setWhatsThis(tr("Specify the IP port of an NTRIP Broadcaster to upload the stream. Default is port 80."));
280 _mountpoint_2_LineEdit->setWhatsThis(tr("Specify the mounpoint for stream upload to an NTRIP Broadcaster."));
281 _password_2_LineEdit->setWhatsThis(tr("Specify the stream upload password protecting the mounpoint on an NTRIP Broadcaster."));
282 _refSys_2_ComboBox->setWhatsThis(tr("Select the target reference system for outgoing clock and orbit corrections."));
283 _outFile_2_LineEdit->setWhatsThis(tr("Specify the full path to a file where outgoing clock and orbit corrections to Broadcast Ephemeris are saved. Beware that the size of this file can rapidly increase. Default is an empty option field meaning that outgoing corrections are not saved."));
284 _outHost_3_LineEdit->setWhatsThis(tr("BNS can stream clock and orbit corrections to Broadcast Ephemeris in RTCM Version 3 format. Specify the host IP of an NTRIP Broadcaster to upload the stream. An empty option field means that you don't want to upload corrections."));
285 _outPort_3_LineEdit->setWhatsThis(tr("Specify the IP port of an NTRIP Broadcaster to upload the stream. Default is port 80."));
286 _mountpoint_3_LineEdit->setWhatsThis(tr("Specify the mounpoint for stream upload to an NTRIP Broadcaster."));
287 _password_3_LineEdit->setWhatsThis(tr("Specify the stream upload password protecting the mounpoint on an NTRIP Broadcaster."));
288 _refSys_3_ComboBox->setWhatsThis(tr("Select the target reference system for outgoing clock and orbit corrections."));
289 _outFile_3_LineEdit->setWhatsThis(tr("Specify the full path to a file where outgoing clock and orbit corrections to Broadcast Ephemeris are saved. Beware that the size of this file can rapidly increase. Default is an empty option field meaning that outgoing corrections are not saved."));
290 _rnxPathLineEdit->setWhatsThis(tr("Specify the path for saving the generated clock corrections as Clock RINEX files. If the specified directory does not exist, BNS will not create Clock RINEX files."));
291 _rnxIntrComboBox->setWhatsThis(tr("Select the length of the Clock RINEX file."));
292 _rnxSamplSpinBox->setWhatsThis(tr("Select the Clock RINEX file sampling interval in seconds. A value of zero '0' tells BNS to store all available samples into Clock RINEX files."));
293 _sp3PathLineEdit->setWhatsThis(tr("Specify the path for saving the generated orbit corrections as SP3 orbit files. If the specified directory does not exist, BNS will not create SP3 orbit files."));
294 _sp3IntrComboBox->setWhatsThis(tr("Select the length of the SP3 orbit file."));
295 _sp3SamplSpinBox->setWhatsThis(tr("Select the SP3 orbit file sampling interval in seconds. A value of zero '0' tells BNS to store all available samples into SP3 orbit files."));
296 _autoStartCheckBox->setWhatsThis(tr("<p>Tick 'Auto start' for auto-start of BNS at startup time in window mode with preassigned processing options.</p>"));
297 _beClocks1CheckBox->setWhatsThis(tr("<p>Ignore incoming clock estimates and send broadcast clocks instead of broadcast clock corrections.</p><p>Note that for compatibility with IGS post processing products these clocks will not be corrected for the 2nd order relativistic effect.</p>"));
298 _beClocks2CheckBox->setWhatsThis(tr("<p>Ignore incoming clock estimates and send broadcast clocks instead of broadcast clock corrections.</p><p>Note that for compatibility with IGS post processing products these clocks will not be corrected for the 2nd order relativistic effect.</p>"));
299
300
301 // TabWidget
302 // ---------
303 tabs = new QTabWidget();
304
305 // Proxy Tab
306 // ---------
307 QWidget* tab_prx = new QWidget();
308 tabs->setMaximumHeight(20*ww);
309 tabs->addTab(tab_prx, "Proxy");
310
311 QGridLayout* layout_prx = new QGridLayout;
312
313 layout_prx->setColumnMinimumWidth(0,9*ww);
314 _proxyPortLineEdit->setMaximumWidth(9*ww);
315
316 layout_prx->addWidget(new QLabel("Host"), 0, 0);
317 layout_prx->addWidget(_proxyHostLineEdit, 0, 1, 1, 10);
318 layout_prx->addWidget(new QLabel("Port"), 1, 0);
319 layout_prx->addWidget(_proxyPortLineEdit, 1, 1);
320 layout_prx->addWidget(new QLabel("Settings for the proxy in protected networks, leave boxes blank if none."),2, 0, 1, 50, Qt::AlignLeft);
321 layout_prx->addWidget(new QLabel(" "), 3, 0);
322
323 tab_prx->setLayout(layout_prx);
324
325 connect(_proxyHostLineEdit, SIGNAL(textChanged(const QString &)),
326 this, SLOT(bnsText(const QString &)));
327 if (_proxyHostLineEdit->text().isEmpty()) {
328 _proxyPortLineEdit->setStyleSheet("background-color: lightGray");
329 _proxyPortLineEdit->setEnabled(false);
330 }
331
332 // General Tab
333 // -----------
334 QWidget* tab_gen = new QWidget();
335 tabs->addTab(tab_gen, "General");
336
337 QGridLayout* layout_gen = new QGridLayout;
338
339 layout_gen->setColumnMinimumWidth(0,9*ww);
340 _logFileLineEdit->setMaximumWidth(40*ww);
341
342 layout_gen->addWidget(new QLabel("Logfile (full path) "), 0, 0);
343 layout_gen->addWidget(_logFileLineEdit, 0, 1);
344 layout_gen->addWidget(new QLabel("Append files"), 1, 0);
345 layout_gen->addWidget(_fileAppendCheckBox, 1, 1);
346 layout_gen->addWidget(new QLabel("Auto start"), 2, 0);
347 layout_gen->addWidget(_autoStartCheckBox, 2, 1);
348 layout_gen->addWidget(new QLabel("General settings for logfile and file handling."), 3, 0, 1, 50, Qt::AlignLeft);
349
350 tab_gen->setLayout(layout_gen);
351
352 // RINEX Ephemeris Tab
353 // -------------------
354 QWidget* tab_eph = new QWidget();
355 tabs->addTab(tab_eph, "RINEX Ephemeris");
356
357 QGridLayout* layout_eph = new QGridLayout;
358
359 layout_eph->setColumnMinimumWidth(0, 9*ww);
360 _ephPortLineEdit->setMaximumWidth(9*ww);
361
362 layout_eph->addWidget(new QLabel("Host"), 0, 0);
363 layout_eph->addWidget(_ephHostLineEdit, 0, 1, 1, 10);
364 layout_eph->addWidget(new QLabel("Port"), 1, 0);
365 layout_eph->addWidget(_ephPortLineEdit, 1, 1);
366 layout_eph->addWidget(new QLabel("Save (full path)"), 2, 0);
367 layout_eph->addWidget(_ephEchoLineEdit, 2, 1, 1, 26);
368 layout_eph->addWidget(new QLabel("Read broadcast ephemeris in RINEX Version 3 Navigation format."), 3, 0, 1, 50, Qt::AlignLeft);
369
370 tab_eph->setLayout(layout_eph);
371
372 connect(_ephHostLineEdit, SIGNAL(textChanged(const QString &)),
373 this, SLOT(bnsText(const QString &)));
374 if (_ephHostLineEdit->text().isEmpty()) {
375 _ephPortLineEdit->setStyleSheet("background-color: lightGray");
376 _ephEchoLineEdit->setStyleSheet("background-color: lightGray");
377 _ephPortLineEdit->setEnabled(false);
378 _ephEchoLineEdit->setEnabled(false);
379 }
380
381 // Clocks & Orbits Tab
382 // -------------------
383 QWidget* tab_co = new QWidget();
384 tabs->addTab(tab_co,"Clocks && Orbits");
385
386 QGridLayout* layout_co = new QGridLayout;
387
388 layout_co->setColumnMinimumWidth(0, 9*ww);
389 _clkPortLineEdit->setMaximumWidth(9*ww);
390
391 layout_co->addWidget(new QLabel("Listening port"), 0, 0);
392 layout_co->addWidget(_clkPortLineEdit, 0, 1);
393 layout_co->addWidget(new QLabel("Save (full path) "), 1, 0);
394 layout_co->addWidget(_inpEchoLineEdit, 1, 1);
395 layout_co->addWidget(new QLabel("Read clocks and orbits in SP3 format."), 2, 0, 1, 50, Qt::AlignLeft);
396 layout_co->addWidget(new QLabel(""), 3, 0);
397
398 tab_co->setLayout(layout_co);
399
400 connect(_clkPortLineEdit, SIGNAL(textChanged(const QString &)),
401 this, SLOT(bnsText(const QString &)));
402 if (_clkPortLineEdit->text().isEmpty()) {
403 _inpEchoLineEdit->setStyleSheet("background-color: lightGray");
404 _inpEchoLineEdit->setEnabled(false);
405 }
406
407 // Broadcast Corrections I Tab
408 // ---------------------------
409 QWidget* tab_cas1 = new QWidget();
410 tabs->addTab(tab_cas1, "Broadcast Corrections I");
411
412 QGridLayout* layout_cas1 = new QGridLayout;
413
414 layout_cas1->setColumnMinimumWidth(0, 9*ww);
415 _outPort_1_LineEdit->setMaximumWidth(9*ww);
416 _password_1_LineEdit->setMaximumWidth(9*ww);
417 _mountpoint_1_LineEdit->setMaximumWidth(12*ww);
418 _refSys_1_ComboBox->setMaximumWidth(12*ww);
419
420 layout_cas1->addWidget(new QLabel("Host"), 0, 0);
421 layout_cas1->addWidget(_outHost_1_LineEdit, 0, 1, 1, 3);
422 layout_cas1->addWidget(new QLabel(" Port"), 0, 4, Qt::AlignRight);
423 layout_cas1->addWidget(_outPort_1_LineEdit, 0, 5, 1, 10);
424 layout_cas1->addWidget(new QLabel("Mountpoint"), 1, 0);
425 layout_cas1->addWidget(_mountpoint_1_LineEdit, 1, 1);
426 layout_cas1->addWidget(new QLabel("Password"), 1, 2, Qt::AlignRight);
427 layout_cas1->addWidget(_password_1_LineEdit, 1, 3);
428 layout_cas1->addWidget(new QLabel(" "), 1, 4);
429 layout_cas1->addWidget(new QLabel(" "), 1, 5);
430 layout_cas1->addWidget(new QLabel("System"), 2, 0);
431 layout_cas1->addWidget(_refSys_1_ComboBox, 2, 1);
432 layout_cas1->addWidget(new QLabel(" Save (full path)"), 2, 2, Qt::AlignRight);
433 layout_cas1->addWidget(_outFile_1_LineEdit, 2, 3, 1, 30);
434 layout_cas1->addWidget(new QLabel("Broadcast clocks"), 3, 0);
435 layout_cas1->addWidget(_beClocks1CheckBox, 3, 1);
436 layout_cas1->addWidget(new QLabel("Produce broadcast ephemeris corrections, upload to caster, reference system, local storage."), 4, 0, 1, 50);
437
438 tab_cas1->setLayout(layout_cas1);
439
440 connect(_outHost_1_LineEdit, SIGNAL(textChanged(const QString &)),
441 this, SLOT(bnsText(const QString &)));
442 if (_outHost_1_LineEdit->text().isEmpty()) {
443 _outPort_1_LineEdit->setStyleSheet("background-color: lightGray");
444 _mountpoint_1_LineEdit->setStyleSheet("background-color: lightGray");
445 _password_1_LineEdit->setStyleSheet("background-color: lightGray");
446 _outFile_1_LineEdit->setStyleSheet("background-color: lightGray");
447 _refSys_1_ComboBox->setStyleSheet("background-color: lightGray");
448 palette.setColor(_beClocks1CheckBox->backgroundRole(), lightGray);
449 _beClocks1CheckBox->setPalette(palette);
450 _outPort_1_LineEdit->setEnabled(false);
451 _mountpoint_1_LineEdit->setEnabled(false);
452 _password_1_LineEdit->setEnabled(false);
453 _outFile_1_LineEdit->setEnabled(false);
454 _refSys_1_ComboBox->setEnabled(false);
455 _beClocks1CheckBox->setEnabled(false);
456 }
457
458 // Broadcast Corrections II Tab
459 // ----------------------------
460 QWidget* tab_cas2 = new QWidget();
461 tabs->addTab(tab_cas2, "Broadcast Corrections II");
462
463 QGridLayout* layout_cas2 = new QGridLayout;
464
465 layout_cas2->setColumnMinimumWidth(0, 9*ww);
466 _outPort_2_LineEdit->setMaximumWidth(9*ww);
467 _password_2_LineEdit->setMaximumWidth(9*ww);
468 _mountpoint_2_LineEdit->setMaximumWidth(12*ww);
469 _refSys_2_ComboBox->setMaximumWidth(12*ww);
470
471 layout_cas2->addWidget(new QLabel("Host"), 0, 0);
472 layout_cas2->addWidget(_outHost_2_LineEdit, 0, 1, 1, 3);
473 layout_cas2->addWidget(new QLabel(" Port"), 0, 4, Qt::AlignRight);
474 layout_cas2->addWidget(_outPort_2_LineEdit, 0, 5, 1, 10);
475 layout_cas2->addWidget(new QLabel("Mountpoint"), 1, 0);
476 layout_cas2->addWidget(_mountpoint_2_LineEdit, 1, 1);
477 layout_cas2->addWidget(new QLabel("Password"), 1, 2, Qt::AlignRight);
478 layout_cas2->addWidget(_password_2_LineEdit, 1, 3);
479 layout_cas2->addWidget(new QLabel(" "), 1, 4);
480 layout_cas2->addWidget(new QLabel(" "), 1, 5);
481 layout_cas2->addWidget(new QLabel("System"), 2, 0);
482 layout_cas2->addWidget(_refSys_2_ComboBox, 2, 1);
483 layout_cas2->addWidget(new QLabel(" Save (full path)"), 2, 2, Qt::AlignRight);
484 layout_cas2->addWidget(_outFile_2_LineEdit, 2, 3, 1, 30);
485 layout_cas2->addWidget(new QLabel("Broadcast clocks"), 3, 0);
486 layout_cas2->addWidget(_beClocks2CheckBox, 3, 1);
487 layout_cas2->addWidget(new QLabel("Produce broadcast ephemeris corrections, upload to caster, reference system, local storage."), 4, 0, 1, 50);
488
489 tab_cas2->setLayout(layout_cas2);
490
491 connect(_outHost_2_LineEdit, SIGNAL(textChanged(const QString &)),
492 this, SLOT(bnsText(const QString &)));
493 if (_outHost_2_LineEdit->text().isEmpty()) {
494 _outPort_2_LineEdit->setStyleSheet("background-color: lightGray");
495 _mountpoint_2_LineEdit->setStyleSheet("background-color: lightGray");
496 _password_2_LineEdit->setStyleSheet("background-color: lightGray");
497 _outFile_2_LineEdit->setStyleSheet("background-color: lightGray");
498 _refSys_2_ComboBox->setStyleSheet("background-color: lightGray");
499 palette.setColor(_beClocks2CheckBox->backgroundRole(), lightGray);
500 _beClocks2CheckBox->setPalette(palette);
501 _outPort_2_LineEdit->setEnabled(false);
502 _mountpoint_2_LineEdit->setEnabled(false);
503 _password_2_LineEdit->setEnabled(false);
504 _outFile_2_LineEdit->setEnabled(false);
505 _refSys_2_ComboBox->setEnabled(false);
506 _beClocks2CheckBox->setEnabled(false);
507 }
508
509 // Broadcast Corrections III Tab
510 // -----------------------------
511 QWidget* tab_cas3 = new QWidget();
512 tabs->addTab(tab_cas3, "Broadcast Corrections III");
513
514 QGridLayout* layout_cas3 = new QGridLayout;
515
516 layout_cas3->setColumnMinimumWidth(0, 9*ww);
517 _outPort_3_LineEdit->setMaximumWidth(9*ww);
518 _password_3_LineEdit->setMaximumWidth(9*ww);
519 _mountpoint_3_LineEdit->setMaximumWidth(12*ww);
520 _refSys_3_ComboBox->setMaximumWidth(12*ww);
521
522 layout_cas3->addWidget(new QLabel("Host"), 0, 0);
523 layout_cas3->addWidget(_outHost_3_LineEdit, 0, 1, 1, 3);
524 layout_cas3->addWidget(new QLabel(" Port"), 0, 4, Qt::AlignRight);
525 layout_cas3->addWidget(_outPort_3_LineEdit, 0, 5, 1, 10);
526 layout_cas3->addWidget(new QLabel("Mountpoint"), 1, 0);
527 layout_cas3->addWidget(_mountpoint_3_LineEdit, 1, 1);
528 layout_cas3->addWidget(new QLabel("Password"), 1, 2, Qt::AlignRight);
529 layout_cas3->addWidget(_password_3_LineEdit, 1, 3);
530 layout_cas3->addWidget(new QLabel(" "), 1, 4);
531 layout_cas3->addWidget(new QLabel(" "), 1, 5);
532 layout_cas3->addWidget(new QLabel("System"), 2, 0);
533 layout_cas3->addWidget(_refSys_3_ComboBox, 2, 1);
534 layout_cas3->addWidget(new QLabel(" Save (full path)"), 2, 2, Qt::AlignRight);
535 layout_cas3->addWidget(_outFile_3_LineEdit, 2, 3, 1, 30);
536 layout_cas3->addWidget(new QLabel("Broadcast clocks"), 3, 0);
537 layout_cas3->addWidget(_beClocks3CheckBox, 3, 1);
538 layout_cas3->addWidget(new QLabel("Produce broadcast ephemeris corrections, upload to caster, reference system, local storage."), 4, 0, 1, 50);
539
540 tab_cas3->setLayout(layout_cas3);
541
542 connect(_outHost_3_LineEdit, SIGNAL(textChanged(const QString &)),
543 this, SLOT(bnsText(const QString &)));
544 if (_outHost_3_LineEdit->text().isEmpty()) {
545 _outPort_3_LineEdit->setStyleSheet("background-color: lightGray");
546 _mountpoint_3_LineEdit->setStyleSheet("background-color: lightGray");
547 _password_3_LineEdit->setStyleSheet("background-color: lightGray");
548 _outFile_3_LineEdit->setStyleSheet("background-color: lightGray");
549 _refSys_3_ComboBox->setStyleSheet("background-color: lightGray");
550 palette.setColor(_beClocks3CheckBox->backgroundRole(), lightGray);
551 _beClocks3CheckBox->setPalette(palette);
552 _outPort_3_LineEdit->setEnabled(false);
553 _mountpoint_3_LineEdit->setEnabled(false);
554 _password_3_LineEdit->setEnabled(false);
555 _outFile_3_LineEdit->setEnabled(false);
556 _refSys_3_ComboBox->setEnabled(false);
557 _beClocks3CheckBox->setEnabled(false);
558 }
559
560 // RINEX Clocks Tab
561 // ----------------
562 QWidget* tab_rin = new QWidget();
563 tabs->addTab(tab_rin, "RINEX Clocks ");
564
565 QGridLayout* layout_rin = new QGridLayout;
566
567 layout_rin->setColumnMinimumWidth(0, 9*ww);
568 _rnxIntrComboBox->setMaximumWidth(9*ww);
569
570 layout_rin->addWidget(new QLabel("Directory"), 0, 0);
571 layout_rin->addWidget(_rnxPathLineEdit, 0, 1, 1, 27);
572 layout_rin->addWidget(new QLabel("Interval"), 1, 0);
573 layout_rin->addWidget(_rnxIntrComboBox, 1, 1);
574 layout_rin->addWidget(new QLabel("Sampling"), 2, 0);
575 layout_rin->addWidget(_rnxSamplSpinBox, 2, 1);
576 layout_rin->addWidget(new QLabel("Save clock corrections in Clock RINEX file format."), 3, 0, 1, 50, Qt::AlignLeft);
577 layout_rin->addWidget(new QLabel(" "), 3, 0);
578
579 tab_rin->setLayout(layout_rin);
580
581 connect(_rnxPathLineEdit, SIGNAL(textChanged(const QString &)),
582 this, SLOT(bnsText(const QString &)));
583 if (_rnxPathLineEdit->text().isEmpty()) {
584 _rnxIntrComboBox->setStyleSheet("background-color: lightGray");
585 _rnxSamplSpinBox->setStyleSheet("background-color: lightGray");
586 _rnxIntrComboBox->setEnabled(false);
587 _rnxSamplSpinBox->setEnabled(false);
588 }
589
590 // SP3 Orbits Tab
591 // --------------
592 QWidget* tab_sp3 = new QWidget();
593 tabs->addTab(tab_sp3, "SP3 Orbits");
594
595 QGridLayout* layout_sp3 = new QGridLayout;
596
597 layout_sp3->setColumnMinimumWidth(0, 9*ww);
598 _sp3IntrComboBox->setMaximumWidth(9*ww);
599
600 layout_sp3->addWidget(new QLabel("Directory"), 0, 0);
601 layout_sp3->addWidget(_sp3PathLineEdit, 0, 1, 1, 27);
602 layout_sp3->addWidget(new QLabel("Interval"), 1, 0);
603 layout_sp3->addWidget(_sp3IntrComboBox, 1, 1);
604 layout_sp3->addWidget(new QLabel("Sampling"), 2, 0);
605 layout_sp3->addWidget(_sp3SamplSpinBox, 2, 1);
606 layout_sp3->addWidget(new QLabel("Save orbit corrections in SP3 file format."), 3, 0, 1, 50, Qt::AlignLeft);
607 layout_sp3->addWidget(new QLabel(" "), 3, 0);
608
609 tab_sp3->setLayout(layout_sp3);
610
611 connect(_sp3PathLineEdit, SIGNAL(textChanged(const QString &)),
612 this, SLOT(bnsText(const QString &)));
613 if (_sp3PathLineEdit->text().isEmpty()) {
614 _sp3IntrComboBox->setStyleSheet("background-color: lightGray");
615 _sp3SamplSpinBox->setStyleSheet("background-color: lightGray");
616 _sp3IntrComboBox->setEnabled(false);
617 _sp3SamplSpinBox->setEnabled(false);
618 }
619
620 tabs->setCurrentIndex(settings.value("startTab").toInt());
621
622 // Log
623 // ---
624 _log = new QTextBrowser();
625 _log->setReadOnly(true);
626 _log->setWhatsThis(tr("Records of BNS's activities are shown in the Log section."));
627
628 // Status
629 // ------
630 _status = new QGroupBox(tr("Status"));
631 QGridLayout* layout_status = new QGridLayout;
632
633 _statusLbl[0] = new QLabel("0 byte(s)"); _statusCnt[0] = 0;
634 _statusLbl[1] = new QLabel("0 byte(s)"); _statusCnt[1] = 0;
635 _statusLbl[2] = new QLabel("0 byte(s)"); _statusCnt[2] = 0;
636 _statusLbl[3] = new QLabel("0 byte(s)"); _statusCnt[3] = 0;
637 _statusLbl[9] = new QLabel("0 byte(s)"); _statusCnt[4] = 0;
638 _statusLbl[7] = new QLabel("RINEX Ephemeris:");
639 _statusLbl[4] = new QLabel("Clocks & Orbits:");
640 _statusLbl[5] = new QLabel("Broadcast Corrections I:");
641 _statusLbl[6] = new QLabel("Broadcast Corrections II:");
642 _statusLbl[8] = new QLabel("Broadcast Corrections III:");
643
644 _statusLbl[0]->setWhatsThis(tr("Status of incoming broadcast ephemeris."));
645 _statusLbl[1]->setWhatsThis(tr("Status of incoming stream of clocks and orbits."));
646 _statusLbl[2]->setWhatsThis(tr("Status of outgoing stream to NTRIP broadcaster."));
647 _statusLbl[7]->setWhatsThis(tr("Status of incoming broadcast ephemeris."));
648 _statusLbl[4]->setWhatsThis(tr("Status of incoming stream of clocks and orbits I."));
649 _statusLbl[5]->setWhatsThis(tr("Status of outgoing stream to NTRIP broadcaster I."));
650 _statusLbl[6]->setWhatsThis(tr("Status of outgoing stream to NTRIP broadcaster II."));
651 _statusLbl[3]->setWhatsThis(tr("Status of outgoing stream to NTRIP broadcaster II."));
652 _statusLbl[8]->setWhatsThis(tr("Status of outgoing stream to NTRIP broadcaster III."));
653
654 layout_status->addWidget(_statusLbl[7], 0, 0);
655 layout_status->addWidget(_statusLbl[0], 0, 1);
656 layout_status->addWidget(_statusLbl[5], 0, 2);
657 layout_status->addWidget(_statusLbl[2], 0, 3);
658 layout_status->addWidget(_statusLbl[4], 1, 0);
659 layout_status->addWidget(_statusLbl[1], 1, 1);
660 layout_status->addWidget(_statusLbl[6], 1, 2);
661 layout_status->addWidget(_statusLbl[3], 1, 3);
662 layout_status->addWidget(_statusLbl[8], 2, 2);
663 layout_status->addWidget(_statusLbl[9], 2, 3);
664 _status->setLayout(layout_status);
665
666 // Main Layout
667 // -----------
668 QVBoxLayout* mainLayout = new QVBoxLayout;
669 mainLayout->addWidget(tabs);
670 mainLayout->addWidget(_log);
671 mainLayout->addWidget(_status);
672
673 _canvas->setLayout(mainLayout);
674
675 // Auto start
676 // ----------
677 if ( Qt::CheckState(settings.value("autoStart").toInt()) == Qt::Checked) {
678 slotStart();
679 }
680
681}
682
683// Destructor
684////////////////////////////////////////////////////////////////////////////
685bnsWindow::~bnsWindow() {
686}
687
688// Close Application gracefully
689////////////////////////////////////////////////////////////////////////////
690void bnsWindow::closeEvent(QCloseEvent* event) {
691
692int iRet = QMessageBox::question(this, "Close", "Save Options?",
693 QMessageBox::Yes, QMessageBox::No,
694 QMessageBox::Cancel);
695
696 if (iRet == QMessageBox::Cancel) {
697 event->ignore();
698 return;
699 }
700 else if (iRet == QMessageBox::Yes) {
701 slotSaveOptions();
702 }
703
704 QMainWindow::closeEvent(event);
705}
706
707// About Message
708////////////////////////////////////////////////////////////////////////////
709void bnsWindow::slotAbout() {
710 new bnsAboutDlg(0);
711}
712
713// Flowchart
714////////////////////////////////////////////////////////////////////////////
715void bnsWindow::slotFlowchart() {
716 new bnsFlowchartDlg(0);
717}
718
719// Help Window
720////////////////////////////////////////////////////////////////////////////
721void bnsWindow::slotHelp() {
722 QUrl url;
723 url.setPath(":bnshelp.html");
724 new bnsHlpDlg(0, url);
725}
726
727// Select Fonts
728////////////////////////////////////////////////////////////////////////////
729void bnsWindow::slotFontSel() {
730 bool ok;
731 QFont newFont = QFontDialog::getFont(&ok, this->font(), this);
732 if (ok) {
733 bnsSettings settings;
734 settings.setValue("font", newFont.toString());
735 QApplication::setFont(newFont);
736 int ww = QFontMetrics(newFont).width('w');
737 setMinimumSize(77*ww, 65*ww);
738 }
739}
740
741// Whats This Help
742////////////////////////////////////////////////////////////////////////////
743void bnsWindow::slotWhatsThis() {
744QWhatsThis::enterWhatsThisMode();
745}
746
747// Create Menus
748////////////////////////////////////////////////////////////////////////////
749void bnsWindow::CreateMenu() {
750 _menuFile = menuBar()->addMenu(tr("&File"));
751 _menuFile->addAction(_actFontSel);
752 _menuFile->addSeparator();
753 _menuFile->addAction(_actSaveOpt);
754 _menuFile->addSeparator();
755 _menuFile->addAction(_actQuit);
756
757 _menuHlp = menuBar()->addMenu(tr("&Help"));
758 _menuHlp->addAction(_actHelp);
759 _menuHlp->addAction(_actFlowchart);
760 _menuHlp->addAction(_actAbout);
761}
762
763// Tool (Command) Bar
764////////////////////////////////////////////////////////////////////////////
765void bnsWindow::AddToolbar() {
766 QToolBar* toolBar = new QToolBar;
767 addToolBar(Qt::BottomToolBarArea, toolBar);
768 toolBar->setMovable(false);
769 toolBar->addAction(_actStart);
770 toolBar->addAction(_actStop);
771 toolBar->addWidget(new QLabel(" "));
772 toolBar->addAction(_actWhatsThis);
773}
774
775// Save Options
776////////////////////////////////////////////////////////////////////////////
777void bnsWindow::slotSaveOptions() {
778 bnsSettings settings;
779 settings.setValue("proxyHost", _proxyHostLineEdit->text());
780 settings.setValue("proxyPort", _proxyPortLineEdit->text());
781
782 settings.setValue("logFile", _logFileLineEdit->text());
783 settings.setValue("fileAppend", _fileAppendCheckBox->checkState());
784 settings.setValue("autoStart", _autoStartCheckBox->checkState());
785
786 settings.setValue("ephHost", _ephHostLineEdit->text());
787 settings.setValue("ephPort", _ephPortLineEdit->text());
788 settings.setValue("ephEcho", _ephEchoLineEdit->text());
789
790 settings.setValue("clkPort", _clkPortLineEdit->text());
791 settings.setValue("inpEcho", _inpEchoLineEdit->text());
792
793 settings.setValue("outHost1", _outHost_1_LineEdit->text());
794 settings.setValue("outPort1", _outPort_1_LineEdit->text());
795 settings.setValue("mountpoint_1",_mountpoint_1_LineEdit->text());
796 settings.setValue("password1", _password_1_LineEdit->text());
797 settings.setValue("refSys_1", _refSys_1_ComboBox->currentText());
798 settings.setValue("outFile_1", _outFile_1_LineEdit->text());
799 settings.setValue("beClocks1", _beClocks1CheckBox->checkState());
800
801 settings.setValue("outHost2", _outHost_2_LineEdit->text());
802 settings.setValue("outPort2", _outPort_2_LineEdit->text());
803 settings.setValue("mountpoint_2",_mountpoint_2_LineEdit->text());
804 settings.setValue("password2", _password_2_LineEdit->text());
805 settings.setValue("refSys_2", _refSys_2_ComboBox->currentText());
806 settings.setValue("outFile_2", _outFile_2_LineEdit->text());
807 settings.setValue("beClocks2", _beClocks2CheckBox->checkState());
808
809 settings.setValue("outHost3", _outHost_3_LineEdit->text());
810 settings.setValue("outPort3", _outPort_3_LineEdit->text());
811 settings.setValue("mountpoint_3",_mountpoint_3_LineEdit->text());
812 settings.setValue("password3", _password_3_LineEdit->text());
813 settings.setValue("refSys_3", _refSys_3_ComboBox->currentText());
814 settings.setValue("outFile_3", _outFile_3_LineEdit->text());
815 settings.setValue("beClocks3", _beClocks2CheckBox->checkState());
816
817 settings.setValue("rnxPath", _rnxPathLineEdit->text());
818 settings.setValue("rnxIntr", _rnxIntrComboBox->currentText());
819 settings.setValue("rnxSampl", _rnxSamplSpinBox->value());
820
821 settings.setValue("sp3Path", _sp3PathLineEdit->text());
822 settings.setValue("sp3Intr", _sp3IntrComboBox->currentText());
823 settings.setValue("sp3Sampl", _sp3SamplSpinBox->value());
824
825 settings.setValue("startTab", tabs->currentIndex());
826}
827
828// Display Program Messages
829////////////////////////////////////////////////////////////////////////////
830void bnsWindow::slotMessage(const QByteArray msg) {
831
832 const int maxBufferSize = 10000;
833
834 QString txt = _log->toPlainText() + "\n" +
835 QDateTime::currentDateTime().toUTC().toString("yy-MM-dd hh:mm:ss ") + msg;
836 _log->clear();
837 _log->append(txt.right(maxBufferSize));
838}
839
840// Delete bns
841////////////////////////////////////////////////////////////////////////////
842void bnsWindow::deleteBns() {
843 _actStart->setEnabled(true);
844 _actStop->setEnabled(false);
845 _bns->terminate();
846 _bns->wait(100);
847 delete _bns;
848 _bns = 0;
849}
850
851// Error in bns
852////////////////////////////////////////////////////////////////////////////
853void bnsWindow::slotError(const QByteArray msg) {
854 slotMessage(msg);
855 deleteBns();
856}
857
858// Stop
859////////////////////////////////////////////////////////////////////////////
860void bnsWindow::slotStop() {
861 int iRet = QMessageBox::question(this, "Stop", "Do you want to stop?",
862 QMessageBox::Yes, QMessageBox::No,
863 QMessageBox::NoButton);
864 if (iRet == QMessageBox::Yes) {
865 deleteBns();
866 }
867}
868
869// Start
870////////////////////////////////////////////////////////////////////////////
871void bnsWindow::slotStart() {
872 slotSaveOptions();
873
874 _actStart->setEnabled(false);
875 _actStop->setEnabled(true);
876
877 _bns = new t_bns(0);
878
879 connect(_bns, SIGNAL(newMessage(QByteArray)),
880 this, SLOT(slotMessage(const QByteArray)));
881
882 connect(_bns, SIGNAL(error(QByteArray)),
883 this, SLOT(slotError(const QByteArray)));
884
885 connect(_bns, SIGNAL(newEphBytes(int)), this, SLOT(slotEphBytes(int)));
886 connect(_bns, SIGNAL(newClkBytes(int)), this, SLOT(slotClkBytes(int)));
887 connect(_bns, SIGNAL(newOutBytes1(int)), this, SLOT(slotOutBytes1(int)));
888 connect(_bns, SIGNAL(newOutBytes2(int)), this, SLOT(slotOutBytes2(int)));
889 connect(_bns, SIGNAL(newOutBytes3(int)), this, SLOT(slotOutBytes3(int)));
890
891 _bns->start();
892}
893
894// Input and output bytes statistics
895////////////////////////////////////////////////////////////////////////////
896void bnsWindow::slotEphBytes(int nBytes) {
897 updateStatus(0, nBytes);
898}
899void bnsWindow::slotClkBytes(int nBytes) {
900 updateStatus(1, nBytes);
901}
902void bnsWindow::slotOutBytes1(int nBytes) {
903 updateStatus(2, nBytes);
904}
905void bnsWindow::slotOutBytes2(int nBytes) {
906 updateStatus(3, nBytes);
907}
908void bnsWindow::slotOutBytes3(int nBytes) {
909 updateStatus(4, nBytes);
910}
911
912void bnsWindow::updateStatus(int ii, int nBytes) {
913 QMutexLocker locker(&_mutex);
914
915 _statusCnt[ii] += nBytes;
916
917 if (_statusCnt[ii] < 1e3) {
918 _statusLbl[ii]->setText(QString("%1 byte(s)").arg((int)_statusCnt[ii]));
919 }
920 else if (_statusCnt[ii] < 1e6) {
921 _statusLbl[ii]->setText(QString("%1 kb").arg(_statusCnt[ii]/1.e3, 5));
922 }
923 else {
924 _statusLbl[ii]->setText(QString("%1 Mb").arg(_statusCnt[ii]/1.e6, 5));
925 }
926}
927
928// Bns Text
929////////////////////////////////////////////////////////////////////////////
930void bnsWindow::bnsText(const QString &text){
931
932 bool isEmpty = text.isEmpty();
933
934 QPalette palette;
935 QColor lightGray(230, 230, 230);
936 QColor white(255, 255, 255);
937
938 // Enable/disable Proxy Options
939 // ----------------------------
940 if (tabs->currentIndex() == 0) {
941 if (!isEmpty) {
942 _proxyPortLineEdit->setStyleSheet("background-color: white");
943 _proxyPortLineEdit->setEnabled(true);
944 } else {
945 _proxyPortLineEdit->setStyleSheet("background-color: lightGray");
946 _proxyPortLineEdit->setEnabled(false);
947 }
948 }
949
950 // Enable/disable RINEX Ephemeris Options
951 // --------------------------------------
952 if (tabs->currentIndex() == 2) {
953 if (!isEmpty) {
954 _ephPortLineEdit->setStyleSheet("background-color: white");
955 _ephEchoLineEdit->setStyleSheet("background-color: white");
956 _ephEchoLineEdit->setEnabled(true);
957 } else {
958 _ephPortLineEdit->setStyleSheet("background-color: lightGray");
959 _ephEchoLineEdit->setStyleSheet("background-color: lightGray");
960 _ephEchoLineEdit->setEnabled(false);
961 }
962 }
963
964 // Enable/disable Clocks & Orbits Options
965 // --------------------------------------
966 if (tabs->currentIndex() == 3) {
967 if (!isEmpty) {
968 _inpEchoLineEdit->setStyleSheet("background-color: white");
969 _inpEchoLineEdit->setEnabled(true);
970 } else {
971 _inpEchoLineEdit->setStyleSheet("background-color: lightGray");
972 _inpEchoLineEdit->setEnabled(false);
973 }
974 }
975
976 // Enable/disable Broadcast Corrections I Options
977 // -----------------------------------------------
978 if (tabs->currentIndex() == 4) {
979 if (!isEmpty) {
980 _outPort_1_LineEdit->setStyleSheet("background-color: white");
981 _mountpoint_1_LineEdit->setStyleSheet("background-color: white");
982 _password_1_LineEdit->setStyleSheet("background-color: white");
983 _outFile_1_LineEdit->setStyleSheet("background-color: white");
984 _refSys_1_ComboBox->setStyleSheet("background-color: white");
985 palette.setColor(_beClocks1CheckBox->backgroundRole(), white);
986 _beClocks1CheckBox->setPalette(palette);
987 _outPort_1_LineEdit->setEnabled(true);
988 _mountpoint_1_LineEdit->setEnabled(true);
989 _password_1_LineEdit->setEnabled(true);
990 _outFile_1_LineEdit->setEnabled(true);
991 _refSys_1_ComboBox->setEnabled(true);
992 _beClocks1CheckBox->setEnabled(true);
993 } else {
994 _outPort_1_LineEdit->setStyleSheet("background-color: lightGray");
995 _mountpoint_1_LineEdit->setStyleSheet("background-color: lightGray");
996 _password_1_LineEdit->setStyleSheet("background-color: lightGray");
997 _outFile_1_LineEdit->setStyleSheet("background-color: lightGray");
998 _refSys_1_ComboBox->setStyleSheet("background-color: lightGray");
999 palette.setColor(_beClocks1CheckBox->backgroundRole(), lightGray);
1000 _beClocks1CheckBox->setPalette(palette);
1001 _outPort_1_LineEdit->setEnabled(false);
1002 _mountpoint_1_LineEdit->setEnabled(false);
1003 _password_1_LineEdit->setEnabled(false);
1004 _outFile_1_LineEdit->setEnabled(false);
1005 _refSys_1_ComboBox->setEnabled(false);
1006 _beClocks1CheckBox->setEnabled(false);
1007 }
1008 }
1009
1010 // Enable/disable Broadcast Corrections II Options
1011 // -----------------------------------------------
1012 if (tabs->currentIndex() == 5) {
1013 if (!isEmpty) {
1014 _outPort_2_LineEdit->setStyleSheet("background-color: white");
1015 _mountpoint_2_LineEdit->setStyleSheet("background-color: white");
1016 _password_2_LineEdit->setStyleSheet("background-color: white");
1017 _outFile_2_LineEdit->setStyleSheet("background-color: white");
1018 _refSys_2_ComboBox->setStyleSheet("background-color: white");
1019 palette.setColor(_beClocks2CheckBox->backgroundRole(), white);
1020 _beClocks2CheckBox->setPalette(palette);
1021 _outPort_2_LineEdit->setEnabled(true);
1022 _mountpoint_2_LineEdit->setEnabled(true);
1023 _password_2_LineEdit->setEnabled(true);
1024 _outFile_2_LineEdit->setEnabled(true);
1025 _refSys_2_ComboBox->setEnabled(true);
1026 _beClocks2CheckBox->setEnabled(true);
1027 } else {
1028 _outPort_2_LineEdit->setStyleSheet("background-color: lightGray");
1029 _mountpoint_2_LineEdit->setStyleSheet("background-color: lightGray");
1030 _password_2_LineEdit->setStyleSheet("background-color: lightGray");
1031 _outFile_2_LineEdit->setStyleSheet("background-color: lightGray");
1032 _refSys_2_ComboBox->setStyleSheet("background-color: lightGray");
1033 palette.setColor(_beClocks2CheckBox->backgroundRole(), lightGray);
1034 _beClocks2CheckBox->setPalette(palette);
1035 _outPort_2_LineEdit->setEnabled(false);
1036 _mountpoint_2_LineEdit->setEnabled(false);
1037 _password_2_LineEdit->setEnabled(false);
1038 _outFile_2_LineEdit->setEnabled(false);
1039 _refSys_2_ComboBox->setEnabled(false);
1040 _beClocks2CheckBox->setEnabled(false);
1041 }
1042 }
1043
1044 // Enable/disable Broadcast Corrections III Options
1045 // -----------------------------------------------
1046 if (tabs->currentIndex() == 6) {
1047 if (!isEmpty) {
1048 _outPort_3_LineEdit->setStyleSheet("background-color: white");
1049 _mountpoint_3_LineEdit->setStyleSheet("background-color: white");
1050 _password_3_LineEdit->setStyleSheet("background-color: white");
1051 _outFile_3_LineEdit->setStyleSheet("background-color: white");
1052 _refSys_3_ComboBox->setStyleSheet("background-color: white");
1053 palette.setColor(_beClocks3CheckBox->backgroundRole(), white);
1054 _beClocks3CheckBox->setPalette(palette);
1055 _outPort_3_LineEdit->setEnabled(true);
1056 _mountpoint_3_LineEdit->setEnabled(true);
1057 _password_3_LineEdit->setEnabled(true);
1058 _outFile_3_LineEdit->setEnabled(true);
1059 _refSys_3_ComboBox->setEnabled(true);
1060 _beClocks3CheckBox->setEnabled(true);
1061 } else {
1062 _outPort_3_LineEdit->setStyleSheet("background-color: lightGray");
1063 _mountpoint_3_LineEdit->setStyleSheet("background-color: lightGray");
1064 _password_3_LineEdit->setStyleSheet("background-color: lightGray");
1065 _outFile_3_LineEdit->setStyleSheet("background-color: lightGray");
1066 _refSys_3_ComboBox->setStyleSheet("background-color: lightGray");
1067 palette.setColor(_beClocks3CheckBox->backgroundRole(), lightGray);
1068 _beClocks3CheckBox->setPalette(palette);
1069 _outPort_3_LineEdit->setEnabled(false);
1070 _mountpoint_3_LineEdit->setEnabled(false);
1071 _password_3_LineEdit->setEnabled(false);
1072 _outFile_3_LineEdit->setEnabled(false);
1073 _refSys_3_ComboBox->setEnabled(false);
1074 _beClocks3CheckBox->setEnabled(false);
1075 }
1076 }
1077
1078 // Enable/disable RINEX Clocks Options
1079 // -----------------------------------
1080 if (tabs->currentIndex() == 7) {
1081 if (!isEmpty) {
1082 _rnxIntrComboBox->setStyleSheet("background-color: white");
1083 _rnxSamplSpinBox->setStyleSheet("background-color: white");
1084 _rnxIntrComboBox->setEnabled(true);
1085 _rnxSamplSpinBox->setEnabled(true);
1086 } else {
1087 _rnxIntrComboBox->setStyleSheet("background-color: lightGray");
1088 _rnxSamplSpinBox->setStyleSheet("background-color: lightGray");
1089 _rnxIntrComboBox->setEnabled(false);
1090 _rnxSamplSpinBox->setEnabled(false);
1091 }
1092 }
1093
1094 // Enable/disable SP3 Orbits Options
1095 // ---------------------------------
1096 if (tabs->currentIndex() == 8) {
1097 if (!isEmpty) {
1098 _sp3IntrComboBox->setStyleSheet("background-color: white");
1099 _sp3SamplSpinBox->setStyleSheet("background-color: white");
1100 _sp3IntrComboBox->setEnabled(true);
1101 _sp3SamplSpinBox->setEnabled(true);
1102 } else {
1103 _sp3IntrComboBox->setStyleSheet("background-color: lightGray");
1104 _sp3SamplSpinBox->setStyleSheet("background-color: lightGray");
1105 _sp3IntrComboBox->setEnabled(false);
1106 _sp3SamplSpinBox->setEnabled(false);
1107 }
1108 }
1109
1110}
Note: See TracBrowser for help on using the repository browser.