source: ntrip/trunk/BNC/bncwindow.cpp@ 1912

Last change on this file since 1912 was 1912, checked in by weber, 13 years ago

* empty log message *

File size: 76.1 KB
Line 
1// Part of BNC, a utility for retrieving decoding and
2// converting GNSS data streams from NTRIP broadcasters.
3//
4// Copyright (C) 2007
5// German Federal Agency for Cartography and Geodesy (BKG)
6// http://www.bkg.bund.de
7// Czech Technical University Prague, Department of Geodesy
8// http://www.fsv.cvut.cz
9//
10// Email: euref-ip@bkg.bund.de
11//
12// This program is free software; you can redistribute it and/or
13// modify it under the terms of the GNU General Public License
14// as published by the Free Software Foundation, version 2.
15//
16// This program is distributed in the hope that it will be useful,
17// but WITHOUT ANY WARRANTY; without even the implied warranty of
18// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19// GNU General Public License for more details.
20//
21// You should have received a copy of the GNU General Public License
22// along with this program; if not, write to the Free Software
23// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24
25/* -------------------------------------------------------------------------
26 * BKG NTRIP Client
27 * -------------------------------------------------------------------------
28 *
29 * Class: bncWindow
30 *
31 * Purpose: This class implements the main application window.
32 *
33 * Author: L. Mervart
34 *
35 * Created: 24-Dec-2005
36 *
37 * Changes:
38 *
39 * -----------------------------------------------------------------------*/
40
41#include <iostream>
42
43#include <unistd.h>
44#include "bncwindow.h"
45#include "bncapp.h"
46#include "bncgetthread.h"
47#include "bnctabledlg.h"
48#include "bncipport.h"
49#include "bncudpport.h"
50#include "bncserialport.h"
51#include "bnchlpdlg.h"
52#include "bnchtml.h"
53#include "bnctableitem.h"
54#include "bncsettings.h"
55
56using namespace std;
57
58// Begin new Perlt
59FWidget::FWidget(QWidget *parent)
60 : QWidget(parent)
61{
62 bncSettings settings;
63 QListIterator<QString> it(settings.value("mountPoints").toStringList());
64 while (it.hasNext()) {
65 QStringList hlp = it.next().split(" ");
66 QUrl url(hlp[0]);
67 MPName.append(url.path().toAscii()); bytesMP.append(0);
68 }
69}
70
71FWidget::~FWidget() { };
72
73void FWidget::nextAnimationFrame(){update();}
74
75void FWidget::paintEvent(QPaintEvent *)
76{
77 QRectF rectangle(0, 0, 640, 180);
78 QBrush rBrush(Qt::white,Qt::SolidPattern);
79 QPainter painter(this);
80 painter.fillRect(rectangle,rBrush);
81 painter.drawRect(rectangle);
82 QLine line(50, 140, 630, 140);
83 painter.drawLine(line);
84
85 line.setLine(50, 105, 50, 10);
86 painter.drawLine(line);
87 line.setLine(50, 105, 400, 105);
88 painter.drawLine(line);
89
90 QPoint textP(40, 140);
91 painter.drawText(textP, tr("0"));
92 textP.setX(20);
93 textP.setY(25);
94 painter.drawText(textP, tr("3000"));
95 textP.setX(20);
96 textP.setY(40);
97 painter.drawText(textP, tr("bps"));
98
99 textP.setX(410);
100 textP.setY(105);
101 painter.drawText(textP, tr("Mountpoints"));
102
103 int anker=0;
104 textP.setY(160);
105 painter.drawText(textP, tr(QTime::currentTime().toString().toAscii()));
106 textP.setX(300);
107
108// QString hlp = (QString("%1").arg(MPName.size()));
109// if (MPName.isEmpty()) {painter.drawText(textP, tr("Empty"));} else {painter.drawText(textP, tr(hlp.toAscii()));}
110
111 QListIterator<QByteArray> it(MPName);
112 while (it.hasNext()) {
113 QByteArray hlp=it.next();
114 double bytesnew=bytesMP[MPName.lastIndexOf(hlp)];
115 double vv = bytesnew/30;
116 QRectF vrect((100+anker*40), (140-vv), (30), (vv));
117 QBrush xBrush(Qt::green,Qt::SolidPattern);
118 textP.setX(100+anker*40);
119 painter.fillRect(vrect,xBrush);
120 painter.drawRect(vrect);
121 painter.drawText(textP, hlp);
122 anker++;
123 }
124}
125// End new Perlt
126
127// Constructor
128////////////////////////////////////////////////////////////////////////////
129bncWindow::bncWindow() {
130
131 _caster = 0;
132
133// Begin new Perlt
134 // Figure
135 _Figure1 = new FWidget(this);
136// End new Perlt
137
138 int ww = QFontMetrics(this->font()).width('w');
139
140 static const QStringList labels = QString("account, Streams: resource loader / mountpoint,decoder,lat,long,nmea,ntrip,bytes").split(",");
141
142 setMinimumSize(85*ww, 65*ww);
143
144 setWindowTitle(tr("BKG Ntrip Client (BNC) Version 1.7"));
145
146 connect((bncApp*)qApp, SIGNAL(newMessage(QByteArray,bool)),
147 this, SLOT(slotWindowMessage(QByteArray,bool)));
148
149 QPalette palette;
150 QColor lightGray(230, 230, 230);
151
152 // Create Actions
153 // --------------
154 _actHelp = new QAction(tr("&Help Contents"),this);
155 connect(_actHelp, SIGNAL(triggered()), SLOT(slotHelp()));
156
157 _actAbout = new QAction(tr("&About BNC"),this);
158 connect(_actAbout, SIGNAL(triggered()), SLOT(slotAbout()));
159
160 _actFlowchart = new QAction(tr("&Flow Chart"),this);
161 connect(_actFlowchart, SIGNAL(triggered()), SLOT(slotFlowchart()));
162
163 _actFontSel = new QAction(tr("Select &Font"),this);
164 connect(_actFontSel, SIGNAL(triggered()), SLOT(slotFontSel()));
165
166 _actSaveOpt = new QAction(tr("&Save && Reread Configuration"),this);
167 connect(_actSaveOpt, SIGNAL(triggered()), SLOT(slotSaveOptions()));
168
169 _actQuit = new QAction(tr("&Quit"),this);
170 connect(_actQuit, SIGNAL(triggered()), SLOT(close()));
171
172 _actAddMountPoints = new QAction(tr("Add &Stream"),this);
173 connect(_actAddMountPoints, SIGNAL(triggered()), SLOT(slotAddMountPoints()));
174
175 _actDeleteMountPoints = new QAction(tr("&Delete Stream"),this);
176 connect(_actDeleteMountPoints, SIGNAL(triggered()), SLOT(slotDeleteMountPoints()));
177 _actDeleteMountPoints->setEnabled(false);
178
179 _actGetData = new QAction(tr("Sta&rt"),this);
180 connect(_actGetData, SIGNAL(triggered()), SLOT(slotGetData()));
181
182 _actStop = new QAction(tr("Sto&p"),this);
183 connect(_actStop, SIGNAL(triggered()), SLOT(slotStop()));
184 _actStop->setEnabled(false);
185
186 _actwhatsthis= new QAction(tr("Help=Shift+F1"),this);
187 connect(_actwhatsthis, SIGNAL(triggered()), SLOT(slotWhatsThis()));
188
189 CreateMenu();
190 AddToolbar();
191
192 bncSettings settings;
193
194 // Proxy Options
195 // -------------
196 _proxyHostLineEdit = new QLineEdit(settings.value("proxyHost").toString());
197 _proxyPortLineEdit = new QLineEdit(settings.value("proxyPort").toString());
198
199 // General Options
200 // ---------------
201 _logFileLineEdit = new QLineEdit(settings.value("logFile").toString());
202 _rnxAppendCheckBox = new QCheckBox();
203 _rnxAppendCheckBox->setCheckState(Qt::CheckState(
204 settings.value("rnxAppend").toInt()));
205 _onTheFlyComboBox = new QComboBox();
206 _onTheFlyComboBox->setEditable(false);
207 _onTheFlyComboBox->addItems(QString("1 day,1 hour,1 min").split(","));
208 int ii = _onTheFlyComboBox->findText(settings.value("onTheFlyInterval").toString());
209 if (ii != -1) {
210 _onTheFlyComboBox->setCurrentIndex(ii);
211 }
212 _autoStartCheckBox = new QCheckBox();
213 _autoStartCheckBox->setCheckState(Qt::CheckState(
214 settings.value("autoStart").toInt()));
215
216 // RINEX Observations Options
217 // --------------------------
218 _rnxPathLineEdit = new QLineEdit(settings.value("rnxPath").toString());
219 _rnxIntrComboBox = new QComboBox();
220 _rnxIntrComboBox->setEditable(false);
221 _rnxIntrComboBox->addItems(QString("1 min,2 min,5 min,10 min,15 min,30 min,1 hour,1 day").split(","));
222 ii = _rnxIntrComboBox->findText(settings.value("rnxIntr").toString());
223 if (ii != -1) {
224 _rnxIntrComboBox->setCurrentIndex(ii);
225 }
226 _rnxSamplSpinBox = new QSpinBox();
227 _rnxSamplSpinBox->setMinimum(0);
228 _rnxSamplSpinBox->setMaximum(60);
229 _rnxSamplSpinBox->setSingleStep(5);
230 _rnxSamplSpinBox->setValue(settings.value("rnxSampl").toInt());
231 _rnxSamplSpinBox->setSuffix(" sec");
232 _rnxSkelLineEdit = new QLineEdit(settings.value("rnxSkel").toString());
233 _rnxSkelLineEdit->setMaximumWidth(5*ww);
234 _rnxScrpLineEdit = new QLineEdit(settings.value("rnxScript").toString());
235 _rnxV3CheckBox = new QCheckBox();
236 _rnxV3CheckBox->setCheckState(Qt::CheckState(settings.value("rnxV3").toInt()));
237
238 // RINEX Ephemeris Options
239 // -----------------------
240 _ephPathLineEdit = new QLineEdit(settings.value("ephPath").toString());
241 _ephIntrComboBox = new QComboBox();
242 _ephIntrComboBox->setEditable(false);
243 _ephIntrComboBox->addItems(QString("1 min,2 min,5 min,10 min,15 min,30 min,1 hour,1 day").split(","));
244 int jj = _ephIntrComboBox->findText(settings.value("ephIntr").toString());
245 if (jj != -1) {
246 _ephIntrComboBox->setCurrentIndex(jj);
247 }
248 _outEphPortLineEdit = new QLineEdit(settings.value("outEphPort").toString());
249 _ephV3CheckBox = new QCheckBox();
250 _ephV3CheckBox->setCheckState(Qt::CheckState(settings.value("ephV3").toInt()));
251
252 // Broadcast Corrections Options
253 // -----------------------------
254 _corrPathLineEdit = new QLineEdit(settings.value("corrPath").toString());
255 _corrIntrComboBox = new QComboBox();
256 _corrIntrComboBox->setEditable(false);
257 _corrIntrComboBox->addItems(QString("1 min,2 min,5 min,10 min,15 min,30 min,1 hour,1 day").split(","));
258 int mm = _corrIntrComboBox->findText(settings.value("corrIntr").toString());
259 if (mm != -1) {
260 _corrIntrComboBox->setCurrentIndex(mm);
261 }
262 _corrPortLineEdit = new QLineEdit(settings.value("corrPort").toString());
263 _corrTimeSpinBox = new QSpinBox();
264 _corrTimeSpinBox->setMinimum(1);
265 _corrTimeSpinBox->setMaximum(30);
266 _corrTimeSpinBox->setSingleStep(1);
267 _corrTimeSpinBox->setSuffix(" sec");
268 _corrTimeSpinBox->setValue(settings.value("corrTime").toInt());
269
270 // Feed Engine Options
271 // -------------------
272 _outPortLineEdit = new QLineEdit(settings.value("outPort").toString());
273 _waitTimeSpinBox = new QSpinBox();
274 _waitTimeSpinBox->setMinimum(1);
275 _waitTimeSpinBox->setMaximum(30);
276 _waitTimeSpinBox->setSingleStep(1);
277 _waitTimeSpinBox->setSuffix(" sec");
278 _waitTimeSpinBox->setValue(settings.value("waitTime").toInt());
279 _binSamplSpinBox = new QSpinBox();
280 _binSamplSpinBox->setMinimum(0);
281 _binSamplSpinBox->setMaximum(60);
282 _binSamplSpinBox->setSingleStep(5);
283 _binSamplSpinBox->setValue(settings.value("binSampl").toInt());
284 _binSamplSpinBox->setSuffix(" sec");
285 _outFileLineEdit = new QLineEdit(settings.value("outFile").toString());
286 _outUPortLineEdit = new QLineEdit(settings.value("outUPort").toString());
287
288 // Serial Output Options
289 // ---------------------
290 _serialMountPointLineEdit = new QLineEdit(settings.value("serialMountPoint").toString());
291 _serialPortNameLineEdit = new QLineEdit(settings.value("serialPortName").toString());
292 _serialBaudRateComboBox = new QComboBox();
293 _serialBaudRateComboBox->addItems(QString("110,300,600,"
294 "1200,2400,4800,9600,19200,38400,57600,115200").split(","));
295 int kk = _serialBaudRateComboBox->findText(settings.value("serialBaudRate").toString());
296 if (kk != -1) {
297 _serialBaudRateComboBox->setCurrentIndex(kk);
298 }
299 _serialFlowControlComboBox = new QComboBox();
300 _serialFlowControlComboBox->addItems(QString("OFF,XONXOFF,HARDWARE").split(","));
301 kk = _serialFlowControlComboBox->findText(settings.value("serialFlowControl").toString());
302 if (kk != -1) {
303 _serialFlowControlComboBox->setCurrentIndex(kk);
304 }
305 _serialDataBitsComboBox = new QComboBox();
306 _serialDataBitsComboBox->addItems(QString("5,6,7,8").split(","));
307 kk = _serialDataBitsComboBox->findText(settings.value("serialDataBits").toString());
308 if (kk != -1) {
309 _serialDataBitsComboBox->setCurrentIndex(kk);
310 }
311 _serialParityComboBox = new QComboBox();
312 _serialParityComboBox->addItems(QString("NONE,ODD,EVEN,SPACE").split(","));
313 kk = _serialParityComboBox->findText(settings.value("serialParity").toString());
314 if (kk != -1) {
315 _serialParityComboBox->setCurrentIndex(kk);
316 }
317 _serialStopBitsComboBox = new QComboBox();
318 _serialStopBitsComboBox->addItems(QString("1,2").split(","));
319 kk = _serialStopBitsComboBox->findText(settings.value("serialStopBits").toString());
320 if (kk != -1) {
321 _serialStopBitsComboBox->setCurrentIndex(kk);
322 }
323 _serialAutoNMEAComboBox = new QComboBox();
324 _serialAutoNMEAComboBox->addItems(QString("Auto,Manual").split(","));
325 kk = _serialAutoNMEAComboBox->findText(settings.value("serialAutoNMEA").toString());
326 if (kk != -1) {
327 _serialAutoNMEAComboBox->setCurrentIndex(kk);
328 }
329 _serialFileNMEALineEdit = new QLineEdit(settings.value("serialFileNMEA").toString());
330 _serialHeightNMEALineEdit = new QLineEdit(settings.value("serialHeightNMEA").toString());
331
332 // Outages Options
333 // ---------------
334 _obsRateComboBox = new QComboBox();
335 _obsRateComboBox->setEditable(false);
336 _obsRateComboBox->addItems(QString(",0.1 Hz,0.2 Hz,0.5 Hz,1 Hz,5 Hz").split(","));
337 kk = _obsRateComboBox->findText(settings.value("obsRate").toString());
338 if (kk != -1) {
339 _obsRateComboBox->setCurrentIndex(kk);
340 }
341 _adviseFailSpinBox = new QSpinBox();
342 _adviseFailSpinBox->setMinimum(0);
343 _adviseFailSpinBox->setMaximum(60);
344 _adviseFailSpinBox->setSingleStep(1);
345 _adviseFailSpinBox->setSuffix(" min");
346 _adviseFailSpinBox->setValue(settings.value("adviseFail").toInt());
347 _adviseRecoSpinBox = new QSpinBox();
348 _adviseRecoSpinBox->setMinimum(0);
349 _adviseRecoSpinBox->setMaximum(60);
350 _adviseRecoSpinBox->setSingleStep(1);
351 _adviseRecoSpinBox->setSuffix(" min");
352 _adviseRecoSpinBox->setValue(settings.value("adviseReco").toInt());
353 _adviseScriptLineEdit = new QLineEdit(settings.value("adviseScript").toString());
354
355 // Miscellaneous Options
356 // ---------------------
357 _miscMountLineEdit = new QLineEdit(settings.value("miscMount").toString());
358 _perfIntrComboBox = new QComboBox();
359 _perfIntrComboBox->setEditable(false);
360 _perfIntrComboBox->addItems(QString(",2 sec, 10 sec,1 min,5 min,15 min,1 hour,6 hours,1 day").split(","));
361 int ll = _perfIntrComboBox->findText(settings.value("perfIntr").toString());
362 if (ll != -1) {
363 _perfIntrComboBox->setCurrentIndex(ll);
364 }
365 _scanRTCMCheckBox = new QCheckBox();
366 _scanRTCMCheckBox->setCheckState(Qt::CheckState(
367 settings.value("scanRTCM").toInt()));
368
369 // Streams
370 // -------
371 _mountPointsTable = new QTableWidget(0,8);
372
373 _mountPointsTable->horizontalHeader()->resizeSection(1,34*ww);
374 _mountPointsTable->horizontalHeader()->resizeSection(2,9*ww);
375 _mountPointsTable->horizontalHeader()->resizeSection(3,7*ww);
376 _mountPointsTable->horizontalHeader()->resizeSection(4,7*ww);
377 _mountPointsTable->horizontalHeader()->resizeSection(5,5*ww);
378 _mountPointsTable->horizontalHeader()->resizeSection(6,5*ww);
379 _mountPointsTable->horizontalHeader()->setResizeMode(QHeaderView::Interactive);
380 _mountPointsTable->horizontalHeader()->setStretchLastSection(true);
381 _mountPointsTable->setHorizontalHeaderLabels(labels);
382 _mountPointsTable->setGridStyle(Qt::NoPen);
383 _mountPointsTable->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
384 _mountPointsTable->setSelectionMode(QAbstractItemView::ExtendedSelection);
385 _mountPointsTable->setSelectionBehavior(QAbstractItemView::SelectRows);
386 _mountPointsTable->hideColumn(0);
387 connect(_mountPointsTable, SIGNAL(itemSelectionChanged()),
388 SLOT(slotSelectionChanged()));
389 populateMountPointsTable();
390
391 _log = new QTextBrowser();
392 _log->setReadOnly(true);
393
394 // WhatsThis
395 // ---------
396 _proxyHostLineEdit->setWhatsThis(tr("<p>If you are running BNC 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 BNC. 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 BNC outside your LAN on a network that has unobstructed connection to the Internet.</p>"));
397 _proxyPortLineEdit->setWhatsThis(tr("<p>Enter your proxy server port number in case a proxy is operated in front of BNC.</p>"));
398 _waitTimeSpinBox->setWhatsThis(tr("<p>When feeding a real-time GNSS network engine waiting for synchronized input epoch by epoch, BNC drops whatever is received later than 'Wait for full epoch' seconds. A value of 3 to 5 seconds is recommended, depending on the latency of the incoming streams and the delay acceptable to your real-time GNSS network engine or products.</p>"));
399 _outFileLineEdit->setWhatsThis(tr("Specify the full path to a file where synchronized observations are saved in plain ASCII format. Beware that the size of this file can rapidly increase depending on the number of incoming streams."));
400 _outPortLineEdit->setWhatsThis(tr("BNC can produce synchronized observations in binary format on your local host through an IP port. Specify a port number here to activate this function."));
401 _outUPortLineEdit->setWhatsThis(tr("BNC can produce unsynchronized observations in binary format on your local host through an IP port. Specify a port number here to activate this function."));
402 _outEphPortLineEdit->setWhatsThis(tr("BNC can produce ephemeris data in RINEX ASCII format on your local host through an IP port. Specify a port number here to activate this function."));
403 _corrPortLineEdit->setWhatsThis(tr("BNC can produce Broadcast Ephemeris Corrections on your local host through an IP port. Specify a port number here to activate this function."));
404 _corrTimeSpinBox->setWhatsThis(tr("Concerning output through IP port, BNC drops Broadcast Ephemeris Corrections received later than 'Wait for full epoch' seconds. A value of 2 to 5 seconds is recommended, depending on the latency of the incoming correction stream(s) and the delay acceptable to your real-time application."));
405 _rnxPathLineEdit->setWhatsThis(tr("Here you specify the path to where the RINEX Observation files will be stored. If the specified directory does not exist, BNC will not create RINEX Observation files."));
406 _ephPathLineEdit->setWhatsThis(tr("Specify the path for saving Broadcast Ephemeris data as RINEX Navigation files. If the specified directory does not exist, BNC will not create RINEX Navigation files."));
407 _corrPathLineEdit->setWhatsThis(tr("Specify a directory for saving Broadcast Ephemeris Correction files. If the specified directory does not exist, BNC will not create the files."));
408 _rnxScrpLineEdit->setWhatsThis(tr("<p>Whenever a RINEX Observation file is saved, you might want to compress, copy or upload it immediately via FTP. BNC allows you to execute a script/batch file to carry out these operations. To do that specify the full path of the script/batch file here. BNC will pass the full RINEX Observation file path to the script as a command line parameter (%1 on Windows systems, $1 onUnix/Linux systems).</p>"));
409 _rnxSkelLineEdit->setWhatsThis(tr("<p>BNC allows using personal skeleton files that contain the header records you would like to include. You can derive a personal RINEX header skeleton file from the information given in an up to date sitelog.</p><p>A file in the RINEX Observations 'Directory' with a 'Skeleton extension' suffix is interpreted by BNC as a personal RINEX header skeleton file for the corresponding stream.</p>"));
410 _rnxAppendCheckBox->setWhatsThis(tr("<p>When BNC 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 BNC, a system crash or when BNC crashed. Tick 'Append files' to continue with existing files and keep what has been recorded so far.</p>"));
411 _autoStartCheckBox->setWhatsThis(tr("<p>Tick 'Auto start' for auto-start of BNC at startup time in window mode with preassigned processing options.</p>"));
412 _onTheFlyComboBox->setWhatsThis(tr("<p>When operating BNC online in 'no window' mode, some configuration parameters can be changed on-the-fly without interrupting the running process. For that BNC rereads parts of its configuration in pre-defined intervals.<p></p>Select '1 min', '1 hour', or '1 day' to force BNC to reread its configuration every full minute, hour, or day and let in between edited configuration options become effective on-the-fly without terminating uninvolved threads.</p><p>Note that when operating BNC in window mode, on-the-fly changeable configuration options become effective immediately through 'Save & Activate Options'.</p>"));
413 _rnxIntrComboBox->setWhatsThis(tr("<p>Select the length of the RINEX Observation file.</p>"));
414 _ephIntrComboBox->setWhatsThis(tr("<p>Select the length of the RINEX Navigation file.</p>"));
415 _corrIntrComboBox->setWhatsThis(tr("<p>Select the length of the Broadcast Ephemeris Correction files.</p>"));
416 _rnxSamplSpinBox->setWhatsThis(tr("<p>Select the RINEX Observation sampling interval in seconds. A value of zero '0' tells BNC to store all received epochs into RINEX.</p>"));
417 _binSamplSpinBox->setWhatsThis(tr("<p>Select the synchronized observation sampling interval in seconds. A value of zero '0' tells BNC to send/store all received epochs.</p>"));
418 _obsRateComboBox->setWhatsThis(tr("<p>BNC can collect all returns (success or failure) coming from a decoder within a certain short time span to then decide whether a stream has an outage or its content is corrupted. The procedure needs a rough estimate of the expected 'Observation rate' of the incoming streams. When a continuous problem is detected, BNC can inform its operator about this event through an advisory note.</p>"));
419 _adviseRecoSpinBox->setWhatsThis(tr("<p>Following a stream outage or a longer series of bad observations, an advisory note is generated when valid observations are received again throughout the 'Recovery threshold' time span. A value of about 5min (default) is recommended.</p><p>A value of zero '0' means that for any stream recovery, however short, BNC immediately generates an advisory note.</p>"));
420 _adviseFailSpinBox->setWhatsThis(tr("<p>An advisory note is generated when no (or only corrupted) observations are seen throughout the 'Failure threshold' time span. A value of 15 min (default) is recommended.</p><p>A value of zero '0' means that for any stream failure, however short, BNC immediately generates an advisory note.</p>"));
421 _logFileLineEdit->setWhatsThis(tr("<p>Records of BNC's activities are shown in the 'Logs' 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><p>The logfile name will automatically be extended by a string '_YYMMDD' carrying the current date."));
422 _adviseScriptLineEdit->setWhatsThis(tr("<p>Specify the full path to a script or batch file to handle advisory notes generated in the event of corrupted streams or stream outages. The affected mountpoint and one of the comments 'Begin_Outage', 'End_Outage', 'Begin_Corrupted', or 'End_Corrupted' are passed on to the script as command line parameters.</p><p>The script may have the task to send the advisory notes by email to BNC's operator and/or to the affected stream provider. An empty option field (default) or invalid path means that you don't want to use this option.</p>"));
423 _perfIntrComboBox->setWhatsThis(tr("<p>BNC can average latencies per stream over a certain period of GPS time. The resulting mean latencies are recorded in the 'Logs' section at the end of each 'Log latency' interval together with results of a statistical evaluation (approximate number of covered epochs, data gaps).</p><p>Select a 'Log latency' interval or select the empty option field if you do not want BNC to log latencies and statistical information.</p>"));
424 _mountPointsTable->setWhatsThis(tr("<p>Streams selected for retrieval are listed in the 'Streams' section. Clicking on 'Add Stream' button will open a window that allows the user to select data streams from an NTRIP broadcaster according to their mountpoints. To remove a stream from the 'Streams' list, highlight it by clicking on it and hit the 'Delete Stream' button. You can also remove multiple streams by highlighting them using +Shift and +Ctrl.</p><p>BNC automatically allocates one of its internal decoders to a stream based on the stream's 'format' as given in the sourcetable. BNC allows users to change this selection by editing the decoder string. Double click on the 'decoder' field, enter your preferred decoder and then hit Enter. The accepted decoder strings are 'RTCM_2.x', 'RTCM_3.x', and 'RTIGS'.</p><p>In case you need to log the raw data as is, BNC allows users to by-pass its decoders and and directly save the input in daily log files. To do this specify the decoder string as 'ZERO'.</p><p>BNC can also retrieve streams from virtual reference stations (VRS). VRS streams are indicated by a 'yes' in the 'nmea' column. To initiate these streams, the approximate latitude/longitude rover position is sent to the NTRIP broadcaster. The default values can be change according to your requirement. Double click on 'lat' and 'long' fields, enter the values you wish to send and then hit Enter.</p>"));
425 _log->setWhatsThis(tr("Records of BNC's activities are shown in the 'Logs' section. The message log covers the communication status between BNC and the NTRIP broadcaster as well as any problems that occur in the communication link, stream availability, stream delay, stream conversion etc."));
426 _ephV3CheckBox->setWhatsThis(tr("The default format for output of RINEX Navigation data containing Broadcast Ephemeris is RINEX Version 2.11. Select 'Version 3' if you want to output the ephemeris in RINEX Version 3 format."));
427 _rnxV3CheckBox->setWhatsThis(tr("The default format for RINEX Observation files is RINEX Version 2.11. Select 'Version 3' if you want to save the observations in RINEX Version 3 format."));
428 _miscMountLineEdit->setWhatsThis(tr("<p>Specify a mountpoint to apply any of the options shown below. Enter 'ALL' if you want to apply these options to all configured streams.</p><p>An empty option field (default) means that you don't want BNC to apply any of these options.</p>"));
429 _scanRTCMCheckBox->setWhatsThis(tr("<p>Tick 'Scan RTCM' to log the numbers of incomming message types as well as contained antenna coordinates, antenna heigt, and antenna descriptor.</p>"));
430 _serialMountPointLineEdit->setWhatsThis(tr("<p>Enter a 'Mountpoint' to forward the corresponding stream to a serial connected receiver.</p>"));
431 _serialPortNameLineEdit->setWhatsThis(tr("<p>Enter the serial 'Port name' selected for communication with your serial connected receiver. Valid port names are</p><pre>Windows: COM1, COM2<br>Linux: /dev/ttyS0, /dev/ttyS1<br>FreeBSD: /dev/ttyd0, /dev/ttyd1<br>Digital Unix: /dev/tty01, /dev/tty02<br>HP-UX: /dev/tty1p0, /dev/tty2p0<br>SGI/IRIX: /dev/ttyf1, /dev/ttyf2<br>SunOS/Solaris: /dev/ttya, /dev/ttyb</pre><p>Note that you must plug a serial cable in the port defined here before you start BNC.</p>"));
432 _serialBaudRateComboBox->setWhatsThis(tr("<p>Select a 'Baud rate' for the serial output link.</p><p>Note that your selection must equal the baud rate configured to the serial connected receiver. Note further that using a high baud rate is recommended.</p>"));
433 _serialParityComboBox->setWhatsThis(tr("<p>Select the 'Parity' for the serial output link.</p><p>Note that your selection must equal the parity selection configured to the serial connected receiver. Note further that parity is often set to 'NONE'.</p>"));
434 _serialDataBitsComboBox->setWhatsThis(tr("<p>Select the number of 'Data bits' for the serial output link.</p><p>Note that your selection must equal the number of data bits configured to the serial connected receiver. Note further that often 8 data bits are used.</p>"));
435 _serialStopBitsComboBox->setWhatsThis(tr("<p>Select the number of 'Stop bits' for the serial output link.</p><p>Note that your selection must equal the number of stop bits configured to the serial connected receiver. Note further that often 1 stop bit is used.</p>"));
436 _serialFlowControlComboBox->setWhatsThis(tr("<p>Select a 'Flow control' for the serial output link.</p><p>Note that your selection must equal the flow control configured to the serial connected receiver. Select 'OFF' if you don't know better.</p>"));
437 _serialAutoNMEAComboBox->setWhatsThis(tr("<p>Select 'Auto' to automatically forward NMEA-GGA messages coming from your serial connected receiver to the NTRIP broadcaster and/or save them in a file.</p><p>Select 'Manual' only when handling a VRS stream and your serial connected receiver doesn't generate NMEA-GGA messages.</p>"));
438 _serialFileNMEALineEdit->setWhatsThis(tr("<p>Specify the full path to a file where NMEA messages coming from your serial connected receiver are saved.</p>"));
439 _serialHeightNMEALineEdit->setWhatsThis(tr("<p>Specify an approximate 'Height' above mean sea level in meter for your VRS to simulate an inital NMEA-GGA message.</p><p>The setting of this option is ignored in case of streams coming from physical reference stations.</p>"));
440
441 // Canvas with Editable Fields
442 // ---------------------------
443 _canvas = new QWidget;
444 setCentralWidget(_canvas);
445
446 aogroup = new QTabWidget();
447 QWidget* pgroup = new QWidget();
448 QWidget* ggroup = new QWidget();
449 QWidget* sgroup = new QWidget();
450 QWidget* egroup = new QWidget();
451 QWidget* agroup = new QWidget();
452 QWidget* cgroup = new QWidget();
453 QWidget* ogroup = new QWidget();
454 QWidget* rgroup = new QWidget();
455 QWidget* sergroup = new QWidget();
456 aogroup->addTab(pgroup,tr("Proxy"));
457 aogroup->addTab(ggroup,tr("General"));
458 aogroup->addTab(ogroup,tr("RINEX Observations"));
459 aogroup->addTab(egroup,tr("RINEX Ephemeris"));
460 aogroup->addTab(cgroup,tr("Broadcast Corrections"));
461 aogroup->addTab(sgroup,tr("Feed Engine"));
462 aogroup->addTab(sergroup,tr("Serial Output"));
463 aogroup->addTab(agroup,tr("Outages"));
464 aogroup->addTab(rgroup,tr("Miscellaneous"));
465
466// Begin new Perlt
467
468 loggroup = new QTabWidget();
469 QWidget* log1group = new QWidget();
470 QWidget* log2group = new QWidget();
471 loggroup->addTab(log1group,tr("Log"));
472 loggroup->addTab(log2group,tr("Status"));
473
474 // log Tab
475 // -------
476 QGridLayout* log1Layout = new QGridLayout;
477 log1Layout->addWidget(_log, 0,0);
478 log1group->setLayout(log1Layout);
479
480 // Status Tab
481 // ----------
482 QGridLayout* log2Layout = new QGridLayout;
483 log2Layout->addWidget(_Figure1, 0,0);
484 log2group->setLayout(log2Layout);
485
486// End new Perlt
487
488 // Proxy Tab
489 // ---------
490 QGridLayout* pLayout = new QGridLayout;
491 pLayout->setColumnMinimumWidth(0,13*ww);
492 _proxyPortLineEdit->setMaximumWidth(9*ww);
493
494 pLayout->addWidget(new QLabel("Proxy host"), 0, 0);
495 pLayout->addWidget(_proxyHostLineEdit, 0, 1, 1,10);
496 pLayout->addWidget(new QLabel("Proxy port"), 1, 0);
497 pLayout->addWidget(_proxyPortLineEdit, 1, 1);
498 pLayout->addWidget(new QLabel("Settings for the proxy in protected networks, leave boxes blank if none."),2, 0, 1, 50, Qt::AlignLeft);
499 pLayout->addWidget(new QLabel(" "),3,0);
500 pLayout->addWidget(new QLabel(" "),4,0);
501 pLayout->addWidget(new QLabel(" "),5,0);
502 pgroup->setLayout(pLayout);
503
504
505 connect(_proxyHostLineEdit, SIGNAL(textChanged(const QString &)),
506 this, SLOT(bncText(const QString &)));
507 if (_proxyHostLineEdit->text().isEmpty()) {
508 _proxyPortLineEdit->setStyleSheet("background-color: lightGray");
509 _proxyPortLineEdit->setEnabled(false);
510 }
511
512 // General Tab
513 // -----------
514 QGridLayout* gLayout = new QGridLayout;
515 gLayout->setColumnMinimumWidth(0,14*ww);
516 _onTheFlyComboBox->setMaximumWidth(9*ww);
517
518 gLayout->addWidget(new QLabel("Logfile (full path)"), 0, 0);
519 gLayout->addWidget(_logFileLineEdit, 0, 1, 1,30); // 1
520 gLayout->addWidget(new QLabel("Append files"), 1, 0);
521 gLayout->addWidget(_rnxAppendCheckBox, 1, 1);
522 gLayout->addWidget(new QLabel("Reread configuration"), 2, 0);
523 gLayout->addWidget(_onTheFlyComboBox, 2, 1);
524 gLayout->addWidget(new QLabel("Auto start"), 3, 0);
525 gLayout->addWidget(_autoStartCheckBox, 3, 1);
526 gLayout->addWidget(new QLabel("General settings for logfile, file handling, configuration on-the-fly, and auto-start."),4, 0, 1, 50, Qt::AlignLeft); // 2
527 gLayout->addWidget(new QLabel(" "),5,0);
528 ggroup->setLayout(gLayout);
529
530 // RINEX Observations
531 // ------------------
532 QGridLayout* oLayout = new QGridLayout;
533 oLayout->setColumnMinimumWidth(0,14*ww);
534 _rnxIntrComboBox->setMaximumWidth(9*ww);
535 _rnxSamplSpinBox->setMaximumWidth(9*ww);
536
537 oLayout->addWidget(new QLabel("Directory"), 0, 0);
538 oLayout->addWidget(_rnxPathLineEdit, 0, 1,1,24);
539 oLayout->addWidget(new QLabel("Interval"), 1, 0);
540 oLayout->addWidget(_rnxIntrComboBox, 1, 1);
541 oLayout->addWidget(new QLabel(" Sampling"), 1, 2, Qt::AlignRight);
542 oLayout->addWidget(_rnxSamplSpinBox, 1, 3, Qt::AlignLeft);
543 oLayout->addWidget(new QLabel("Skeleton extension"), 2, 0);
544 oLayout->addWidget(_rnxSkelLineEdit, 2, 1,1,1, Qt::AlignLeft);
545 oLayout->addWidget(new QLabel("Script (full path)"), 3, 0);
546 oLayout->addWidget(_rnxScrpLineEdit, 3, 1,1,24);
547 oLayout->addWidget(new QLabel("Version 3"), 4, 0);
548 oLayout->addWidget(_rnxV3CheckBox, 4, 1);
549 oLayout->addWidget(new QLabel("Saving RINEX observation files."),5,0,1,50, Qt::AlignLeft);
550 ogroup->setLayout(oLayout);
551
552 connect(_rnxPathLineEdit, SIGNAL(textChanged(const QString &)),
553 this, SLOT(bncText(const QString &)));
554 if (_rnxPathLineEdit->text().isEmpty()) {
555 _rnxIntrComboBox->setStyleSheet("background-color: lightGray");
556 _rnxSamplSpinBox->setStyleSheet("background-color: lightGray");
557 _rnxSkelLineEdit->setStyleSheet("background-color: lightGray");
558 _rnxScrpLineEdit->setStyleSheet("background-color: lightGray");
559 palette.setColor(_rnxV3CheckBox->backgroundRole(), lightGray);
560 _rnxV3CheckBox->setPalette(palette);
561 _rnxIntrComboBox->setEnabled(false);
562 _rnxSamplSpinBox->setEnabled(false);
563 _rnxSkelLineEdit->setEnabled(false);
564 _rnxScrpLineEdit->setEnabled(false);
565 _rnxV3CheckBox->setEnabled(false);
566 }
567
568 // RINEX Ephemeris
569 // ---------------
570 QGridLayout* eLayout = new QGridLayout;
571 eLayout->setColumnMinimumWidth(0,14*ww);
572 _ephIntrComboBox->setMaximumWidth(9*ww);
573 _outEphPortLineEdit->setMaximumWidth(9*ww);
574
575 eLayout->addWidget(new QLabel("Directory"), 0, 0);
576 eLayout->addWidget(_ephPathLineEdit, 0, 1, 1,30);
577 eLayout->addWidget(new QLabel("Interval"), 1, 0);
578 eLayout->addWidget(_ephIntrComboBox, 1, 1);
579 eLayout->addWidget(new QLabel("Port"), 2, 0);
580 eLayout->addWidget(_outEphPortLineEdit, 2, 1);
581 eLayout->addWidget(new QLabel("Version 3"), 3, 0);
582 eLayout->addWidget(_ephV3CheckBox, 3, 1);
583 eLayout->addWidget(new QLabel("Saving RINEX ephemeris files and ephemeris output through IP port."),4,0,1,50,Qt::AlignLeft);
584 eLayout->addWidget(new QLabel(" "),5,0);
585 egroup->setLayout(eLayout);
586
587 connect(_ephPathLineEdit, SIGNAL(textChanged(const QString &)),
588 this, SLOT(bncText(const QString &)));
589 connect(_outEphPortLineEdit, SIGNAL(textChanged(const QString &)),
590 this, SLOT(bncText(const QString &)));
591
592 if (_ephPathLineEdit->text().isEmpty() && _outEphPortLineEdit->text().isEmpty()) {
593 _ephIntrComboBox->setStyleSheet("background-color: lightGray");
594 palette.setColor(_ephV3CheckBox->backgroundRole(), lightGray);
595 _ephV3CheckBox->setPalette(palette);
596 _ephIntrComboBox->setEnabled(false);
597 _ephV3CheckBox->setEnabled(false);
598 }
599 if (_ephPathLineEdit->text().isEmpty() && !_outEphPortLineEdit->text().isEmpty()) {
600 _ephIntrComboBox->setStyleSheet("background-color: lightGray");
601 _ephIntrComboBox->setEnabled(false);
602 }
603
604 // Broadcast Corrections
605 // ---------------------
606 QGridLayout* cLayout = new QGridLayout;
607 cLayout->setColumnMinimumWidth(0,14*ww);
608 _corrIntrComboBox->setMaximumWidth(9*ww);
609 _corrPortLineEdit->setMaximumWidth(9*ww);
610 _corrTimeSpinBox->setMaximumWidth(9*ww);
611
612 cLayout->addWidget(new QLabel("Directory"), 0, 0);
613 cLayout->addWidget(_corrPathLineEdit, 0, 1,1,20);
614 cLayout->addWidget(new QLabel("Interval"), 1, 0);
615 cLayout->addWidget(_corrIntrComboBox, 1, 1);
616 cLayout->addWidget(new QLabel("Port"), 2, 0);
617 cLayout->addWidget(_corrPortLineEdit, 2, 1);
618 cLayout->addWidget(new QLabel(" Wait for full epoch"), 2, 2, Qt::AlignRight);
619 cLayout->addWidget(_corrTimeSpinBox, 2, 3, Qt::AlignLeft);
620 cLayout->addWidget(new QLabel("Saving Broadcast Ephemeris correction files and correction output through IP port."),3,0,1,50);
621 cLayout->addWidget(new QLabel(" "),4,0);
622 cLayout->addWidget(new QLabel(" "),5,0);
623 cgroup->setLayout(cLayout);
624
625 connect(_corrPathLineEdit, SIGNAL(textChanged(const QString &)),
626 this, SLOT(bncText(const QString &)));
627 connect(_corrPortLineEdit, SIGNAL(textChanged(const QString &)),
628 this, SLOT(bncText(const QString &)));
629 if (_corrPathLineEdit->text().isEmpty()) {
630 _corrIntrComboBox->setStyleSheet("background-color: lightGray");
631 _corrIntrComboBox->setEnabled(false);
632 }
633 if (_corrPortLineEdit->text().isEmpty()) {
634 _corrTimeSpinBox->setStyleSheet("background-color: lightGray");
635 _corrTimeSpinBox->setEnabled(false);
636 }
637
638 // Feed Engine
639 // -----------
640 QGridLayout* sLayout = new QGridLayout;
641 sLayout->setColumnMinimumWidth(0,14*ww);
642 _outPortLineEdit->setMaximumWidth(9*ww);
643 _waitTimeSpinBox->setMaximumWidth(9*ww);
644 _binSamplSpinBox->setMaximumWidth(9*ww);
645 _outUPortLineEdit->setMaximumWidth(9*ww);
646
647 sLayout->addWidget(new QLabel("Port"), 0, 0);
648 sLayout->addWidget(_outPortLineEdit, 0, 1);
649 sLayout->addWidget(new QLabel("Wait for full epoch"), 0, 2, Qt::AlignRight);
650 sLayout->addWidget(_waitTimeSpinBox, 0, 3, Qt::AlignLeft);
651 sLayout->addWidget(new QLabel("Sampling"), 1, 0);
652 sLayout->addWidget(_binSamplSpinBox, 1, 1, Qt::AlignLeft);
653 sLayout->addWidget(new QLabel("File (full path)"), 2, 0);
654 sLayout->addWidget(_outFileLineEdit, 2, 1, 1, 20);
655 sLayout->addWidget(new QLabel("Port (unsynchronized)"), 3, 0);
656 sLayout->addWidget(_outUPortLineEdit, 3, 1);
657 sLayout->addWidget(new QLabel("Output decoded observations in a binary format to feed a real-time GNSS network engine."),4,0,1,50);
658 sLayout->addWidget(new QLabel(" "),5,0);
659 sgroup->setLayout(sLayout);
660
661 connect(_outPortLineEdit, SIGNAL(textChanged(const QString &)),
662 this, SLOT(bncText(const QString &)));
663 connect(_outFileLineEdit, SIGNAL(textChanged(const QString &)),
664 this, SLOT(bncText(const QString &)));
665 if (_outPortLineEdit->text().isEmpty() && _outFileLineEdit->text().isEmpty()) {
666 _waitTimeSpinBox->setStyleSheet("background-color: lightGray");
667 _binSamplSpinBox->setStyleSheet("background-color: lightGray");
668 _waitTimeSpinBox->setEnabled(false);
669 _binSamplSpinBox->setEnabled(false);
670 }
671
672 // Serial Output
673 // -------------
674 QGridLayout* serLayout = new QGridLayout;
675 serLayout->setColumnMinimumWidth(0,14*ww);
676 _serialBaudRateComboBox->setMaximumWidth(9*ww);
677 _serialFlowControlComboBox->setMaximumWidth(11*ww);
678 _serialDataBitsComboBox->setMaximumWidth(5*ww);
679 _serialParityComboBox->setMaximumWidth(9*ww);
680 _serialStopBitsComboBox->setMaximumWidth(5*ww);
681 _serialAutoNMEAComboBox->setMaximumWidth(9*ww);
682 _serialHeightNMEALineEdit->setMaximumWidth(8*ww);
683
684 serLayout->addWidget(new QLabel("Mountpoint"), 0,0, Qt::AlignLeft);
685 serLayout->addWidget(_serialMountPointLineEdit, 0,1,1,2);
686 serLayout->addWidget(new QLabel("Port name"), 1,0, Qt::AlignLeft);
687 serLayout->addWidget(_serialPortNameLineEdit, 1,1,1,2);
688 serLayout->addWidget(new QLabel("Baud rate"), 2,0, Qt::AlignLeft);
689 serLayout->addWidget(_serialBaudRateComboBox, 2,1);
690 serLayout->addWidget(new QLabel("Flow control"), 2,2, Qt::AlignRight);
691 serLayout->addWidget(_serialFlowControlComboBox, 2,3);
692 serLayout->addWidget(new QLabel("Data bits"), 3,0, Qt::AlignLeft);
693 serLayout->addWidget(_serialDataBitsComboBox, 3,1);
694 serLayout->addWidget(new QLabel("Parity"), 3,2, Qt::AlignRight);
695 serLayout->addWidget(_serialParityComboBox, 3,3);
696 serLayout->addWidget(new QLabel(" Stop bits"), 3,4, Qt::AlignRight);
697 serLayout->addWidget(_serialStopBitsComboBox, 3,5);
698 serLayout->addWidget(new QLabel("NMEA"), 4,0);
699 serLayout->addWidget(_serialAutoNMEAComboBox, 4,1);
700 serLayout->addWidget(new QLabel(" File (full path)"), 4,2, Qt::AlignRight);
701 serLayout->addWidget(_serialFileNMEALineEdit, 4,3,1,15);
702 serLayout->addWidget(new QLabel("Height"), 4,20, Qt::AlignRight);
703 serLayout->addWidget(_serialHeightNMEALineEdit, 4,21,1,11);
704 serLayout->addWidget(new QLabel("Port settings to feed a serial connected receiver."),5,0,1,30);
705
706 connect(_serialMountPointLineEdit, SIGNAL(textChanged(const QString &)),
707 this, SLOT(bncText(const QString &)));
708 connect(_serialAutoNMEAComboBox, SIGNAL(currentIndexChanged(const QString &)),
709 this, SLOT(bncText(const QString)));
710 if (_serialMountPointLineEdit->text().isEmpty()) {
711 _serialPortNameLineEdit->setStyleSheet("background-color: lightGray");
712 _serialBaudRateComboBox->setStyleSheet("background-color: lightGray");
713 _serialParityComboBox->setStyleSheet("background-color: lightGray");
714 _serialDataBitsComboBox->setStyleSheet("background-color: lightGray");
715 _serialStopBitsComboBox->setStyleSheet("background-color: lightGray");
716 _serialFlowControlComboBox->setStyleSheet("background-color: lightGray");
717 _serialAutoNMEAComboBox->setStyleSheet("background-color: lightGray");
718 _serialFileNMEALineEdit->setStyleSheet("background-color: lightGray");
719 _serialHeightNMEALineEdit->setStyleSheet("background-color: lightGray");
720 _serialPortNameLineEdit->setEnabled(false);
721 _serialBaudRateComboBox->setEnabled(false);
722 _serialParityComboBox->setEnabled(false);
723 _serialDataBitsComboBox->setEnabled(false);
724 _serialStopBitsComboBox->setEnabled(false);
725 _serialFlowControlComboBox->setEnabled(false);
726 _serialAutoNMEAComboBox->setEnabled(false);
727 _serialFileNMEALineEdit->setEnabled(false);
728 _serialHeightNMEALineEdit->setEnabled(false);
729 } else {
730 if (_serialAutoNMEAComboBox->currentText() == "Auto" ) {
731 _serialHeightNMEALineEdit->setStyleSheet("background-color: lightGray");
732 _serialHeightNMEALineEdit->setEnabled(false);
733 }
734 if (_serialAutoNMEAComboBox->currentText() != "Auto" ) {
735 _serialFileNMEALineEdit->setStyleSheet("background-color: lightGray");
736 _serialFileNMEALineEdit->setEnabled(false);
737 }
738 }
739
740 sergroup->setLayout(serLayout);
741
742 // Outages
743 // -------
744 QGridLayout* aLayout = new QGridLayout;
745 aLayout->setColumnMinimumWidth(0,14*ww);
746 _obsRateComboBox->setMaximumWidth(9*ww);
747 _adviseFailSpinBox->setMaximumWidth(9*ww);
748 _adviseRecoSpinBox->setMaximumWidth(9*ww);
749
750 aLayout->addWidget(new QLabel("Observation rate"), 0, 0);
751 aLayout->addWidget(_obsRateComboBox, 0, 1);
752 aLayout->addWidget(new QLabel("Failure threshold"), 1, 0);
753 aLayout->addWidget(_adviseFailSpinBox, 1, 1);
754 aLayout->addWidget(new QLabel("Recovery threshold"), 2, 0);
755 aLayout->addWidget(_adviseRecoSpinBox, 2, 1);
756 aLayout->addWidget(new QLabel("Script (full path)"), 3, 0);
757 aLayout->addWidget(_adviseScriptLineEdit, 3, 1,1,30);
758 aLayout->addWidget(new QLabel("Failure and recovery reports, advisory notes."),5,0,1,50,Qt::AlignLeft);
759 agroup->setLayout(aLayout);
760
761 connect(_obsRateComboBox, SIGNAL(currentIndexChanged(const QString &)),
762 this, SLOT(bncText(const QString)));
763 if (_obsRateComboBox->currentText().isEmpty()) {
764 _adviseFailSpinBox->setStyleSheet("background-color: lightGray");
765 _adviseRecoSpinBox->setStyleSheet("background-color: lightGray");
766 _adviseScriptLineEdit->setStyleSheet("background-color: lightGray");
767 _adviseFailSpinBox->setEnabled(false);
768 _adviseRecoSpinBox->setEnabled(false);
769 _adviseScriptLineEdit->setEnabled(false);
770 }
771
772 // Miscellaneous
773 // -------------
774 QGridLayout* rLayout = new QGridLayout;
775 rLayout->setColumnMinimumWidth(0,14*ww);
776 _perfIntrComboBox->setMaximumWidth(9*ww);
777
778 rLayout->addWidget(new QLabel("Mountpoint"), 0, 0);
779 rLayout->addWidget(_miscMountLineEdit, 0, 1, 1,7);
780 rLayout->addWidget(new QLabel("Log latency"), 1, 0);
781 rLayout->addWidget(_perfIntrComboBox, 1, 1);
782 rLayout->addWidget(new QLabel("Scan RTCM"), 2, 0);
783 rLayout->addWidget(_scanRTCMCheckBox, 2, 1);
784 rLayout->addWidget(new QLabel("Log latencies or scan RTCM streams for numbers of message types and antenna information."),3, 0,1,30);
785 rLayout->addWidget(new QLabel(" "), 4, 0);
786 rLayout->addWidget(new QLabel(" "), 5, 0);
787 rgroup->setLayout(rLayout);
788
789 connect(_miscMountLineEdit, SIGNAL(textChanged(const QString &)),
790 this, SLOT(bncText(const QString &)));
791 if (_miscMountLineEdit->text().isEmpty()) {
792 _perfIntrComboBox->setStyleSheet("background-color: lightGray");
793 palette.setColor(_scanRTCMCheckBox->backgroundRole(), lightGray);
794 _scanRTCMCheckBox->setPalette(palette);
795 _perfIntrComboBox->setEnabled(false);
796 _scanRTCMCheckBox->setEnabled(false);
797 }
798
799 // Main Layout
800 // -----------
801
802 QGridLayout* mLayout = new QGridLayout;
803 aogroup->setCurrentIndex(settings.value("startTab").toInt());
804 mLayout->addWidget(aogroup, 0,0);
805 mLayout->addWidget(_mountPointsTable, 1,0);
806
807// Begin new Perlt
808// mLayout->addWidget(new QLabel(" Logs:"),2,0);
809// mLayout->addWidget(_log, 3,0);
810 QTimer *timer = new QTimer(this);
811 connect(timer, SIGNAL(timeout()), _Figure1, SLOT(nextAnimationFrame()));
812 mLayout->addWidget(loggroup, 2,0);
813 timer->start(100);
814
815// End new Perlt
816
817 _canvas->setLayout(mLayout);
818
819 // Auto start
820 // ----------
821 if ( Qt::CheckState(settings.value("autoStart").toInt()) == Qt::Checked) {
822 slotGetData();
823 }
824}
825
826// Destructor
827////////////////////////////////////////////////////////////////////////////
828bncWindow::~bncWindow() {
829 delete _caster;
830}
831
832//
833////////////////////////////////////////////////////////////////////////////
834void bncWindow::populateMountPointsTable() {
835
836 for (int iRow = _mountPointsTable->rowCount()-1; iRow >=0; iRow--) {
837 _mountPointsTable->removeRow(iRow);
838 }
839
840 bncSettings settings;
841
842 QListIterator<QString> it(settings.value("mountPoints").toStringList());
843 if (!it.hasNext()) {
844 _actGetData->setEnabled(false);
845 }
846 int iRow = 0;
847 while (it.hasNext()) {
848 QStringList hlp = it.next().split(" ");
849 if (hlp.size() < 5) continue;
850 _mountPointsTable->insertRow(iRow);
851
852 QUrl url(hlp[0]);
853
854 QString fullPath = url.host() + QString(":%1").arg(url.port()) + url.path();
855 QString format(hlp[1]); QString latitude(hlp[2]); QString longitude(hlp[3]);
856 QString nmea(hlp[4]);
857 if (hlp[5] == "S") {
858 fullPath = hlp[0].replace(0,2,"");
859 }
860 QString ntripVersion = "1";
861 if (hlp.size() >= 6) {
862 ntripVersion = (hlp[5]);
863 }
864
865 QTableWidgetItem* it;
866 it = new QTableWidgetItem(url.userInfo());
867 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
868 _mountPointsTable->setItem(iRow, 0, it);
869
870 it = new QTableWidgetItem(fullPath);
871 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
872 _mountPointsTable->setItem(iRow, 1, it);
873
874 it = new QTableWidgetItem(format);
875 _mountPointsTable->setItem(iRow, 2, it);
876
877 if (nmea == "yes") {
878 it = new QTableWidgetItem(latitude);
879 _mountPointsTable->setItem(iRow, 3, it);
880 it = new QTableWidgetItem(longitude);
881 _mountPointsTable->setItem(iRow, 4, it);
882 } else {
883 it = new QTableWidgetItem(latitude);
884 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
885 _mountPointsTable->setItem(iRow, 3, it);
886 it = new QTableWidgetItem(longitude);
887 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
888 _mountPointsTable->setItem(iRow, 4, it);
889 }
890
891 it = new QTableWidgetItem(nmea);
892 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
893 _mountPointsTable->setItem(iRow, 5, it);
894
895 it = new QTableWidgetItem(ntripVersion);
896 //// it->setFlags(it->flags() & ~Qt::ItemIsEditable);
897 _mountPointsTable->setItem(iRow, 6, it);
898
899 bncTableItem* bncIt = new bncTableItem();
900 bncIt->setFlags(bncIt->flags() & ~Qt::ItemIsEditable);
901 _mountPointsTable->setItem(iRow, 7, bncIt);
902
903 iRow++;
904 }
905
906 _mountPointsTable->sortItems(1);
907}
908
909// Retrieve Table
910////////////////////////////////////////////////////////////////////////////
911void bncWindow::slotAddMountPoints() {
912
913 bncSettings settings;
914 QString proxyHost = settings.value("proxyHost").toString();
915 int proxyPort = settings.value("proxyPort").toInt();
916 if (proxyHost != _proxyHostLineEdit->text() ||
917 proxyPort != _proxyPortLineEdit->text().toInt()) {
918 int iRet = QMessageBox::question(this, "Question", "Proxy options "
919 "changed. Use the new ones?",
920 QMessageBox::Yes, QMessageBox::No,
921 QMessageBox::NoButton);
922 if (iRet == QMessageBox::Yes) {
923 settings.setValue("proxyHost", _proxyHostLineEdit->text());
924 settings.setValue("proxyPort", _proxyPortLineEdit->text());
925 settings.sync();
926 }
927 }
928
929 QMessageBox msgBox;
930 msgBox.setIcon(QMessageBox::Question);
931 msgBox.setWindowTitle("Add Stream");
932 msgBox.setText("Add stream(s) coming from:");
933
934 QPushButton* buttonNtrip = msgBox.addButton(tr("Caster"), QMessageBox::ActionRole);
935 QPushButton* buttonIP = msgBox.addButton(tr("TCP/IP port"), QMessageBox::ActionRole);
936 QPushButton* buttonUDP = msgBox.addButton(tr("UDP port"), QMessageBox::ActionRole);
937 QPushButton* buttonSerial = msgBox.addButton(tr("Serial port"), QMessageBox::ActionRole);
938 QPushButton* buttonCancel = msgBox.addButton(tr("Cancel"), QMessageBox::ActionRole);
939
940 msgBox.exec();
941
942 if (msgBox.clickedButton() == buttonNtrip) {
943 bncTableDlg* dlg = new bncTableDlg(this);
944 dlg->move(this->pos().x()+50, this->pos().y()+50);
945 connect(dlg, SIGNAL(newMountPoints(QStringList*)),
946 this, SLOT(slotNewMountPoints(QStringList*)));
947 dlg->exec();
948 delete dlg;
949 } else if (msgBox.clickedButton() == buttonIP) {
950 bncIpPort* ipp = new bncIpPort(this);
951 connect(ipp, SIGNAL(newMountPoints(QStringList*)),
952 this, SLOT(slotNewMountPoints(QStringList*)));
953 ipp->exec();
954 delete ipp;
955 } else if (msgBox.clickedButton() == buttonUDP) {
956 bncUdpPort* udp = new bncUdpPort(this);
957 connect(udp, SIGNAL(newMountPoints(QStringList*)),
958 this, SLOT(slotNewMountPoints(QStringList*)));
959 udp->exec();
960 delete udp;
961 } else if (msgBox.clickedButton() == buttonSerial) {
962 bncSerialPort* sep = new bncSerialPort(this);
963 connect(sep, SIGNAL(newMountPoints(QStringList*)),
964 this, SLOT(slotNewMountPoints(QStringList*)));
965 sep->exec();
966 delete sep;
967 } else if (msgBox.clickedButton() == buttonCancel) {
968 // Cancel
969 }
970}
971
972// Delete Selected Mount Points
973////////////////////////////////////////////////////////////////////////////
974void bncWindow::slotDeleteMountPoints() {
975
976 int nRows = _mountPointsTable->rowCount();
977 bool flg[nRows];
978 for (int iRow = 0; iRow < nRows; iRow++) {
979 if (_mountPointsTable->isItemSelected(_mountPointsTable->item(iRow,1))) {
980 flg[iRow] = true;
981 }
982 else {
983 flg[iRow] = false;
984 }
985 }
986 for (int iRow = nRows-1; iRow >= 0; iRow--) {
987 if (flg[iRow]) {
988 _mountPointsTable->removeRow(iRow);
989 }
990 }
991 _actDeleteMountPoints->setEnabled(false);
992
993 if (_mountPointsTable->rowCount() == 0) {
994 _actGetData->setEnabled(false);
995 }
996}
997
998// New Mount Points Selected
999////////////////////////////////////////////////////////////////////////////
1000void bncWindow::slotNewMountPoints(QStringList* mountPoints) {
1001 int iRow = 0;
1002 QListIterator<QString> it(*mountPoints);
1003 while (it.hasNext()) {
1004 QStringList hlp = it.next().split(" ");
1005 QUrl url(hlp[0]);
1006 QString fullPath = url.host() + QString(":%1").arg(url.port()) + url.path();
1007 QString format(hlp[1]); QString latitude(hlp[2]); QString longitude(hlp[3]);
1008 QString nmea(hlp[4]);
1009 if (hlp[5] == "S") {
1010 fullPath = hlp[0].replace(0,2,"");
1011 }
1012 QString ntripVersion = "1";
1013 if (hlp.size() >= 6) {
1014 ntripVersion = (hlp[5]);
1015 }
1016
1017 _mountPointsTable->insertRow(iRow);
1018
1019 QTableWidgetItem* it;
1020 it = new QTableWidgetItem(url.userInfo());
1021 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
1022 _mountPointsTable->setItem(iRow, 0, it);
1023
1024 it = new QTableWidgetItem(fullPath);
1025 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
1026 _mountPointsTable->setItem(iRow, 1, it);
1027
1028 it = new QTableWidgetItem(format);
1029 _mountPointsTable->setItem(iRow, 2, it);
1030
1031 if (nmea == "yes") {
1032 it = new QTableWidgetItem(latitude);
1033 _mountPointsTable->setItem(iRow, 3, it);
1034 it = new QTableWidgetItem(longitude);
1035 _mountPointsTable->setItem(iRow, 4, it);
1036 } else {
1037 it = new QTableWidgetItem(latitude);
1038 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
1039 _mountPointsTable->setItem(iRow, 3, it);
1040 it = new QTableWidgetItem(longitude);
1041 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
1042 _mountPointsTable->setItem(iRow, 4, it);
1043 }
1044
1045 it = new QTableWidgetItem(nmea);
1046 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
1047 _mountPointsTable->setItem(iRow, 5, it);
1048
1049 it = new QTableWidgetItem(ntripVersion);
1050 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
1051 _mountPointsTable->setItem(iRow, 6, it);
1052
1053 bncTableItem* bncIt = new bncTableItem();
1054 _mountPointsTable->setItem(iRow, 7, bncIt);
1055
1056 iRow++;
1057 }
1058 _mountPointsTable->hideColumn(0);
1059 _mountPointsTable->sortItems(1);
1060 if (mountPoints->count() > 0 && !_actStop->isEnabled()) {
1061 _actGetData->setEnabled(true);
1062 }
1063 delete mountPoints;
1064}
1065
1066// Save Options
1067////////////////////////////////////////////////////////////////////////////
1068void bncWindow::slotSaveOptions() {
1069
1070 QStringList mountPoints;
1071 for (int iRow = 0; iRow < _mountPointsTable->rowCount(); iRow++) {
1072
1073 if (_mountPointsTable->item(iRow, 6)->text() != "S") {
1074 QUrl url( "//" + _mountPointsTable->item(iRow, 0)->text() +
1075 "@" + _mountPointsTable->item(iRow, 1)->text() );
1076
1077 mountPoints.append(url.toString() + " " +
1078 _mountPointsTable->item(iRow, 2)->text()
1079 + " " + _mountPointsTable->item(iRow, 3)->text()
1080 + " " + _mountPointsTable->item(iRow, 4)->text()
1081 + " " + _mountPointsTable->item(iRow, 5)->text()
1082 + " " + _mountPointsTable->item(iRow, 6)->text());
1083 } else {
1084 mountPoints.append(
1085 "//" + _mountPointsTable->item(iRow, 1)->text()
1086 + " " + _mountPointsTable->item(iRow, 2)->text()
1087 + " " + _mountPointsTable->item(iRow, 3)->text()
1088 + " " + _mountPointsTable->item(iRow, 4)->text()
1089 + " " + _mountPointsTable->item(iRow, 5)->text()
1090 + " " + _mountPointsTable->item(iRow, 6)->text());
1091 }
1092 }
1093
1094 bncSettings settings;
1095
1096 settings.setValue("adviseFail", _adviseFailSpinBox->value());
1097 settings.setValue("adviseReco", _adviseRecoSpinBox->value());
1098 settings.setValue("adviseScript",_adviseScriptLineEdit->text());
1099 settings.setValue("autoStart", _autoStartCheckBox->checkState());
1100 settings.setValue("binSampl", _binSamplSpinBox->value());
1101 settings.setValue("corrIntr", _corrIntrComboBox->currentText());
1102 settings.setValue("corrPath", _corrPathLineEdit->text());
1103 settings.setValue("corrPort", _corrPortLineEdit->text());
1104 settings.setValue("corrTime", _corrTimeSpinBox->value());
1105 settings.setValue("ephIntr", _ephIntrComboBox->currentText());
1106 settings.setValue("ephPath", _ephPathLineEdit->text());
1107 settings.setValue("ephV3", _ephV3CheckBox->checkState());
1108 settings.setValue("logFile", _logFileLineEdit->text());
1109 settings.setValue("miscMount", _miscMountLineEdit->text());
1110 settings.setValue("mountPoints", mountPoints);
1111 settings.setValue("obsRate", _obsRateComboBox->currentText());
1112 settings.setValue("onTheFlyInterval", _onTheFlyComboBox->currentText());
1113 settings.setValue("outEphPort", _outEphPortLineEdit->text());
1114 settings.setValue("outFile", _outFileLineEdit->text());
1115 settings.setValue("outPort", _outPortLineEdit->text());
1116 settings.setValue("outUPort", _outUPortLineEdit->text());
1117 settings.setValue("perfIntr", _perfIntrComboBox->currentText());
1118 settings.setValue("proxyHost", _proxyHostLineEdit->text());
1119 settings.setValue("proxyPort", _proxyPortLineEdit->text());
1120 settings.setValue("rnxAppend", _rnxAppendCheckBox->checkState());
1121 settings.setValue("rnxIntr", _rnxIntrComboBox->currentText());
1122 settings.setValue("rnxPath", _rnxPathLineEdit->text());
1123 settings.setValue("rnxSampl", _rnxSamplSpinBox->value());
1124 settings.setValue("rnxScript", _rnxScrpLineEdit->text());
1125 settings.setValue("rnxSkel", _rnxSkelLineEdit->text());
1126 settings.setValue("rnxV3", _rnxV3CheckBox->checkState());
1127 settings.setValue("scanRTCM", _scanRTCMCheckBox->checkState());
1128 settings.setValue("serialFileNMEA",_serialFileNMEALineEdit->text());
1129 settings.setValue("serialHeightNMEA",_serialHeightNMEALineEdit->text());
1130 settings.setValue("serialAutoNMEA", _serialAutoNMEAComboBox->currentText());
1131 settings.setValue("serialBaudRate", _serialBaudRateComboBox->currentText());
1132 settings.setValue("serialDataBits", _serialDataBitsComboBox->currentText());
1133 settings.setValue("serialMountPoint",_serialMountPointLineEdit->text());
1134 settings.setValue("serialParity", _serialParityComboBox->currentText());
1135 settings.setValue("serialPortName", _serialPortNameLineEdit->text());
1136 settings.setValue("serialStopBits", _serialStopBitsComboBox->currentText());
1137 settings.setValue("serialFlowControl",_serialFlowControlComboBox->currentText());
1138 settings.setValue("startTab", aogroup->currentIndex());
1139 settings.setValue("waitTime", _waitTimeSpinBox->value());
1140
1141 if (_caster) {
1142 _caster->slotReadMountPoints();
1143 }
1144 settings.sync();
1145}
1146
1147// All get slots terminated
1148////////////////////////////////////////////////////////////////////////////
1149void bncWindow::slotGetThreadsFinished() {
1150 ((bncApp*)qApp)->slotMessage("All Get Threads Terminated", true);
1151 delete _caster; _caster = 0;
1152 _actGetData->setEnabled(true);
1153 _actStop->setEnabled(false);
1154}
1155
1156// Retrieve Data
1157////////////////////////////////////////////////////////////////////////////
1158void bncWindow::slotGetData() {
1159 slotSaveOptions();
1160
1161 _actDeleteMountPoints->setEnabled(false);
1162 _actGetData->setEnabled(false);
1163 _actStop->setEnabled(true);
1164
1165 _caster = new bncCaster(_outFileLineEdit->text(),
1166 _outPortLineEdit->text().toInt());
1167
1168 ((bncApp*)qApp)->setPort(_outEphPortLineEdit->text().toInt());
1169 ((bncApp*)qApp)->setPortCorr(_corrPortLineEdit->text().toInt());
1170
1171 connect(_caster, SIGNAL(getThreadsFinished()),
1172 this, SLOT(slotGetThreadsFinished()));
1173
1174 connect (_caster, SIGNAL(mountPointsRead(QList<bncGetThread*>)),
1175 this, SLOT(slotMountPointsRead(QList<bncGetThread*>)));
1176
1177 ((bncApp*)qApp)->slotMessage("============ Start BNC ============", true);
1178
1179 bncSettings settings;
1180
1181 QDir rnxdir(settings.value("rnxPath").toString());
1182 if (!rnxdir.exists()) ((bncApp*)qApp)->slotMessage("Cannot find RINEX Observations directory", true);
1183
1184 QString rnx_file = settings.value("rnxScript").toString();
1185 if ( !rnx_file.isEmpty() ) {
1186 QFile rnxfile(settings.value("rnxScript").toString());
1187 if (!rnxfile.exists()) ((bncApp*)qApp)->slotMessage("Cannot find RINEX Observations script", true);
1188 }
1189
1190 QDir ephdir(settings.value("ephPath").toString());
1191 if (!ephdir.exists()) ((bncApp*)qApp)->slotMessage("Cannot find RINEX Ephemeris directory", true);
1192
1193 QDir corrdir(settings.value("corrPath").toString());
1194 if (!corrdir.exists()) ((bncApp*)qApp)->slotMessage("Cannot find Broadcast Corrections directory", true);
1195
1196 QString advise_file = settings.value("adviseScript").toString();
1197 if ( !advise_file.isEmpty() ) {
1198 QFile advisefile(settings.value("adviseScript").toString());
1199 if (!advisefile.exists()) ((bncApp*)qApp)->slotMessage("Cannot find Outages script", true);
1200 }
1201
1202 _caster->slotReadMountPoints();
1203}
1204
1205// Retrieve Data
1206////////////////////////////////////////////////////////////////////////////
1207void bncWindow::slotStop() {
1208 int iRet = QMessageBox::question(this, "Stop", "Stop retrieving data?",
1209 QMessageBox::Yes, QMessageBox::No,
1210 QMessageBox::NoButton);
1211 if (iRet == QMessageBox::Yes) {
1212 delete _caster; _caster = 0;
1213 _actGetData->setEnabled(true);
1214 _actStop->setEnabled(false);
1215 }
1216}
1217
1218// Close Application gracefully
1219////////////////////////////////////////////////////////////////////////////
1220void bncWindow::closeEvent(QCloseEvent* event) {
1221
1222 int iRet = QMessageBox::question(this, "Close", "Save Options?",
1223 QMessageBox::Yes, QMessageBox::No,
1224 QMessageBox::Cancel);
1225
1226 if (iRet == QMessageBox::Cancel) {
1227 event->ignore();
1228 return;
1229 }
1230 else if (iRet == QMessageBox::Yes) {
1231 slotSaveOptions();
1232 }
1233
1234 QMainWindow::closeEvent(event);
1235}
1236
1237// User changed the selection of mountPoints
1238////////////////////////////////////////////////////////////////////////////
1239void bncWindow::slotSelectionChanged() {
1240 if (_mountPointsTable->selectedItems().isEmpty()) {
1241 _actDeleteMountPoints->setEnabled(false);
1242 }
1243 else {
1244 _actDeleteMountPoints->setEnabled(true);
1245 }
1246}
1247
1248// Display Program Messages
1249////////////////////////////////////////////////////////////////////////////
1250void bncWindow::slotWindowMessage(const QByteArray msg, bool showOnScreen) {
1251
1252#ifdef DEBUG_RTCM2_2021
1253 const int maxBufferSize = 1000;
1254#else
1255 const int maxBufferSize = 10000;
1256#endif
1257
1258 if (! showOnScreen ) {
1259 return;
1260 }
1261
1262 QString txt = _log->toPlainText() + "\n" +
1263 QDateTime::currentDateTime().toUTC().toString("yy-MM-dd hh:mm:ss ") + msg;
1264 _log->clear();
1265 _log->append(txt.right(maxBufferSize));
1266}
1267
1268// About Message
1269////////////////////////////////////////////////////////////////////////////
1270void bncWindow::slotAbout() {
1271 new bncAboutDlg(0);
1272}
1273
1274//Flowchart
1275////////////////////////////////////////////////////////////////////////////
1276void bncWindow::slotFlowchart() {
1277 new bncFlowchartDlg(0);
1278}
1279
1280// Help Window
1281////////////////////////////////////////////////////////////////////////////
1282void bncWindow::slotHelp() {
1283 QUrl url;
1284 url.setPath(":bnchelp.html");
1285 new bncHlpDlg(0, url);
1286}
1287
1288// Select Fonts
1289////////////////////////////////////////////////////////////////////////////
1290void bncWindow::slotFontSel() {
1291 bool ok;
1292 QFont newFont = QFontDialog::getFont(&ok, this->font(), this);
1293 if (ok) {
1294 bncSettings settings;
1295 settings.setValue("font", newFont.toString());
1296 QApplication::setFont(newFont);
1297 int ww = QFontMetrics(newFont).width('w');
1298 setMinimumSize(60*ww, 80*ww);
1299 resize(60*ww, 80*ww);
1300 }
1301}
1302
1303// Whats This Help
1304void bncWindow::slotWhatsThis() {
1305 QWhatsThis::enterWhatsThisMode();
1306}
1307
1308//
1309////////////////////////////////////////////////////////////////////////////
1310void bncWindow::slotMountPointsRead(QList<bncGetThread*> threads) {
1311 populateMountPointsTable();
1312 bncSettings settings;
1313 _binSamplSpinBox->setValue(settings.value("binSampl").toInt());
1314 _waitTimeSpinBox->setValue(settings.value("waitTime").toInt());
1315 QListIterator<bncGetThread*> iTh(threads);
1316 while (iTh.hasNext()) {
1317 bncGetThread* thread = iTh.next();
1318 for (int iRow = 0; iRow < _mountPointsTable->rowCount(); iRow++) {
1319 QUrl url( "//" + _mountPointsTable->item(iRow, 0)->text() +
1320 "@" + _mountPointsTable->item(iRow, 1)->text() );
1321 if (url == thread->mountPoint() &&
1322 _mountPointsTable->item(iRow, 3)->text() == thread->latitude() &&
1323 _mountPointsTable->item(iRow, 4)->text() == thread->longitude() ) {
1324 ((bncTableItem*) _mountPointsTable->item(iRow, 7))->setGetThread(thread);
1325 break;
1326 }
1327 }
1328 }
1329}
1330
1331//
1332////////////////////////////////////////////////////////////////////////////
1333void bncWindow::CreateMenu() {
1334 // Create Menus
1335 // ------------
1336 _menuFile = menuBar()->addMenu(tr("&File"));
1337 _menuFile->addAction(_actFontSel);
1338 _menuFile->addSeparator();
1339 _menuFile->addAction(_actSaveOpt);
1340 _menuFile->addSeparator();
1341 _menuFile->addAction(_actQuit);
1342
1343 _menuHlp = menuBar()->addMenu(tr("&Help"));
1344 _menuHlp->addAction(_actHelp);
1345 _menuHlp->addAction(_actFlowchart);
1346 _menuHlp->addAction(_actAbout);
1347}
1348
1349// Toolbar
1350////////////////////////////////////////////////////////////////////////////
1351void bncWindow::AddToolbar() {
1352 // Tool (Command) Bar
1353 // ------------------
1354 QToolBar* toolBar = new QToolBar;
1355 addToolBar(Qt::BottomToolBarArea, toolBar);
1356 toolBar->setMovable(false);
1357 toolBar->addAction(_actAddMountPoints);
1358 toolBar->addAction(_actDeleteMountPoints);
1359 toolBar->addAction(_actGetData);
1360 toolBar->addAction(_actStop);
1361 toolBar->addWidget(new QLabel(" "));
1362 toolBar->addAction(_actwhatsthis);
1363}
1364
1365// About
1366////////////////////////////////////////////////////////////////////////////
1367bncAboutDlg::bncAboutDlg(QWidget* parent) :
1368 QDialog(parent) {
1369
1370 QTextBrowser* tb = new QTextBrowser;
1371 QUrl url; url.setPath(":bncabout.html");
1372 tb->setSource(url);
1373 tb->setReadOnly(true);
1374
1375 int ww = QFontMetrics(font()).width('w');
1376 QPushButton* _closeButton = new QPushButton("Close");
1377 _closeButton->setMaximumWidth(10*ww);
1378 connect(_closeButton, SIGNAL(clicked()), this, SLOT(close()));
1379
1380 QGridLayout* dlgLayout = new QGridLayout();
1381 QLabel* img = new QLabel();
1382 img->setPixmap(QPixmap(":ntrip-logo.png"));
1383 dlgLayout->addWidget(img, 0,0);
1384 dlgLayout->addWidget(new QLabel("BKG Ntrip Client (BNC) Version 1.7"), 0,1);
1385 dlgLayout->addWidget(tb,1,0,1,2);
1386 dlgLayout->addWidget(_closeButton,2,1,Qt::AlignRight);
1387
1388 setLayout(dlgLayout);
1389 resize(60*ww, 60*ww);
1390 setWindowTitle("About BNC");
1391 show();
1392}
1393
1394//
1395////////////////////////////////////////////////////////////////////////////
1396bncAboutDlg::~bncAboutDlg() {
1397};
1398
1399// Flowchart
1400////////////////////////////////////////////////////////////////////////////
1401bncFlowchartDlg::bncFlowchartDlg(QWidget* parent) :
1402 QDialog(parent) {
1403
1404 int ww = QFontMetrics(font()).width('w');
1405 QPushButton* _closeButton = new QPushButton("Close");
1406 _closeButton->setMaximumWidth(10*ww);
1407 connect(_closeButton, SIGNAL(clicked()), this, SLOT(close()));
1408
1409 QGridLayout* dlgLayout = new QGridLayout();
1410 QLabel* img = new QLabel();
1411 img->setPixmap(QPixmap(":bncflowchart.png"));
1412 dlgLayout->addWidget(img, 0,0);
1413 dlgLayout->addWidget(_closeButton,1,0,Qt::AlignLeft);
1414
1415 setLayout(dlgLayout);
1416 setWindowTitle("Flow Chart");
1417 show();
1418}
1419
1420//
1421////////////////////////////////////////////////////////////////////////////
1422bncFlowchartDlg::~bncFlowchartDlg() {
1423};
1424
1425// Bnc Text
1426////////////////////////////////////////////////////////////////////////////
1427void bncWindow::bncText(const QString &text){
1428
1429 bool isEmpty = text.isEmpty();
1430
1431 QPalette palette;
1432 QColor lightGray(230, 230, 230);
1433 QColor white(255, 255, 255);
1434
1435
1436 // Proxy
1437 //------
1438 if (aogroup->currentIndex() == 0) {
1439 if (!isEmpty) {
1440 _proxyPortLineEdit->setStyleSheet("background-color: white");
1441 _proxyPortLineEdit->setEnabled(true);
1442 } else {
1443 _proxyPortLineEdit->setStyleSheet("background-color: lightGray");
1444 _proxyPortLineEdit->setEnabled(false);
1445 }
1446 }
1447
1448 // RINEX Observations
1449 // ------------------
1450 if (aogroup->currentIndex() == 2) {
1451 if (!isEmpty) {
1452 _rnxSamplSpinBox->setStyleSheet("background-color: white");
1453 _rnxSkelLineEdit->setStyleSheet("background-color: white");
1454 _rnxScrpLineEdit->setStyleSheet("background-color: white");
1455 palette.setColor(_rnxV3CheckBox->backgroundRole(), white);
1456 _rnxV3CheckBox->setPalette(palette);
1457 _rnxIntrComboBox->setStyleSheet("background-color: white");
1458 _rnxSamplSpinBox->setEnabled(true);
1459 _rnxSkelLineEdit->setEnabled(true);
1460 _rnxScrpLineEdit->setEnabled(true);
1461 _rnxV3CheckBox->setEnabled(true);
1462 _rnxIntrComboBox->setEnabled(true);
1463 } else {
1464 _rnxSamplSpinBox->setStyleSheet("background-color: lightGray");
1465 _rnxSkelLineEdit->setStyleSheet("background-color: lightGray");
1466 _rnxScrpLineEdit->setStyleSheet("background-color: lightGray");
1467 palette.setColor(_rnxV3CheckBox->backgroundRole(), lightGray);
1468 _rnxV3CheckBox->setPalette(palette);
1469 _rnxIntrComboBox->setStyleSheet("background-color: lightGray");
1470 _rnxSamplSpinBox->setEnabled(false);
1471 _rnxSkelLineEdit->setEnabled(false);
1472 _rnxScrpLineEdit->setEnabled(false);
1473 _rnxV3CheckBox->setEnabled(false);
1474 _rnxIntrComboBox->setEnabled(false);
1475 }
1476 }
1477
1478 // RINEX Ephemeris
1479 // ---------------
1480 if (aogroup->currentIndex() == 3) {
1481 if (!_ephPathLineEdit->text().isEmpty() && !_outEphPortLineEdit->text().isEmpty()) {
1482 _ephIntrComboBox->setStyleSheet("background-color: white");
1483 palette.setColor(_ephV3CheckBox->backgroundRole(), white);
1484 _ephV3CheckBox->setPalette(palette);
1485 _ephIntrComboBox->setEnabled(true);
1486 _ephV3CheckBox->setEnabled(true);
1487 }
1488 if (_ephPathLineEdit->text().isEmpty() && !_outEphPortLineEdit->text().isEmpty()) {
1489 _ephIntrComboBox->setStyleSheet("background-color: lightGray");
1490 palette.setColor(_ephV3CheckBox->backgroundRole(), white);
1491 _ephV3CheckBox->setPalette(palette);
1492 _ephIntrComboBox->setEnabled(false);
1493 _ephV3CheckBox->setEnabled(true);
1494 }
1495 if (!_ephPathLineEdit->text().isEmpty() && _outEphPortLineEdit->text().isEmpty()) {
1496 _ephIntrComboBox->setStyleSheet("background-color: white");
1497 palette.setColor(_ephV3CheckBox->backgroundRole(), white);
1498 _ephV3CheckBox->setPalette(palette);
1499 _ephIntrComboBox->setEnabled(true);
1500 _ephV3CheckBox->setEnabled(true);
1501 }
1502 if (_ephPathLineEdit->text().isEmpty() && _outEphPortLineEdit->text().isEmpty()) {
1503 _ephIntrComboBox->setStyleSheet("background-color: lightGray");
1504 palette.setColor(_ephV3CheckBox->backgroundRole(), lightGray);
1505 _ephV3CheckBox->setPalette(palette);
1506 _ephIntrComboBox->setEnabled(false);
1507 _ephV3CheckBox->setEnabled(false);
1508 }
1509 }
1510
1511 // Broadcast Corrections
1512 // ---------------------
1513 if (aogroup->currentIndex() == 4) {
1514 if (!isEmpty) {
1515 if (!_corrPathLineEdit->text().isEmpty()) {
1516 _corrIntrComboBox->setStyleSheet("background-color: white");
1517 _corrPortLineEdit->setStyleSheet("background-color: white");
1518 _corrIntrComboBox->setEnabled(true);
1519 _corrPortLineEdit->setEnabled(true);
1520 }
1521 if (!_corrPortLineEdit->text().isEmpty()) {
1522 _corrTimeSpinBox->setStyleSheet("background-color: white");
1523 _corrTimeSpinBox->setEnabled(true);
1524 }
1525 } else {
1526 if (_corrPathLineEdit->text().isEmpty()) {
1527 _corrIntrComboBox->setStyleSheet("background-color: lightGray");
1528 _corrIntrComboBox->setEnabled(false);
1529 }
1530 if (_corrPortLineEdit->text().isEmpty()) {
1531 _corrTimeSpinBox->setStyleSheet("background-color: lightGray");
1532 _corrTimeSpinBox->setEnabled(false);
1533 }
1534 }
1535 }
1536
1537 // Feed Engine
1538 // -----------
1539 if (aogroup->currentIndex() == 5) {
1540 if ( !_outPortLineEdit->text().isEmpty() || !_outFileLineEdit->text().isEmpty()) {
1541 _waitTimeSpinBox->setStyleSheet("background-color: white");
1542 _binSamplSpinBox->setStyleSheet("background-color: white");
1543 _waitTimeSpinBox->setEnabled(true);
1544 _binSamplSpinBox->setEnabled(true);
1545 } else {
1546 _waitTimeSpinBox->setStyleSheet("background-color: lightGray");
1547 _binSamplSpinBox->setStyleSheet("background-color: lightGray");
1548 _waitTimeSpinBox->setEnabled(false);
1549 _binSamplSpinBox->setEnabled(false);
1550 }
1551 }
1552
1553 // Serial Output
1554 // -------------
1555 if (aogroup->currentIndex() == 6) {
1556 if (!isEmpty) {
1557 _serialPortNameLineEdit->setStyleSheet("background-color: white");
1558 _serialBaudRateComboBox->setStyleSheet("background-color: white");
1559 _serialParityComboBox->setStyleSheet("background-color: white");
1560 _serialDataBitsComboBox->setStyleSheet("background-color: white");
1561 _serialStopBitsComboBox->setStyleSheet("background-color: white");
1562 _serialFlowControlComboBox->setStyleSheet("background-color: white");
1563 _serialAutoNMEAComboBox->setStyleSheet("background-color: white");
1564 _serialPortNameLineEdit->setEnabled(true);
1565 _serialBaudRateComboBox->setEnabled(true);
1566 _serialParityComboBox->setEnabled(true);
1567 _serialDataBitsComboBox->setEnabled(true);
1568 _serialStopBitsComboBox->setEnabled(true);
1569 _serialFlowControlComboBox->setEnabled(true);
1570 _serialAutoNMEAComboBox->setEnabled(true);
1571 if (_serialAutoNMEAComboBox->currentText() != "Auto" ) {
1572 _serialHeightNMEALineEdit->setStyleSheet("background-color: white");
1573 _serialHeightNMEALineEdit->setEnabled(true);
1574 _serialFileNMEALineEdit->setStyleSheet("background-color: lightGray");
1575 _serialFileNMEALineEdit->setEnabled(false);
1576 } else {
1577 _serialHeightNMEALineEdit->setStyleSheet("background-color: lightGray");
1578 _serialHeightNMEALineEdit->setEnabled(false);
1579 _serialFileNMEALineEdit->setStyleSheet("background-color: white");
1580 _serialFileNMEALineEdit->setEnabled(true);
1581 }
1582 } else {
1583 _serialPortNameLineEdit->setStyleSheet("background-color: lightGray");
1584 _serialBaudRateComboBox->setStyleSheet("background-color: lightGray");
1585 _serialParityComboBox->setStyleSheet("background-color: lightGray");
1586 _serialDataBitsComboBox->setStyleSheet("background-color: lightGray");
1587 _serialStopBitsComboBox->setStyleSheet("background-color: lightGray");
1588 _serialFlowControlComboBox->setStyleSheet("background-color: lightGray");
1589 _serialAutoNMEAComboBox->setStyleSheet("background-color: lightGray");
1590 _serialFileNMEALineEdit->setStyleSheet("background-color: lightGray");
1591 _serialHeightNMEALineEdit->setStyleSheet("background-color: lightGray");
1592 _serialPortNameLineEdit->setEnabled(false);
1593 _serialBaudRateComboBox->setEnabled(false);
1594 _serialParityComboBox->setEnabled(false);
1595 _serialDataBitsComboBox->setEnabled(false);
1596 _serialStopBitsComboBox->setEnabled(false);
1597 _serialFlowControlComboBox->setEnabled(false);
1598 _serialAutoNMEAComboBox->setEnabled(false);
1599 _serialHeightNMEALineEdit->setEnabled(false);
1600 _serialFileNMEALineEdit->setEnabled(false);
1601 }
1602 }
1603
1604 // Outages
1605 // -------
1606 if (aogroup->currentIndex() == 7) {
1607 if (!isEmpty) {
1608 _adviseScriptLineEdit->setStyleSheet("background-color: white");
1609 _adviseFailSpinBox->setStyleSheet("background-color: white");
1610 _adviseRecoSpinBox->setStyleSheet("background-color: white");
1611 _adviseFailSpinBox->setEnabled(true);
1612 _adviseRecoSpinBox->setEnabled(true);
1613 _adviseScriptLineEdit->setEnabled(true);
1614 } else {
1615 _adviseScriptLineEdit->setStyleSheet("background-color: lightGray");
1616 _adviseFailSpinBox->setStyleSheet("background-color: lightGray");
1617 _adviseRecoSpinBox->setStyleSheet("background-color: lightGray");
1618 _adviseFailSpinBox->setEnabled(false);
1619 _adviseRecoSpinBox->setEnabled(false);
1620 _adviseScriptLineEdit->setEnabled(false);
1621 }
1622 }
1623
1624 // Miscellaneous
1625 // -------------
1626 if (aogroup->currentIndex() == 8) {
1627 if (!isEmpty) {
1628 _perfIntrComboBox->setStyleSheet("background-color: white");
1629 palette.setColor(_scanRTCMCheckBox->backgroundRole(), white);
1630 _scanRTCMCheckBox->setPalette(palette);
1631 _perfIntrComboBox->setEnabled(true);
1632 _scanRTCMCheckBox->setEnabled(true);
1633 } else {
1634 _perfIntrComboBox->setStyleSheet("background-color: lightGray");
1635 palette.setColor(_scanRTCMCheckBox->backgroundRole(), lightGray);
1636 _scanRTCMCheckBox->setPalette(palette);
1637 _perfIntrComboBox->setEnabled(false);
1638 _scanRTCMCheckBox->setEnabled(false);
1639 }
1640 }
1641}
1642
Note: See TracBrowser for help on using the repository browser.