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

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

* empty log message *

File size: 47.5 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 "bnchlpdlg.h"
49#include "bnchtml.h"
50#include "bnctableitem.h"
51
52using namespace std;
53
54// Constructor
55////////////////////////////////////////////////////////////////////////////
56bncWindow::bncWindow() {
57
58 _caster = 0;
59
60 int ww = QFontMetrics(this->font()).width('w');
61
62 static const QStringList labels = QString("account,broadcaster:port / mountpoint,decoder,lat,long,nmea,bytes").split(",");
63
64 setMinimumSize(80*ww, 65*ww);
65
66 setWindowTitle(tr("BKG Ntrip Client (BNC) Version 1.6"));
67
68 connect((bncApp*)qApp, SIGNAL(newMessage(QByteArray)),
69 this, SLOT(slotWindowMessage(QByteArray)));
70
71 // Create Actions
72 // --------------
73 _actHelp = new QAction(tr("&Help Contents"),this);
74 connect(_actHelp, SIGNAL(triggered()), SLOT(slotHelp()));
75
76 _actAbout = new QAction(tr("&About BNC"),this);
77 connect(_actAbout, SIGNAL(triggered()), SLOT(slotAbout()));
78
79 _actFlowchart = new QAction(tr("&Flow Chart"),this);
80 connect(_actFlowchart, SIGNAL(triggered()), SLOT(slotFlowchart()));
81
82 _actFontSel = new QAction(tr("Select &Font"),this);
83 connect(_actFontSel, SIGNAL(triggered()), SLOT(slotFontSel()));
84
85 _actSaveOpt = new QAction(tr("&Save Options"),this);
86 connect(_actSaveOpt, SIGNAL(triggered()), SLOT(slotSaveOptions()));
87
88 _actQuit = new QAction(tr("&Quit"),this);
89 connect(_actQuit, SIGNAL(triggered()), SLOT(close()));
90
91 _actAddMountPoints = new QAction(tr("Add &Mountpoints"),this);
92 connect(_actAddMountPoints, SIGNAL(triggered()), SLOT(slotAddMountPoints()));
93
94 _actDeleteMountPoints = new QAction(tr("&Delete Mountpoints"),this);
95 connect(_actDeleteMountPoints, SIGNAL(triggered()), SLOT(slotDeleteMountPoints()));
96 _actDeleteMountPoints->setEnabled(false);
97
98 _actGetData = new QAction(tr("Sta&rt"),this);
99 connect(_actGetData, SIGNAL(triggered()), SLOT(slotGetData()));
100
101 _actStop = new QAction(tr("Sto&p"),this);
102 connect(_actStop, SIGNAL(triggered()), SLOT(slotStop()));
103 _actStop->setEnabled(false);
104
105 _actwhatsthis= new QAction(tr("Help=Shift+F1"),this);
106 connect(_actwhatsthis, SIGNAL(triggered()), SLOT(slotWhatsThis()));
107
108 CreateMenu();
109 AddToolbar();
110
111 QSettings settings;
112 _proxyHostLineEdit = new QLineEdit(settings.value("proxyHost").toString());
113 _proxyPortLineEdit = new QLineEdit(settings.value("proxyPort").toString());
114 _proxyPortLineEdit->setMaximumWidth(9*ww);
115 _messTypesLineEdit = new QLineEdit(settings.value("messTypes").toString());
116 _messTypesLineEdit->setMaximumWidth(20*ww);
117 _waitTimeSpinBox = new QSpinBox();
118 _waitTimeSpinBox->setMinimum(1);
119 _waitTimeSpinBox->setMaximum(30);
120 _waitTimeSpinBox->setSingleStep(1);
121 _waitTimeSpinBox->setSuffix(" sec");
122 _waitTimeSpinBox->setMaximumWidth(9*ww);
123 _waitTimeSpinBox->setValue(settings.value("waitTime").toInt());
124 _outFileLineEdit = new QLineEdit(settings.value("outFile").toString());
125 _outPortLineEdit = new QLineEdit(settings.value("outPort").toString());
126 _outPortLineEdit->setMaximumWidth(9*ww);
127 _outEphPortLineEdit = new QLineEdit(settings.value("outEphPort").toString());
128 _outEphPortLineEdit->setMaximumWidth(9*ww);
129 _corrPortLineEdit = new QLineEdit(settings.value("corrPort").toString());
130 _corrPortLineEdit->setMaximumWidth(9*ww);
131 _rnxPathLineEdit = new QLineEdit(settings.value("rnxPath").toString());
132 _ephPathLineEdit = new QLineEdit(settings.value("ephPath").toString());
133 _corrPathLineEdit = new QLineEdit(settings.value("corrPath").toString());
134
135 _rnxV3CheckBox = new QCheckBox();
136 _rnxV3CheckBox->setCheckState(Qt::CheckState(settings.value("rnxV3").toInt()));
137 _ephV3CheckBox = new QCheckBox();
138 _ephV3CheckBox->setCheckState(Qt::CheckState(settings.value("ephV3").toInt()));
139 _rnxScrpLineEdit = new QLineEdit(settings.value("rnxScript").toString());
140 _rnxSkelLineEdit = new QLineEdit(settings.value("rnxSkel").toString());
141 _rnxSkelLineEdit->setMaximumWidth(5*ww);
142 _rnxAppendCheckBox = new QCheckBox();
143 _rnxAppendCheckBox->setCheckState(Qt::CheckState(
144 settings.value("rnxAppend").toInt()));
145 _rnxIntrComboBox = new QComboBox();
146 _rnxIntrComboBox->setMaximumWidth(9*ww);
147 _rnxIntrComboBox->setEditable(false);
148 _rnxIntrComboBox->addItems(QString("1 min,2 min,5 min,10 min,15 min,30 min,1 hour,1 day").split(","));
149 int ii = _rnxIntrComboBox->findText(settings.value("rnxIntr").toString());
150 if (ii != -1) {
151 _rnxIntrComboBox->setCurrentIndex(ii);
152 }
153 _onTheFlyComboBox = new QComboBox();
154 _onTheFlyComboBox->setMaximumWidth(9*ww);
155 _onTheFlyComboBox->setEditable(false);
156 _onTheFlyComboBox->addItems(QString("1 day,1 hour,1 min").split(","));
157 ii = _onTheFlyComboBox->findText(settings.value("onTheFlyInterval").toString());
158 if (ii != -1) {
159 _onTheFlyComboBox->setCurrentIndex(ii);
160 }
161 _ephIntrComboBox = new QComboBox();
162 _ephIntrComboBox->setMaximumWidth(9*ww);
163 _ephIntrComboBox->setEditable(false);
164 _ephIntrComboBox->addItems(QString("1 min,2 min,5 min,10 min,15 min,30 min,1 hour,1 day").split(","));
165 int jj = _ephIntrComboBox->findText(settings.value("ephIntr").toString());
166 if (jj != -1) {
167 _ephIntrComboBox->setCurrentIndex(jj);
168 }
169 _corrIntrComboBox = new QComboBox();
170 _corrIntrComboBox->setMaximumWidth(9*ww);
171 _corrIntrComboBox->setEditable(false);
172 _corrIntrComboBox->addItems(QString("1 min,2 min,5 min,10 min,15 min,30 min,1 hour,1 day").split(","));
173 int mm = _corrIntrComboBox->findText(settings.value("corrIntr").toString());
174 if (mm != -1) {
175 _corrIntrComboBox->setCurrentIndex(mm);
176 }
177 _corrTimeSpinBox = new QSpinBox();
178 _corrTimeSpinBox->setMinimum(1);
179 _corrTimeSpinBox->setMaximum(30);
180 _corrTimeSpinBox->setSingleStep(1);
181 _corrTimeSpinBox->setSuffix(" sec");
182 _corrTimeSpinBox->setMaximumWidth(9*ww);
183 _corrTimeSpinBox->setValue(settings.value("corrTime").toInt());
184 _rnxSamplSpinBox = new QSpinBox();
185 _rnxSamplSpinBox->setMinimum(0);
186 _rnxSamplSpinBox->setMaximum(60);
187 _rnxSamplSpinBox->setSingleStep(5);
188 _rnxSamplSpinBox->setMaximumWidth(9*ww);
189 _rnxSamplSpinBox->setValue(settings.value("rnxSampl").toInt());
190 _rnxSamplSpinBox->setSuffix(" sec");
191
192 _binSamplSpinBox = new QSpinBox();
193 _binSamplSpinBox->setMinimum(0);
194 _binSamplSpinBox->setMaximum(60);
195 _binSamplSpinBox->setSingleStep(5);
196 _binSamplSpinBox->setMaximumWidth(9*ww);
197 _binSamplSpinBox->setValue(settings.value("binSampl").toInt());
198 _binSamplSpinBox->setSuffix(" sec");
199
200 _obsRateComboBox = new QComboBox();
201 _obsRateComboBox->setMaximumWidth(9*ww);
202 _obsRateComboBox->setEditable(false);
203 _obsRateComboBox->addItems(QString(",0.1 Hz,0.2 Hz,0.5 Hz,1 Hz,5 Hz").split(","));
204 int kk = _obsRateComboBox->findText(settings.value("obsRate").toString());
205 if (kk != -1) {
206 _obsRateComboBox->setCurrentIndex(kk);
207 }
208 _makePauseCheckBox = new QCheckBox();
209 _makePauseCheckBox->setCheckState(Qt::CheckState(
210 settings.value("makePause").toInt()));
211 _adviseRecoSpinBox = new QSpinBox();
212 _adviseRecoSpinBox->setMinimum(0);
213 _adviseRecoSpinBox->setMaximum(60);
214 _adviseRecoSpinBox->setSingleStep(1);
215 _adviseRecoSpinBox->setSuffix(" min");
216 _adviseRecoSpinBox->setMaximumWidth(9*ww);
217 _adviseRecoSpinBox->setValue(settings.value("adviseReco").toInt());
218 _adviseFailSpinBox = new QSpinBox();
219 _adviseFailSpinBox->setMinimum(0);
220 _adviseFailSpinBox->setMaximum(60);
221 _adviseFailSpinBox->setSingleStep(1);
222 _adviseFailSpinBox->setSuffix(" min");
223 _adviseFailSpinBox->setMaximumWidth(9*ww);
224 _adviseFailSpinBox->setValue(settings.value("adviseFail").toInt());
225 _logFileLineEdit = new QLineEdit(settings.value("logFile").toString());
226 _adviseScriptLineEdit = new QLineEdit(settings.value("adviseScript").toString());
227
228 _perfIntrComboBox = new QComboBox();
229 _perfIntrComboBox->setMaximumWidth(9*ww);
230 _perfIntrComboBox->setEditable(false);
231 _perfIntrComboBox->addItems(QString(",1 min,5 min,15 min,1 hour,6 hours,1 day").split(","));
232 int ll = _perfIntrComboBox->findText(settings.value("perfIntr").toString());
233 if (ll != -1) {
234 _perfIntrComboBox->setCurrentIndex(ll);
235 }
236
237 _mountPointsTable = new QTableWidget(0,7);
238
239 _mountPointsTable->horizontalHeader()->resizeSection(1,34*ww);
240 _mountPointsTable->horizontalHeader()->resizeSection(2,9*ww);
241 _mountPointsTable->horizontalHeader()->resizeSection(3,7*ww);
242 _mountPointsTable->horizontalHeader()->resizeSection(4,7*ww);
243 _mountPointsTable->horizontalHeader()->resizeSection(5,5*ww);
244 _mountPointsTable->horizontalHeader()->setResizeMode(QHeaderView::Interactive);
245 _mountPointsTable->horizontalHeader()->setStretchLastSection(true);
246 _mountPointsTable->setHorizontalHeaderLabels(labels);
247 _mountPointsTable->setGridStyle(Qt::NoPen);
248 _mountPointsTable->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
249 _mountPointsTable->setSelectionMode(QAbstractItemView::ExtendedSelection);
250 _mountPointsTable->setSelectionBehavior(QAbstractItemView::SelectRows);
251 _mountPointsTable->hideColumn(0);
252 connect(_mountPointsTable, SIGNAL(itemSelectionChanged()),
253 SLOT(slotSelectionChanged()));
254 populateMountPointsTable();
255
256 _log = new QTextBrowser();
257 _log->setReadOnly(true);
258
259 // WhatsThis
260 // ---------
261 _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>"));
262 _proxyPortLineEdit->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>"));
263 _waitTimeSpinBox->setWhatsThis(tr("<p>When feeding a real-time GNSS engine waiting for 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 engine or products.</p><p>Note that 'Wait for full epoch' does not effect the RINEX Observation file content. Observations received later than 'Wait for full epoch' seconds will still be included in the RINEX Observation files.</p>"));
264 _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."));
265 _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."));
266 _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."));
267 _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."));
268 _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."));
269 _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."));
270 _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."));
271 _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."));
272 _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><p>The triggering event for calling the script or batch file is the end of a RINEX Observation file 'Interval'. If that is overridden by a stream outage, the triggering event is the stream reconnection.</p>"));
273 _rnxSkelLineEdit->setWhatsThis(tr("<p>Whenever BNC starts generating RINEX Observation files (and then once every day at midnight), it first tries to retrieve information needed for RINEX headers from so-called public RINEX header skeleton files which are derived from sitelogs. However, sometimes public RINEX header skeleton files are not available, its contents is not up to date, or you need to put additional/optional records in the RINEX header.</p><p>For that 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. A file in the RINEX 'Directory' with the RINEX 'Skeleton extension' is interpreted by BNC as a personal RINEX header skeleton file for the corresponding stream.</p>"));
274 _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>"));
275 _onTheFlyComboBox->setWhatsThis(tr("<p>When operating BNC in online 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 let BNC reread its configuration every full minute, hour, or day and thus avoid usage of 'Start', 'Stop', or 'Quit' buttons.</p>"));
276 _rnxIntrComboBox->setWhatsThis(tr("<p>Select the length of the RINEX Observation file.</p>"));
277 _ephIntrComboBox->setWhatsThis(tr("<p>Select the length of the RINEX Navigation file.</p>"));
278 _corrIntrComboBox->setWhatsThis(tr("<p>Select the length of the Broadcast Ephemeris Correction files.</p>"));
279 _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>"));
280 _binSamplSpinBox->setWhatsThis(tr("<p>Select the Observation sampling interval in seconds. A value of zero '0' tells BNC to send/store all received epochs.</p>"));
281 _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><p>An empty option field (default) means that you don't want an explicit information from BNC about stream outages and incoming streams that can not be decoded and that the special procedure for handling of corrupted streams is bypassed.</p>"));
282 _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><p>Note that for using this function you need to specify the 'Observation rate'.</p>"));
283 _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><p>Note that for using this function you need to specify the 'Observation rate'.</p>"));
284 _makePauseCheckBox->setWhatsThis(tr("<p>In case of a continuously corrupted stream, the decoding process can be paused and decodings are then attempted again at decreasing rate till the stream hopefully recovers. Tick 'Pause' to activate this function.</p><p>Do not tick 'Pause' (default) in order to prevent BNC from making any decoding pause. Be aware that this may incur an unnecessary workload.</p><p>Note that this function is only effective if an 'Observation rate' is specified.</p>"));
285 _logFileLineEdit->setWhatsThis(tr("Records of BNC's 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."));
286 _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 can be configured to send an 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><p> Note that for using this function you need to specify the 'Observation rate'.</p>"));
287 _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 Log file/section at the end of each 'Performance log' interval together with results of a statistical evaluation (approximate number of covered epochs, data gaps).</p><p>Select a 'Performance log' interval or select the empty option field if you do not want BNC to log latencies and statistical information.</p>"));
288 _mountPointsTable->setWhatsThis(tr("<p>Streams selected for retrieval are listed in the 'Mountpoints' section. Clicking on 'Add Mountpoints' 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 'Mountpoints' list, highlight it by clicking on it and hit the 'Delete Mountpoints' button. You can also remove multiple mountpoints 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' and 'format-details' as given in the sourcetable. However, there might be cases where you need to override the automatic selection due to incorrect sourcetable for example. BNC allows users to manually select the required decoder 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). To initiate these streams, an approximate rover position needs to be sent in NMEA GGA message to the NTRIP broadcaster. In return, a user-specific data stream is generated, typically by a Network-RTK software. This stream is customized to the exact latitude and longitude as shown in the 'lat' and 'long' columns under 'Mountpoints'. These VRS streams are indicated by a 'yes' in the 'nmea' column under 'Mountpoints' as well as in the sourcetable. The default 'lat' and 'long' values are taken from the sourcetable. However, in most cases you would probably want to change this according to your requirement. Double click on 'lat' and 'long' fields, enter the values you wish to send and then hit Enter. The format is in positive north latitude degrees (e.g. for northern hemisphere: 52.436, for southern hemisphere: -24.567) and eastern longitude degrees (e.g.: 358.872 or -1.128). Only mountpoints with a 'yes' in its 'nmea' column can be edited. The position should preferably be a point within the coverage of the network.</p>"));
289 _log->setWhatsThis(tr("Records of BNC's activities are shown in the Log 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."));
290 _ephV3CheckBox->setWhatsThis(tr("The default format for RINEX Navigation files containing Broadcast Ephemeris is RINEX Version 2.11. Select 'Version 3' if you want to save the ephemeris in RINEX Version 3 format."));
291 _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."));
292 _messTypesLineEdit->setWhatsThis(tr("<p>Specify the mountpoint of an RTCM Version 3.x stream to log the numbers of incoming message types as well as contained antenna coordinates and antenna hight.</p><p>An empty option field (default) means that you don't want BNC to log such information.</p>"));
293
294 // Canvas with Editable Fields
295 // ---------------------------
296 _canvas = new QWidget;
297 setCentralWidget(_canvas);
298
299 QTabWidget* aogroup = new QTabWidget();
300 QWidget* pgroup = new QWidget();
301 QWidget* ggroup = new QWidget();
302 QWidget* sgroup = new QWidget();
303 QWidget* egroup = new QWidget();
304 QWidget* agroup = new QWidget();
305 QWidget* cgroup = new QWidget();
306 QWidget* ogroup = new QWidget();
307 QWidget* rgroup = new QWidget();
308 aogroup->addTab(pgroup,tr("Proxy"));
309 aogroup->addTab(ggroup,tr("General"));
310 aogroup->addTab(ogroup,tr("RINEX Observations"));
311 aogroup->addTab(egroup,tr("RINEX Ephemeris"));
312 aogroup->addTab(sgroup,tr("Synchronized Observations"));
313 aogroup->addTab(cgroup,tr("Ephemeris Corrections"));
314 aogroup->addTab(agroup,tr("Monitor"));
315 aogroup->addTab(rgroup,tr("RTCM Scan"));
316
317 QGridLayout* pLayout = new QGridLayout;
318 pLayout->setColumnMinimumWidth(0,14*ww);
319 pLayout->addWidget(new QLabel("Proxy host"),0,0, Qt::AlignLeft);
320 pLayout->addWidget(_proxyHostLineEdit,0, 1);
321 pLayout->addWidget(new QLabel("Proxy port"),1,0, Qt::AlignLeft);
322 pLayout->addWidget(_proxyPortLineEdit,1,1);
323 pLayout->addWidget(new QLabel("Settings for the proxy in protected networks, leave the boxes blank if none."),2, 0, 1, 2, Qt::AlignLeft);
324 pLayout->addWidget(new QLabel(" "),3,0);
325 pLayout->addWidget(new QLabel(" "),4,0);
326 pLayout->addWidget(new QLabel(" "),5,0);
327 pgroup->setLayout(pLayout);
328
329 QGridLayout* gLayout = new QGridLayout;
330 gLayout->setColumnMinimumWidth(0,14*ww);
331 gLayout->addWidget(new QLabel("Logfile (full path)"), 0,0);
332 gLayout->addWidget(_logFileLineEdit, 0,1);
333 gLayout->addWidget(new QLabel("Append files") ,1,0 );
334 gLayout->addWidget(_rnxAppendCheckBox, 1,1 );
335 gLayout->addWidget(new QLabel("Reread configuration") ,2,0 );
336 gLayout->addWidget(_onTheFlyComboBox, 2,1 );
337 gLayout->addWidget(new QLabel("General settings for logfile, file handling and re-configuration on-the-fly."),3, 0, 1, 2, Qt::AlignLeft);
338 gLayout->addWidget(new QLabel(" "),4,0);
339 gLayout->addWidget(new QLabel(" "),5,0);
340 gLayout->addWidget(new QLabel(" "),6,0);
341 ggroup->setLayout(gLayout);
342
343 QGridLayout* sLayout = new QGridLayout;
344 sLayout->setColumnMinimumWidth(0,14*ww);
345 sLayout->addWidget(new QLabel("Port"), 0, 0);
346 sLayout->addWidget(_outPortLineEdit, 0, 1);
347 sLayout->addWidget(new QLabel("Wait for full epoch"), 1, 0);
348 sLayout->addWidget(_waitTimeSpinBox, 1, 1);
349 sLayout->addWidget(new QLabel("File (full path)"), 2, 0);
350 sLayout->addWidget(_outFileLineEdit, 2, 1);
351 sLayout->addWidget(new QLabel("Sampling"), 3, 0, Qt::AlignLeft);
352 sLayout->addWidget(_binSamplSpinBox, 3, 1, Qt::AlignLeft);
353 sLayout->addWidget(new QLabel("Output synchronized observations epoch by epoch."),4,0,1,2,Qt::AlignLeft);
354 sLayout->addWidget(new QLabel(" "),5,0);
355 sLayout->addWidget(new QLabel(" "),6,0);
356 sgroup->setLayout(sLayout);
357
358 QGridLayout* eLayout = new QGridLayout;
359 eLayout->setColumnMinimumWidth(0,14*ww);
360 eLayout->addWidget(new QLabel("Directory"), 0, 0);
361 eLayout->addWidget(_ephPathLineEdit, 0, 1);
362 eLayout->addWidget(new QLabel("Interval"), 1, 0);
363 eLayout->addWidget(_ephIntrComboBox, 1, 1);
364 eLayout->addWidget(new QLabel("Port"), 2, 0);
365 eLayout->addWidget(_outEphPortLineEdit, 2, 1);
366 eLayout->addWidget(new QLabel("Version 3"), 3, 0);
367 eLayout->addWidget(_ephV3CheckBox, 3, 1);
368 eLayout->addWidget(new QLabel("Saving RINEX ephemeris files and ephemeris output through IP port."),4,0,1,2,Qt::AlignLeft);
369 eLayout->addWidget(new QLabel(" "),5,0);
370 egroup->setLayout(eLayout);
371
372 QGridLayout* aLayout = new QGridLayout;
373 aLayout->setColumnMinimumWidth(0,14*ww);
374 aLayout->addWidget(new QLabel("Observation rate"), 0, 0);
375 aLayout->addWidget(_obsRateComboBox, 0, 1);
376 aLayout->addWidget(new QLabel("Failure threshold"), 1, 0);
377 aLayout->addWidget(_adviseFailSpinBox, 1, 1);
378 aLayout->addWidget(new QLabel("Recovery threshold"), 2, 0);
379 aLayout->addWidget(_adviseRecoSpinBox, 2, 1);
380 aLayout->addWidget(new QLabel("Pause"), 2, 2, Qt::AlignRight);
381 aLayout->addWidget(_makePauseCheckBox, 2, 3, Qt::AlignLeft);
382 aLayout->addWidget(new QLabel("Script (full path)"), 3, 0);
383 aLayout->addWidget(_adviseScriptLineEdit, 3, 1,1,10);
384 aLayout->addWidget(new QLabel("Performance log"), 4, 0);
385 aLayout->addWidget(_perfIntrComboBox, 4, 1);
386 aLayout->addWidget(new QLabel("Network monitoring, outages, handling of corrupted streams, latencies, statistics."),5,0,1,10,Qt::AlignLeft);
387 agroup->setLayout(aLayout);
388
389 QGridLayout* rLayout = new QGridLayout;
390 rLayout->setColumnMinimumWidth(0,14*ww);
391 rLayout->addWidget(new QLabel("Mountpoint"),0,0, Qt::AlignLeft);
392 rLayout->addWidget(_messTypesLineEdit,0,1,1,15,Qt::AlignLeft);
393 rLayout->addWidget(new QLabel("Scan RTCM Version 3.x stream to log numbers of message types and antenna information."),1, 0, 1, 4, Qt::AlignLeft);
394 rLayout->addWidget(new QLabel(" "),2,0);
395 rLayout->addWidget(new QLabel(" "),3,0);
396 rLayout->addWidget(new QLabel(" "),4,0);
397 rLayout->addWidget(new QLabel(" "),5,0);
398 rgroup->setLayout(rLayout);
399
400 QGridLayout* oLayout = new QGridLayout;
401 oLayout->setColumnMinimumWidth(0,14*ww);
402 oLayout->addWidget(new QLabel("Directory"), 0, 0);
403 oLayout->addWidget(_rnxPathLineEdit, 0, 1,1,12);
404 oLayout->addWidget(new QLabel("Interval"), 1, 0);
405 oLayout->addWidget(_rnxIntrComboBox, 1, 1);
406 oLayout->addWidget(new QLabel("Sampling"), 1, 2, Qt::AlignRight);
407 oLayout->addWidget(_rnxSamplSpinBox, 1, 3, Qt::AlignLeft);
408 oLayout->addWidget(new QLabel("Skeleton extension"), 2, 0);
409 oLayout->addWidget(_rnxSkelLineEdit, 2, 1,1,1, Qt::AlignLeft);
410 oLayout->addWidget(new QLabel("Script (full path)"), 3, 0);
411 oLayout->addWidget(_rnxScrpLineEdit, 3, 1,1,12);
412 oLayout->addWidget(new QLabel("Version 3"), 4, 0);
413 oLayout->addWidget(_rnxV3CheckBox, 4, 1);
414 oLayout->addWidget(new QLabel("Saving RINEX observation files."),5,0,1,12, Qt::AlignLeft);
415 ogroup->setLayout(oLayout);
416
417 QGridLayout* cLayout = new QGridLayout;
418 cLayout->setColumnMinimumWidth(0,14*ww);
419 cLayout->addWidget(new QLabel("Directory"), 0, 0);
420 cLayout->addWidget(_corrPathLineEdit, 0, 1);
421 cLayout->addWidget(new QLabel("Interval"), 1, 0);
422 cLayout->addWidget(_corrIntrComboBox, 1, 1);
423 cLayout->addWidget(new QLabel("Port"), 2, 0);
424 cLayout->addWidget(_corrPortLineEdit, 2, 1);
425 cLayout->addWidget(new QLabel("Wait for full epoch"), 3, 0);
426 cLayout->addWidget(_corrTimeSpinBox, 3, 1);
427 cLayout->addWidget(new QLabel("Saving Broadcast Ephemeris correction files and correction output through IP port."),4,0,1,2,Qt::AlignLeft);
428 cLayout->addWidget(new QLabel(" "),5,0);
429 cgroup->setLayout(cLayout);
430
431 QVBoxLayout* mLayout = new QVBoxLayout;
432 mLayout->addWidget(aogroup);
433 mLayout->addWidget(_mountPointsTable);
434 mLayout->addWidget(_log);
435
436 _canvas->setLayout(mLayout);
437}
438
439// Destructor
440////////////////////////////////////////////////////////////////////////////
441bncWindow::~bncWindow() {
442 delete _caster;
443}
444
445//
446////////////////////////////////////////////////////////////////////////////
447void bncWindow::populateMountPointsTable() {
448
449 for (int iRow = _mountPointsTable->rowCount()-1; iRow >=0; iRow--) {
450 _mountPointsTable->removeRow(iRow);
451 }
452
453 QSettings settings;
454
455 QListIterator<QString> it(settings.value("mountPoints").toStringList());
456 if (!it.hasNext()) {
457 _actGetData->setEnabled(false);
458 }
459 int iRow = 0;
460 while (it.hasNext()) {
461 QStringList hlp = it.next().split(" ");
462 if (hlp.size() < 5) continue;
463 _mountPointsTable->insertRow(iRow);
464
465 QUrl url(hlp[0]);
466
467 QString fullPath = url.host() + QString(":%1").arg(url.port()) + url.path();
468 QString format(hlp[1]); QString latitude(hlp[2]); QString longitude(hlp[3]);
469 QString nmea(hlp[4]);
470
471 QTableWidgetItem* it;
472 it = new QTableWidgetItem(url.userInfo());
473 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
474 _mountPointsTable->setItem(iRow, 0, it);
475
476 it = new QTableWidgetItem(fullPath);
477 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
478 _mountPointsTable->setItem(iRow, 1, it);
479
480 it = new QTableWidgetItem(format);
481 _mountPointsTable->setItem(iRow, 2, it);
482
483 if (nmea == "yes") {
484 it = new QTableWidgetItem(latitude);
485 _mountPointsTable->setItem(iRow, 3, it);
486 it = new QTableWidgetItem(longitude);
487 _mountPointsTable->setItem(iRow, 4, it);
488 } else {
489 it = new QTableWidgetItem(latitude);
490 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
491 _mountPointsTable->setItem(iRow, 3, it);
492 it = new QTableWidgetItem(longitude);
493 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
494 _mountPointsTable->setItem(iRow, 4, it);
495 }
496
497 it = new QTableWidgetItem(nmea);
498 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
499 _mountPointsTable->setItem(iRow, 5, it);
500
501 bncTableItem* bncIt = new bncTableItem();
502 bncIt->setFlags(bncIt->flags() & ~Qt::ItemIsEditable);
503 _mountPointsTable->setItem(iRow, 6, bncIt);
504
505 iRow++;
506 }
507
508 _mountPointsTable->sortItems(1);
509}
510
511// Retrieve Table
512////////////////////////////////////////////////////////////////////////////
513void bncWindow::slotAddMountPoints() {
514
515 QSettings settings;
516 QString proxyHost = settings.value("proxyHost").toString();
517 int proxyPort = settings.value("proxyPort").toInt();
518 if (proxyHost != _proxyHostLineEdit->text() ||
519 proxyPort != _proxyPortLineEdit->text().toInt()) {
520 int iRet = QMessageBox::question(this, "Question", "Proxy options "
521 "changed. Use the new ones?",
522 QMessageBox::Yes, QMessageBox::No,
523 QMessageBox::NoButton);
524 if (iRet == QMessageBox::Yes) {
525 settings.setValue("proxyHost", _proxyHostLineEdit->text());
526 settings.setValue("proxyPort", _proxyPortLineEdit->text());
527 }
528 }
529
530 bncTableDlg* dlg = new bncTableDlg(this);
531 dlg->move(this->pos().x()+50, this->pos().y()+50);
532 connect(dlg, SIGNAL(newMountPoints(QStringList*)),
533 this, SLOT(slotNewMountPoints(QStringList*)));
534 dlg->exec();
535 _actGetData->setEnabled(false); // keep 'Start' button active
536 delete dlg;
537
538}
539
540// Delete Selected Mount Points
541////////////////////////////////////////////////////////////////////////////
542void bncWindow::slotDeleteMountPoints() {
543
544 int nRows = _mountPointsTable->rowCount();
545 bool flg[nRows];
546 for (int iRow = 0; iRow < nRows; iRow++) {
547 if (_mountPointsTable->isItemSelected(_mountPointsTable->item(iRow,1))) {
548 flg[iRow] = true;
549 }
550 else {
551 flg[iRow] = false;
552 }
553 }
554 for (int iRow = nRows-1; iRow >= 0; iRow--) {
555 if (flg[iRow]) {
556 _mountPointsTable->removeRow(iRow);
557 }
558 }
559 _actDeleteMountPoints->setEnabled(false);
560
561 if (_mountPointsTable->rowCount() == 0) {
562 _actGetData->setEnabled(false);
563 }
564}
565
566// New Mount Points Selected
567////////////////////////////////////////////////////////////////////////////
568void bncWindow::slotNewMountPoints(QStringList* mountPoints) {
569 int iRow = 0;
570 QListIterator<QString> it(*mountPoints);
571 while (it.hasNext()) {
572 QStringList hlp = it.next().split(" ");
573 QUrl url(hlp[0]);
574 QString fullPath = url.host() + QString(":%1").arg(url.port()) + url.path();
575 QString format(hlp[1]); QString latitude(hlp[2]); QString longitude(hlp[3]);
576 QString nmea(hlp[4]);
577
578 _mountPointsTable->insertRow(iRow);
579
580 QTableWidgetItem* it;
581 it = new QTableWidgetItem(url.userInfo());
582 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
583 _mountPointsTable->setItem(iRow, 0, it);
584
585 it = new QTableWidgetItem(fullPath);
586 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
587 _mountPointsTable->setItem(iRow, 1, it);
588
589 it = new QTableWidgetItem(format);
590 _mountPointsTable->setItem(iRow, 2, it);
591
592 if (nmea == "yes") {
593 it = new QTableWidgetItem(latitude);
594 _mountPointsTable->setItem(iRow, 3, it);
595 it = new QTableWidgetItem(longitude);
596 _mountPointsTable->setItem(iRow, 4, it);
597 } else {
598 it = new QTableWidgetItem(latitude);
599 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
600 _mountPointsTable->setItem(iRow, 3, it);
601 it = new QTableWidgetItem(longitude);
602 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
603 _mountPointsTable->setItem(iRow, 4, it);
604 }
605
606 it = new QTableWidgetItem(nmea);
607 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
608 _mountPointsTable->setItem(iRow, 5, it);
609
610 bncTableItem* bncIt = new bncTableItem();
611 _mountPointsTable->setItem(iRow, 6, bncIt);
612
613 iRow++;
614 }
615 _mountPointsTable->hideColumn(0);
616 _mountPointsTable->sortItems(1);
617 if (mountPoints->count() > 0) {
618 _actGetData->setEnabled(true);
619 }
620 delete mountPoints;
621}
622
623// Save Options
624////////////////////////////////////////////////////////////////////////////
625void bncWindow::slotSaveOptions() {
626 QSettings settings;
627 settings.setValue("proxyHost", _proxyHostLineEdit->text());
628 settings.setValue("proxyPort", _proxyPortLineEdit->text());
629 settings.setValue("waitTime", _waitTimeSpinBox->value());
630 settings.setValue("obsRate", _obsRateComboBox->currentText());
631 settings.setValue("adviseFail", _adviseFailSpinBox->value());
632 settings.setValue("adviseReco", _adviseRecoSpinBox->value());
633 settings.setValue("makePause", _makePauseCheckBox->checkState());
634 settings.setValue("outFile", _outFileLineEdit->text());
635 settings.setValue("perfIntr", _perfIntrComboBox->currentText());
636 settings.setValue("outPort", _outPortLineEdit->text());
637 settings.setValue("outEphPort", _outEphPortLineEdit->text());
638 settings.setValue("corrPort", _corrPortLineEdit->text());
639 settings.setValue("corrTime", _corrTimeSpinBox->value());
640 settings.setValue("rnxPath", _rnxPathLineEdit->text());
641 settings.setValue("ephPath", _ephPathLineEdit->text());
642 settings.setValue("corrPath", _corrPathLineEdit->text());
643 settings.setValue("rnxScript", _rnxScrpLineEdit->text());
644 settings.setValue("rnxIntr", _rnxIntrComboBox->currentText());
645 settings.setValue("onTheFlyInterval", _onTheFlyComboBox->currentText());
646 settings.setValue("ephIntr", _ephIntrComboBox->currentText());
647 settings.setValue("corrIntr", _corrIntrComboBox->currentText());
648 settings.setValue("rnxSampl", _rnxSamplSpinBox->value());
649 settings.setValue("binSampl", _binSamplSpinBox->value());
650 settings.setValue("rnxSkel", _rnxSkelLineEdit->text());
651 settings.setValue("rnxAppend", _rnxAppendCheckBox->checkState());
652 settings.setValue("rnxV3", _rnxV3CheckBox->checkState());
653 settings.setValue("ephV3", _ephV3CheckBox->checkState());
654 settings.setValue("logFile", _logFileLineEdit->text());
655 settings.setValue("adviseScript",_adviseScriptLineEdit->text());
656 settings.setValue("messTypes", _messTypesLineEdit->text());
657
658QStringList mountPoints;
659
660 for (int iRow = 0; iRow < _mountPointsTable->rowCount(); iRow++) {
661 QUrl url( "//" + _mountPointsTable->item(iRow, 0)->text() +
662 "@" + _mountPointsTable->item(iRow, 1)->text() );
663
664 mountPoints.append(url.toString() + " " +
665 _mountPointsTable->item(iRow, 2)->text()
666 + " " + _mountPointsTable->item(iRow, 3)->text()
667 + " " + _mountPointsTable->item(iRow, 4)->text()
668 + " " + _mountPointsTable->item(iRow, 5)->text());
669 }
670 settings.setValue("mountPoints", mountPoints);
671}
672
673// All get slots terminated
674////////////////////////////////////////////////////////////////////////////
675void bncWindow::slotGetThreadErrors() {
676 ((bncApp*)qApp)->slotMessage("All Get Threads Terminated");
677 _actAddMountPoints->setEnabled(true);
678 _actGetData->setEnabled(true);
679}
680
681// Retrieve Data
682////////////////////////////////////////////////////////////////////////////
683void bncWindow::slotGetData() {
684 slotSaveOptions();
685
686 _actAddMountPoints->setEnabled(true); // keep 'Add Mountpoints' button active
687 _actDeleteMountPoints->setEnabled(false);
688 _actGetData->setEnabled(false);
689 _actStop->setEnabled(true);
690
691 _caster = new bncCaster(_outFileLineEdit->text(),
692 _outPortLineEdit->text().toInt());
693
694 ((bncApp*)qApp)->setPort(_outEphPortLineEdit->text().toInt());
695 ((bncApp*)qApp)->setPortCorr(_corrPortLineEdit->text().toInt());
696
697 connect(_caster, SIGNAL(getThreadErrors()),
698 this, SLOT(slotGetThreadErrors()));
699
700 connect (_caster, SIGNAL(mountPointsRead(QList<bncGetThread*>)),
701 this, SLOT(slotMountPointsRead(QList<bncGetThread*>)));
702
703 ((bncApp*)qApp)->slotMessage("============ Start BNC ============");
704
705 _caster->slotReadMountPoints();
706}
707
708// Retrieve Data
709////////////////////////////////////////////////////////////////////////////
710void bncWindow::slotStop() {
711 int iRet = QMessageBox::question(this, "Stop", "Stop retrieving data?",
712 QMessageBox::Yes, QMessageBox::No,
713 QMessageBox::NoButton);
714 if (iRet == QMessageBox::Yes) {
715 delete _caster; _caster = 0;
716 _actGetData->setEnabled(true);
717 _actStop->setEnabled(false);
718 _actAddMountPoints->setEnabled(true);
719 }
720}
721
722// Close Application gracefully
723////////////////////////////////////////////////////////////////////////////
724void bncWindow::closeEvent(QCloseEvent* event) {
725
726 int iRet = QMessageBox::question(this, "Close", "Save Options?",
727 QMessageBox::Yes, QMessageBox::No,
728 QMessageBox::Cancel);
729
730 if (iRet == QMessageBox::Cancel) {
731 event->ignore();
732 return;
733 }
734 else if (iRet == QMessageBox::Yes) {
735 slotSaveOptions();
736 }
737
738 QMainWindow::closeEvent(event);
739}
740
741// User changed the selection of mountPoints
742////////////////////////////////////////////////////////////////////////////
743void bncWindow::slotSelectionChanged() {
744 if (_mountPointsTable->selectedItems().isEmpty()) {
745 _actDeleteMountPoints->setEnabled(false);
746 }
747 else {
748 _actDeleteMountPoints->setEnabled(true);
749 }
750}
751
752// Display Program Messages
753////////////////////////////////////////////////////////////////////////////
754void bncWindow::slotWindowMessage(const QByteArray msg) {
755
756 const int maxBufferSize = 10000;
757
758 QString txt = _log->toPlainText() + "\n" +
759 QDateTime::currentDateTime().toUTC().toString("yy-MM-dd hh:mm:ss ") + msg;
760 _log->clear();
761 _log->append(txt.right(maxBufferSize));
762}
763
764// About Message
765////////////////////////////////////////////////////////////////////////////
766void bncWindow::slotAbout() {
767 new bncAboutDlg(0);
768}
769
770//Flowchart
771////////////////////////////////////////////////////////////////////////////
772void bncWindow::slotFlowchart() {
773 new bncFlowchartDlg(0);
774}
775
776// Help Window
777////////////////////////////////////////////////////////////////////////////
778void bncWindow::slotHelp() {
779 QUrl url;
780 url.setPath(":bnchelp.html");
781 new bncHlpDlg(0, url);
782}
783
784// Select Fonts
785////////////////////////////////////////////////////////////////////////////
786void bncWindow::slotFontSel() {
787 bool ok;
788 QFont newFont = QFontDialog::getFont(&ok, this->font(), this);
789 if (ok) {
790 QSettings settings;
791 settings.setValue("font", newFont.toString());
792 QApplication::setFont(newFont);
793 int ww = QFontMetrics(newFont).width('w');
794 setMinimumSize(60*ww, 80*ww);
795 resize(60*ww, 80*ww);
796 }
797}
798
799// Whats This Help
800void bncWindow::slotWhatsThis() {
801 QWhatsThis::enterWhatsThisMode();
802}
803
804//
805////////////////////////////////////////////////////////////////////////////
806void bncWindow::slotMountPointsRead(QList<bncGetThread*> threads) {
807 populateMountPointsTable();
808 QSettings settings;
809 _binSamplSpinBox->setValue(settings.value("binSampl").toInt());
810 _waitTimeSpinBox->setValue(settings.value("waitTime").toInt());
811 QListIterator<bncGetThread*> iTh(threads);
812 while (iTh.hasNext()) {
813 bncGetThread* thread = iTh.next();
814 for (int iRow = 0; iRow < _mountPointsTable->rowCount(); iRow++) {
815 QUrl url( "//" + _mountPointsTable->item(iRow, 0)->text() +
816 "@" + _mountPointsTable->item(iRow, 1)->text() );
817 if (url == thread->mountPoint() &&
818 _mountPointsTable->item(iRow, 3)->text() == thread->latitude() &&
819 _mountPointsTable->item(iRow, 4)->text() == thread->longitude() ) {
820 ((bncTableItem*) _mountPointsTable->item(iRow, 6))->setGetThread(thread);
821 break;
822 }
823 }
824 }
825}
826
827//
828////////////////////////////////////////////////////////////////////////////
829void bncWindow::CreateMenu() {
830 // Create Menus
831 // ------------
832 _menuFile = menuBar()->addMenu(tr("&File"));
833 _menuFile->addAction(_actFontSel);
834 _menuFile->addSeparator();
835 _menuFile->addAction(_actSaveOpt);
836 _menuFile->addSeparator();
837 _menuFile->addAction(_actQuit);
838
839 _menuHlp = menuBar()->addMenu(tr("&Help"));
840 _menuHlp->addAction(_actHelp);
841 _menuHlp->addAction(_actFlowchart);
842 _menuHlp->addAction(_actAbout);
843}
844
845//
846////////////////////////////////////////////////////////////////////////////
847void bncWindow::AddToolbar() {
848 // Tool (Command) Bar
849 // ------------------
850 QToolBar* toolBar = new QToolBar;
851 addToolBar(Qt::BottomToolBarArea, toolBar);
852 toolBar->setMovable(false);
853 toolBar->addAction(_actAddMountPoints);
854 toolBar->addAction(_actDeleteMountPoints);
855 toolBar->addAction(_actGetData);
856 toolBar->addAction(_actStop);
857 toolBar->addWidget(new QLabel(" "));
858 toolBar->addAction(_actwhatsthis);
859}
860
861//
862////////////////////////////////////////////////////////////////////////////
863bncAboutDlg::bncAboutDlg(QWidget* parent) :
864 QDialog(parent) {
865
866 QTextBrowser* tb = new QTextBrowser;
867 QUrl url; url.setPath(":bncabout.html");
868 tb->setSource(url);
869 tb->setReadOnly(true);
870
871 int ww = QFontMetrics(font()).width('w');
872 QPushButton* _closeButton = new QPushButton("Close");
873 _closeButton->setMaximumWidth(10*ww);
874 connect(_closeButton, SIGNAL(clicked()), this, SLOT(close()));
875
876 QGridLayout* dlgLayout = new QGridLayout();
877 QLabel* img = new QLabel();
878 img->setPixmap(QPixmap(":ntrip-logo.png"));
879 dlgLayout->addWidget(img, 0,0);
880 dlgLayout->addWidget(new QLabel("BKG Ntrip Client (BNC) Version 1.6"), 0,1);
881 dlgLayout->addWidget(tb,1,0,1,2);
882 dlgLayout->addWidget(_closeButton,2,1,Qt::AlignRight);
883
884 setLayout(dlgLayout);
885 resize(60*ww, 60*ww);
886 show();
887}
888
889//
890////////////////////////////////////////////////////////////////////////////
891bncAboutDlg::~bncAboutDlg() {
892};
893
894//
895////////////////////////////////////////////////////////////////////////////
896bncFlowchartDlg::bncFlowchartDlg(QWidget* parent) :
897 QDialog(parent) {
898
899 int ww = QFontMetrics(font()).width('w');
900 QPushButton* _closeButton = new QPushButton("Close");
901 _closeButton->setMaximumWidth(10*ww);
902 connect(_closeButton, SIGNAL(clicked()), this, SLOT(close()));
903
904 QGridLayout* dlgLayout = new QGridLayout();
905 QLabel* img = new QLabel();
906 img->setPixmap(QPixmap(":bncflowchart.png"));
907 dlgLayout->addWidget(img, 0,0);
908 dlgLayout->addWidget(_closeButton,1,0,Qt::AlignLeft);
909
910 setLayout(dlgLayout);
911 show();
912}
913
914//
915////////////////////////////////////////////////////////////////////////////
916bncFlowchartDlg::~bncFlowchartDlg() {
917};
918
Note: See TracBrowser for help on using the repository browser.