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

Last change on this file since 1833 was 1806, checked in by weber, 16 years ago

* empty log message *

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