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

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

* empty log message *

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