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

Last change on this file since 1803 was 1803, checked in by weber, 15 years ago

* empty log message *

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