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

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

* empty log message *

File size: 22.3 KB
Line 
1
2/* -------------------------------------------------------------------------
3 * BKG NTRIP Server
4 * -------------------------------------------------------------------------
5 *
6 * Class: bnsWindow
7 *
8 * Purpose: This class implements the main application window.
9 *
10 * Author: L. Mervart
11 *
12 * Created: 29-Mar-2008
13 *
14 * Changes:
15 *
16 * -----------------------------------------------------------------------*/
17
18#include <iostream>
19
20#include "bnswindow.h"
21#include "bnshlpdlg.h"
22
23using namespace std;
24
25// About Dialog - Constructor
26////////////////////////////////////////////////////////////////////////////
27bnsAboutDlg::bnsAboutDlg(QWidget* parent) :
28 QDialog(parent) {
29
30 QTextBrowser* tb = new QTextBrowser;
31 QUrl url; url.setPath(":bnsabout.html");
32 tb->setSource(url);
33 tb->setReadOnly(true);
34
35 int ww = QFontMetrics(font()).width('w');
36 QPushButton* _closeButton = new QPushButton("Close");
37 _closeButton->setMaximumWidth(10*ww);
38 connect(_closeButton, SIGNAL(clicked()), this, SLOT(close()));
39
40 QGridLayout* dlgLayout = new QGridLayout();
41 QLabel* img = new QLabel();
42 img->setPixmap(QPixmap(":ntrip-logo.png"));
43 dlgLayout->addWidget(img, 0,0);
44 dlgLayout->addWidget(new QLabel("BKG Ntrip Server (BNS) Version 1.0"), 0,1);
45 dlgLayout->addWidget(tb,1,0,1,2);
46 dlgLayout->addWidget(_closeButton,2,1,Qt::AlignRight);
47
48 setLayout(dlgLayout);
49 resize(60*ww, 60*ww);
50 show();
51}
52
53// About Dialog - Destructor
54////////////////////////////////////////////////////////////////////////////
55bnsAboutDlg::~bnsAboutDlg() {
56};
57
58// Flowchart Dialog - Constructor
59////////////////////////////////////////////////////////////////////////////
60bnsFlowchartDlg::bnsFlowchartDlg(QWidget* parent) :
61 QDialog(parent) {
62
63 int ww = QFontMetrics(font()).width('w');
64 QPushButton* _closeButton = new QPushButton("Close");
65 _closeButton->setMaximumWidth(10*ww);
66 connect(_closeButton, SIGNAL(clicked()), this, SLOT(close()));
67
68 QGridLayout* dlgLayout = new QGridLayout();
69 QLabel* img = new QLabel();
70 img->setPixmap(QPixmap(":bnsflowchart.png"));
71 dlgLayout->addWidget(img, 0,0);
72 dlgLayout->addWidget(_closeButton,1,0,Qt::AlignLeft);
73
74 setLayout(dlgLayout);
75 show();
76}
77
78// Flowchart Dialog - Destructor
79////////////////////////////////////////////////////////////////////////////
80bnsFlowchartDlg::~bnsFlowchartDlg() {
81};
82
83// Constructor
84////////////////////////////////////////////////////////////////////////////
85bnsWindow::bnsWindow() {
86
87 _bns = 0;
88
89 QSettings settings;
90
91 QString fontString = settings.value("font").toString();
92 if ( !fontString.isEmpty() ) {
93 QFont newFont;
94 if (newFont.fromString(fontString)) {
95 this->setFont(newFont);
96 }
97 }
98
99 int ww = QFontMetrics(this->font()).width('w');
100 setMinimumSize(77*ww, 65*ww);
101 setWindowTitle(tr("BKG Ntrip Server (BNS) Version 1.0"));
102 setWindowIcon(QPixmap(":ntrip-logo.png"));
103
104 // Create Actions
105 // --------------
106 _actHelp = new QAction(tr("&Help Contents"),this);
107 connect(_actHelp, SIGNAL(triggered()), SLOT(slotHelp()));
108
109 _actAbout = new QAction(tr("&About BNS"),this);
110 connect(_actAbout, SIGNAL(triggered()), SLOT(slotAbout()));
111
112 _actFlowchart = new QAction(tr("&Flow Chart"),this);
113 connect(_actFlowchart, SIGNAL(triggered()), SLOT(slotFlowchart()));
114
115 _actFontSel = new QAction(tr("Select &Font"),this);
116 connect(_actFontSel, SIGNAL(triggered()), SLOT(slotFontSel()));
117
118 _actSaveOpt = new QAction(tr("&Save Options"),this);
119 connect(_actSaveOpt, SIGNAL(triggered()), SLOT(slotSaveOptions()));
120
121 _actQuit = new QAction(tr("&Quit"),this);
122 connect(_actQuit, SIGNAL(triggered()), SLOT(close()));
123
124 _actWhatsThis= new QAction(tr("Help=Shift+F1"),this);
125 connect(_actWhatsThis, SIGNAL(triggered()), SLOT(slotWhatsThis()));
126
127 _actStart = new QAction(tr("Sta&rt"),this);
128 connect(_actStart, SIGNAL(triggered()), SLOT(slotStart()));
129
130 _actStop = new QAction(tr("Sto&p"),this);
131 connect(_actStop, SIGNAL(triggered()), SLOT(slotStop()));
132 _actStop->setEnabled(false);
133
134 CreateMenu();
135 AddToolbar();
136
137 // Canvas with Editable Fields
138 // ---------------------------
139 _canvas = new QWidget;
140 setCentralWidget(_canvas);
141
142 _proxyHostLineEdit = new QLineEdit(settings.value("proxyHost").toString());
143 _proxyHostLineEdit->setWhatsThis(tr("<p>If you are running BNS within a protected Local Area Network (LAN), you might need to use a proxy server to access the Internet. Enter your proxy server IP and port number in case one is operated in front of BNS. If you do not know the IP and port of your proxy server, check the proxy server settings in your Internet browser or ask your network administrator.</p><p>Note that IP streaming is sometimes not allowed in a LAN. In this case you need to ask your network administrator for an appropriate modification of the local security policy or for the installation of a TCP relay to the NTRIP broadcasters. If these are not possible, you might need to run BNS outside your LAN on a network that has unobstructed connection to the Internet.</p>"));
144 _proxyPortLineEdit = new QLineEdit(settings.value("proxyPort").toString());
145 _proxyPortLineEdit->setWhatsThis(tr("<p>Enter your proxy server port number in case one is operated in front of BNS.</p>"));
146 _proxyPortLineEdit->setMaximumWidth(9*ww);
147
148 _logFileLineEdit = new QLineEdit(settings.value("logFile").toString());
149 _logFileLineEdit->setWhatsThis(tr("<p>Records of BNS activities are shown in the Log section on the bottom of this window. They can be saved into a file when a valid path is specified in the 'Logfile (full path)' field.</p>"));
150 _fileAppendCheckBox = new QCheckBox();
151 _fileAppendCheckBox->setCheckState(Qt::CheckState(settings.value("fileAppend").toInt()));
152 _fileAppendCheckBox->setWhatsThis(tr("<p>When BNS is started, new files are created by default and any existing files with the same name will be overwritten. However, users might want to append already existing files following a restart of BNS, a system crash or when BNS crashed. Tick 'Append files' to continue with existing files and keep what has been recorded so far.</p>"));
153
154 _refSysComboBox = new QComboBox;
155 _refSysComboBox->setMaximumWidth(9*ww);
156 _refSysComboBox->setEditable(false);
157 _refSysComboBox->addItems(QString("IGS05,ETRS89").split(","));
158 int ii = _refSysComboBox->findText(settings.value("refSys").toString());
159 if (ii != -1) {
160 _refSysComboBox->setCurrentIndex(ii);
161 }
162 _refSysComboBox->setWhatsThis(tr("Select the target reference system for outgoing clock and orbit corrections."));
163
164 _ephHostLineEdit = new QLineEdit(settings.value("ephHost").toString());
165 _ephHostLineEdit->setWhatsThis(tr("BNS reads Broadcast Ephemeris in RINEX Version 3 Navigation file format from an IP address. Specify the host IP e.g. of a BNC installation providing this information."));
166 _ephPortLineEdit = new QLineEdit(settings.value("ephPort").toString());
167 _ephPortLineEdit->setWhatsThis(tr("BNS reads Broadcast Ephemeris in RINEX Version 3 Navigation file format from an IP address. Specify the IP port e.g. of a BNC installation providing this information."));
168 _ephPortLineEdit->setMaximumWidth(9*ww);
169
170 _clkPortLineEdit = new QLineEdit(settings.value("clkPort").toString());
171 _clkPortLineEdit->setWhatsThis(tr("BNS reads Clocks & Orbits referring to the IGS system (X,Y,Z, ECEF) in plain ASCII format from an IP address. Specify the IP port e.g. of a RTNet installation providing this information."));
172 _clkPortLineEdit->setMaximumWidth(9*ww);
173
174 _outHostLineEdit = new QLineEdit(settings.value("outHost").toString());
175 _outHostLineEdit->setWhatsThis(tr("BNS can stream clock and orbit corrections to Broadcast Ephemeris in RTCM Version 3 format. Specify the host IP of an NTRIP Broadcaster to upload the stream. An empty option field means that you don't want to upload corrections."));
176 _outPortLineEdit = new QLineEdit(settings.value("outPort").toString());
177 _outPortLineEdit->setWhatsThis(tr("Specify the IP port of an NTRIP Broadcaster to upload the stream. Default is port 80."));
178 _outPortLineEdit->setMaximumWidth(9*ww);
179 _mountpointLineEdit = new QLineEdit(settings.value("mountpoint").toString());
180 _mountpointLineEdit->setWhatsThis(tr("Specify the mounpoint for stream upload to an NTRIP Broadcaster."));
181 _mountpointLineEdit->setMaximumWidth(9*ww);
182 _passwordLineEdit = new QLineEdit(settings.value("password").toString());
183 _passwordLineEdit->setWhatsThis(tr("Specify the stream upload password protecting the mounpoint on an NTRIP Broadcaster."));
184 _passwordLineEdit->setMaximumWidth(9*ww);
185 _passwordLineEdit->setEchoMode(QLineEdit::Password);
186 _outFileLineEdit = new QLineEdit(settings.value("outFile").toString());
187 _outFileLineEdit->setWhatsThis(tr("Specify the full path to a file where outgoing clock and orbit corrections to Broadcast Ephemeris are saved. Beware that the size of this file can rapidly increase. Default is an empty option field meaning that outgoing corrections are not saved."));
188
189 _rnxPathLineEdit = new QLineEdit(settings.value("rnxPath").toString());
190 _rnxPathLineEdit->setWhatsThis(tr("Specify the path for saving the generated clock corrections as Clock RINEX files. If the specified directory does not exist, BNS will not create Clock RINEX files."));
191 _rnxIntrComboBox = new QComboBox;
192 _rnxIntrComboBox->setMaximumWidth(9*ww);
193 _rnxIntrComboBox->setEditable(false);
194 _rnxIntrComboBox->addItems(QString("1 min,2 min,5 min,10 min,15 min,30 min,1 hour,1 day").split(","));
195 ii = _rnxIntrComboBox->findText(settings.value("rnxIntr").toString());
196 if (ii != -1) {
197 _rnxIntrComboBox->setCurrentIndex(ii);
198 }
199 _rnxIntrComboBox->setWhatsThis(tr("Select the length of the Clock RINEX file."));
200 _rnxSamplSpinBox = new QSpinBox;
201 _rnxSamplSpinBox->setMinimum(0);
202 _rnxSamplSpinBox->setMaximum(60);
203 _rnxSamplSpinBox->setSingleStep(5);
204 _rnxSamplSpinBox->setMaximumWidth(9*ww);
205 _rnxSamplSpinBox->setValue(settings.value("rnxSampl").toInt());
206 _rnxSamplSpinBox->setSuffix(" sec");
207 _rnxSamplSpinBox->setWhatsThis(tr("Select the Clock RINEX file sampling interval in seconds. A value of zero '0' tells BNS to store all available samples into Clock RINEX files."));
208
209 _sp3PathLineEdit = new QLineEdit(settings.value("sp3Path").toString());
210 _sp3PathLineEdit->setWhatsThis(tr("Specify the path for saving the generated orbit corrections as SP3 orbit files. If the specified directory does not exist, BNS will not create SP3 orbit files."));
211 _sp3IntrComboBox = new QComboBox;
212 _sp3IntrComboBox->setMaximumWidth(9*ww);
213 _sp3IntrComboBox->setEditable(false);
214 _sp3IntrComboBox->addItems(QString("1 min,2 min,5 min,10 min,15 min,30 min,1 hour,1 day").split(","));
215 ii = _sp3IntrComboBox->findText(settings.value("sp3Intr").toString());
216 if (ii != -1) {
217 _sp3IntrComboBox->setCurrentIndex(ii);
218 }
219 _sp3IntrComboBox->setWhatsThis(tr("Select the length of the SP3 orbit file."));
220 _sp3SamplSpinBox = new QSpinBox;
221 _sp3SamplSpinBox->setMinimum(0);
222 _sp3SamplSpinBox->setMaximum(900);
223 _sp3SamplSpinBox->setSingleStep(60);
224 _sp3SamplSpinBox->setMaximumWidth(9*ww);
225 _sp3SamplSpinBox->setValue(settings.value("sp3Sampl").toInt());
226 _sp3SamplSpinBox->setSuffix(" sec");
227 _sp3SamplSpinBox->setWhatsThis(tr("Select the SP3 orbit file sampling interval in seconds. A value of zero '0' tells BNS to store all available samples into SP3 orbit files."));
228
229 // TabWidget
230 // ---------
231 QTabWidget* tabs = new QTabWidget();
232
233 // Proxy Tab
234 // ---------
235 QWidget* tab_prx = new QWidget();
236 tabs->setMaximumHeight(20*ww);
237 tabs->addTab(tab_prx, "Proxy");
238
239 QGridLayout* layout_prx = new QGridLayout;
240 layout_prx->setColumnMinimumWidth(0,9*ww);
241
242 layout_prx->addWidget(new QLabel("Proxy host"), 0, 0, Qt::AlignLeft);
243 layout_prx->addWidget(_proxyHostLineEdit, 0, 1);
244 layout_prx->addWidget(new QLabel("Proxy port"), 1, 0, Qt::AlignLeft);
245 layout_prx->addWidget(_proxyPortLineEdit, 1, 1);
246 layout_prx->addWidget(new QLabel("Settings for the proxy in protected networks, leave boxes blank if none."),2, 0, 1, 2, Qt::AlignLeft);
247 layout_prx->addWidget(new QLabel(" "), 3, 0);
248 layout_prx->addWidget(new QLabel(" "), 4, 0);
249
250 tab_prx->setLayout(layout_prx);
251
252 // General Tab
253 // -----------
254 QWidget* tab_gen = new QWidget();
255 tabs->addTab(tab_gen, "General");
256
257 QGridLayout* layout_gen = new QGridLayout;
258 layout_gen->setColumnMinimumWidth(0,9*ww);
259
260 layout_gen->addWidget(new QLabel("Logfile (full path)"), 0, 0);
261 layout_gen->addWidget(_logFileLineEdit, 0, 1);
262 layout_gen->addWidget(new QLabel("Append files"), 1, 0);
263 layout_gen->addWidget(_fileAppendCheckBox, 1, 1);
264 layout_gen->addWidget(new QLabel("Reference System"), 2, 0);
265 layout_gen->addWidget(_refSysComboBox, 2, 1);
266 layout_gen->addWidget(new QLabel("General settings for logfile, file handling and target reference system."),3, 0, 1, 2, Qt::AlignLeft);
267 layout_gen->addWidget(new QLabel(" "), 4, 0);
268
269 tab_gen->setLayout(layout_gen);
270
271 // Input Tab
272 // ---------
273 QWidget* tab_inp = new QWidget();
274 tabs->addTab(tab_inp, "Input");
275
276 QGridLayout* layout_inp = new QGridLayout;
277 layout_inp->setColumnMinimumWidth(0, 9*ww);
278
279 layout_inp->addWidget(new QLabel("Ephemeris"), 0, 0, Qt::AlignLeft);
280 layout_inp->addWidget(new QLabel("Host"), 0, 1, Qt::AlignRight);
281 layout_inp->addWidget(_ephHostLineEdit, 0, 2);
282 layout_inp->addWidget(new QLabel("Port"), 0, 3, Qt::AlignLeft);
283 layout_inp->addWidget(_ephPortLineEdit, 0, 4);
284 layout_inp->addWidget(new QLabel("Clocks & Orbits"), 1, 0, Qt::AlignLeft);
285 layout_inp->addWidget(new QLabel("Server listening on Port"), 1, 1, 1, 3, Qt::AlignRight);
286 layout_inp->addWidget(_clkPortLineEdit, 1, 4);
287 layout_inp->addWidget(new QLabel("Read broadcast ephemeris and IGS clocks and orbits."), 2, 0, 1, 6, Qt::AlignLeft);
288 layout_inp->addWidget(new QLabel(""), 3, 0);
289
290 tab_inp->setLayout(layout_inp);
291
292 // NTRIP Caster Tab
293 // ----------------
294 QWidget* tab_cas = new QWidget();
295 tabs->addTab(tab_cas, "NTRIP Caster");
296
297 QGridLayout* layout_cas = new QGridLayout;
298 layout_cas->setColumnMinimumWidth(0, 9*ww);
299
300 layout_cas->addWidget(new QLabel("Host"), 0, 0, Qt::AlignLeft);
301 layout_cas->addWidget(_outHostLineEdit, 0, 1);
302 layout_cas->addWidget(new QLabel("Port"), 0, 3, Qt::AlignLeft);
303 layout_cas->addWidget(_outPortLineEdit, 0, 4);
304 layout_cas->addWidget(new QLabel("Mountpoint"), 1, 0, Qt::AlignLeft);
305 layout_cas->addWidget(_mountpointLineEdit, 1, 1);
306 layout_cas->addWidget(new QLabel("Password"), 1, 3, Qt::AlignLeft);
307 layout_cas->addWidget(_passwordLineEdit, 1, 4);
308 layout_cas->addWidget(new QLabel("Save stream (full path)"), 2, 0, Qt::AlignLeft);
309 layout_cas->addWidget(_outFileLineEdit, 2, 1);
310 layout_cas->addWidget(new QLabel("Stream upload of clock and orbit corrections to NTRIP broadcaster."),4, 0, 1, 2, Qt::AlignLeft);
311
312 tab_cas->setLayout(layout_cas);
313
314 // RINEX Tab
315 // ---------
316 QWidget* tab_rin = new QWidget();
317 tabs->addTab(tab_rin, "RINEX Clocks ");
318
319 QGridLayout* layout_rin = new QGridLayout;
320 layout_rin->setColumnMinimumWidth(0, 9*ww);
321
322 layout_rin->addWidget(new QLabel("Directory"), 0, 0);
323 layout_rin->addWidget(_rnxPathLineEdit, 0, 1);
324 layout_rin->addWidget(new QLabel("Interval"), 1, 0);
325 layout_rin->addWidget(_rnxIntrComboBox, 1, 1);
326 layout_rin->addWidget(new QLabel("Sampling"), 2, 0);
327 layout_rin->addWidget(_rnxSamplSpinBox, 2, 1);
328 layout_rin->addWidget(new QLabel("Save clock corrections in Clock RINEX file format."), 3, 0, 1, 2, Qt::AlignLeft);
329 layout_rin->addWidget(new QLabel(""), 4, 0);
330
331 tab_rin->setLayout(layout_rin);
332
333 // SP3 Tab
334 // -------
335 QWidget* tab_sp3 = new QWidget();
336 tabs->addTab(tab_sp3, "SP3 Orbits");
337
338 QGridLayout* layout_sp3 = new QGridLayout;
339 layout_sp3->setColumnMinimumWidth(0, 9*ww);
340
341 layout_sp3->addWidget(new QLabel("Directory"), 0, 0);
342 layout_sp3->addWidget(_sp3PathLineEdit, 0, 1);
343 layout_sp3->addWidget(new QLabel("Interval"), 1, 0);
344 layout_sp3->addWidget(_sp3IntrComboBox, 1, 1);
345 layout_sp3->addWidget(new QLabel("Sampling"), 2, 0);
346 layout_sp3->addWidget(_sp3SamplSpinBox, 2, 1);
347 layout_sp3->addWidget(new QLabel("Save orbit corrections in SP3 file format."), 3, 0, 1, 2, Qt::AlignLeft);
348 layout_sp3->addWidget(new QLabel(""), 4, 0);
349
350 tab_sp3->setLayout(layout_sp3);
351
352 // Log
353 // ---
354 _log = new QTextBrowser();
355 _log->setReadOnly(true);
356 _log->setWhatsThis(tr("Records of BNS's activities are shown in the Log section."));
357
358 // Main Layout
359 // -----------
360 QVBoxLayout* mainLayout = new QVBoxLayout;
361 mainLayout->addWidget(tabs);
362 mainLayout->addWidget(_log);
363
364 _canvas->setLayout(mainLayout);
365}
366
367// Destructor
368////////////////////////////////////////////////////////////////////////////
369bnsWindow::~bnsWindow() {
370}
371
372// Close Application gracefully
373////////////////////////////////////////////////////////////////////////////
374void bnsWindow::closeEvent(QCloseEvent* event) {
375
376int iRet = QMessageBox::question(this, "Close", "Save Options?",
377 QMessageBox::Yes, QMessageBox::No,
378 QMessageBox::Cancel);
379
380 if (iRet == QMessageBox::Cancel) {
381 event->ignore();
382 return;
383 }
384 else if (iRet == QMessageBox::Yes) {
385 slotSaveOptions();
386 }
387
388 QMainWindow::closeEvent(event);
389}
390
391// About Message
392////////////////////////////////////////////////////////////////////////////
393void bnsWindow::slotAbout() {
394 new bnsAboutDlg(0);
395}
396
397//Flowchart
398////////////////////////////////////////////////////////////////////////////
399void bnsWindow::slotFlowchart() {
400 new bnsFlowchartDlg(0);
401}
402
403// Help Window
404////////////////////////////////////////////////////////////////////////////
405void bnsWindow::slotHelp() {
406 QUrl url;
407 url.setPath(":bnshelp.html");
408 new bnsHlpDlg(0, url);
409}
410
411// Select Fonts
412////////////////////////////////////////////////////////////////////////////
413void bnsWindow::slotFontSel() {
414 bool ok;
415 QFont newFont = QFontDialog::getFont(&ok, this->font(), this);
416 if (ok) {
417 QSettings settings;
418 settings.setValue("font", newFont.toString());
419 QApplication::setFont(newFont);
420 int ww = QFontMetrics(newFont).width('w');
421 setMinimumSize(77*ww, 65*ww);
422 }
423}
424
425// Whats This Help
426////////////////////////////////////////////////////////////////////////////
427void bnsWindow::slotWhatsThis() {
428QWhatsThis::enterWhatsThisMode();
429}
430
431// Create Menus
432////////////////////////////////////////////////////////////////////////////
433void bnsWindow::CreateMenu() {
434 _menuFile = menuBar()->addMenu(tr("&File"));
435 _menuFile->addAction(_actFontSel);
436 _menuFile->addSeparator();
437 _menuFile->addAction(_actSaveOpt);
438 _menuFile->addSeparator();
439 _menuFile->addAction(_actQuit);
440
441 _menuHlp = menuBar()->addMenu(tr("&Help"));
442 _menuHlp->addAction(_actHelp);
443 _menuHlp->addAction(_actFlowchart);
444 _menuHlp->addAction(_actAbout);
445}
446
447// Tool (Command) Bar
448////////////////////////////////////////////////////////////////////////////
449void bnsWindow::AddToolbar() {
450 QToolBar* toolBar = new QToolBar;
451 addToolBar(Qt::BottomToolBarArea, toolBar);
452 toolBar->setMovable(false);
453 toolBar->addAction(_actStart);
454 toolBar->addAction(_actStop);
455 toolBar->addWidget(new QLabel(" "));
456 toolBar->addAction(_actWhatsThis);
457}
458
459// Save Options
460////////////////////////////////////////////////////////////////////////////
461void bnsWindow::slotSaveOptions() {
462 QSettings settings;
463 settings.setValue("proxyHost", _proxyHostLineEdit->text());
464 settings.setValue("proxyPort", _proxyPortLineEdit->text());
465 settings.setValue("logFile", _logFileLineEdit->text());
466 settings.setValue("fileAppend", _fileAppendCheckBox->checkState());
467 settings.setValue("refSys", _refSysComboBox->currentText());
468 settings.setValue("ephHost", _ephHostLineEdit->text());
469 settings.setValue("ephPort", _ephPortLineEdit->text());
470 settings.setValue("clkPort", _clkPortLineEdit->text());
471 settings.setValue("outHost", _outHostLineEdit->text());
472 settings.setValue("outPort", _outPortLineEdit->text());
473 settings.setValue("mountpoint", _mountpointLineEdit->text());
474 settings.setValue("outFile", _outFileLineEdit->text());
475 settings.setValue("password", _passwordLineEdit->text());
476 settings.setValue("rnxPath", _rnxPathLineEdit->text());
477 settings.setValue("rnxIntr", _rnxIntrComboBox->currentText());
478 settings.setValue("rnxSampl", _rnxSamplSpinBox->value());
479 settings.setValue("sp3Path", _sp3PathLineEdit->text());
480 settings.setValue("sp3Intr", _sp3IntrComboBox->currentText());
481 settings.setValue("sp3Sampl", _sp3SamplSpinBox->value());
482}
483
484// Display Program Messages
485////////////////////////////////////////////////////////////////////////////
486void bnsWindow::slotMessage(const QByteArray msg) {
487
488 const int maxBufferSize = 10000;
489
490 QString txt = _log->toPlainText() + "\n" +
491 QDateTime::currentDateTime().toUTC().toString("yy-MM-dd hh:mm:ss ") + msg;
492 _log->clear();
493 _log->append(txt.right(maxBufferSize));
494}
495
496// Delete bns
497////////////////////////////////////////////////////////////////////////////
498void bnsWindow::deleteBns() {
499 _actStart->setEnabled(true);
500 _actStop->setEnabled(false);
501 _bns->terminate();
502 _bns->wait(100);
503 delete _bns;
504 _bns = 0;
505}
506
507// Error in bns
508////////////////////////////////////////////////////////////////////////////
509void bnsWindow::slotError(const QByteArray msg) {
510 slotMessage(msg);
511 deleteBns();
512}
513
514// Stop
515////////////////////////////////////////////////////////////////////////////
516void bnsWindow::slotStop() {
517 int iRet = QMessageBox::question(this, "Stop", "Do you want to stop?",
518 QMessageBox::Yes, QMessageBox::No,
519 QMessageBox::NoButton);
520 if (iRet == QMessageBox::Yes) {
521 deleteBns();
522 }
523}
524
525// Start
526////////////////////////////////////////////////////////////////////////////
527void bnsWindow::slotStart() {
528 slotSaveOptions();
529
530 _actStart->setEnabled(false);
531 _actStop->setEnabled(true);
532
533 _bns = new t_bns(0);
534
535 connect(_bns, SIGNAL(newMessage(QByteArray)),
536 this, SLOT(slotMessage(const QByteArray)));
537
538 connect(_bns, SIGNAL(error(QByteArray)),
539 this, SLOT(slotError(const QByteArray)));
540
541 _bns->start();
542}
Note: See TracBrowser for help on using the repository browser.