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

Last change on this file since 2258 was 2138, checked in by mervart, 14 years ago

* empty log message *

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