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

Last change on this file since 2102 was 2102, checked in by weber, 14 years ago

* empty log message *

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