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

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

* empty log message *

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