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

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

* empty log message *

File size: 22.4 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 State Space 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 State Space 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 port. Specify a local IP port e.g. for an RTNet installation to provide 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("BNS 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 layout_inp->addWidget(new QLabel(""), 4, 0);
290
291 tab_inp->setLayout(layout_inp);
292
293 // NTRIP Caster Tab
294 // ----------------
295 QWidget* tab_cas = new QWidget();
296 tabs->addTab(tab_cas, "NTRIP Caster");
297
298 QGridLayout* layout_cas = new QGridLayout;
299 layout_cas->setColumnMinimumWidth(0, 9*ww);
300
301 layout_cas->addWidget(new QLabel("Host"), 0, 0, Qt::AlignLeft);
302 layout_cas->addWidget(_outHostLineEdit, 0, 1);
303 layout_cas->addWidget(new QLabel("Port"), 0, 3, Qt::AlignLeft);
304 layout_cas->addWidget(_outPortLineEdit, 0, 4);
305 layout_cas->addWidget(new QLabel("Mountpoint"), 1, 0, Qt::AlignLeft);
306 layout_cas->addWidget(_mountpointLineEdit, 1, 1);
307 layout_cas->addWidget(new QLabel("Password"), 1, 3, Qt::AlignLeft);
308 layout_cas->addWidget(_passwordLineEdit, 1, 4);
309 layout_cas->addWidget(new QLabel("Save stream (full path)"), 2, 0, Qt::AlignLeft);
310 layout_cas->addWidget(_outFileLineEdit, 2, 1);
311 layout_cas->addWidget(new QLabel("Stream upload of clock and orbit corrections to NTRIP broadcaster."), 3, 0, 1, 4, Qt::AlignLeft);
312 layout_cas->addWidget(new QLabel(""), 4, 0);
313
314 tab_cas->setLayout(layout_cas);
315
316 // RINEX Tab
317 // ---------
318 QWidget* tab_rin = new QWidget();
319 tabs->addTab(tab_rin, "RINEX Clocks ");
320
321 QGridLayout* layout_rin = new QGridLayout;
322 layout_rin->setColumnMinimumWidth(0, 9*ww);
323
324 layout_rin->addWidget(new QLabel("Directory"), 0, 0);
325 layout_rin->addWidget(_rnxPathLineEdit, 0, 1);
326 layout_rin->addWidget(new QLabel("Interval"), 1, 0);
327 layout_rin->addWidget(_rnxIntrComboBox, 1, 1);
328 layout_rin->addWidget(new QLabel("Sampling"), 2, 0);
329 layout_rin->addWidget(_rnxSamplSpinBox, 2, 1);
330 layout_rin->addWidget(new QLabel("Save clock corrections in Clock RINEX file format."), 3, 0, 1, 2, Qt::AlignLeft);
331 layout_rin->addWidget(new QLabel(""), 4, 0);
332
333 tab_rin->setLayout(layout_rin);
334
335 // SP3 Tab
336 // -------
337 QWidget* tab_sp3 = new QWidget();
338 tabs->addTab(tab_sp3, "SP3 Orbits");
339
340 QGridLayout* layout_sp3 = new QGridLayout;
341 layout_sp3->setColumnMinimumWidth(0, 9*ww);
342
343 layout_sp3->addWidget(new QLabel("Directory"), 0, 0);
344 layout_sp3->addWidget(_sp3PathLineEdit, 0, 1);
345 layout_sp3->addWidget(new QLabel("Interval"), 1, 0);
346 layout_sp3->addWidget(_sp3IntrComboBox, 1, 1);
347 layout_sp3->addWidget(new QLabel("Sampling"), 2, 0);
348 layout_sp3->addWidget(_sp3SamplSpinBox, 2, 1);
349 layout_sp3->addWidget(new QLabel("Save orbit corrections in SP3 file format."), 3, 0, 1, 2, Qt::AlignLeft);
350 layout_sp3->addWidget(new QLabel(""), 4, 0);
351
352 tab_sp3->setLayout(layout_sp3);
353
354 // Log
355 // ---
356 _log = new QTextBrowser();
357 _log->setReadOnly(true);
358 _log->setWhatsThis(tr("Records of BNS's activities are shown in the Log section."));
359
360 // Main Layout
361 // -----------
362 QVBoxLayout* mainLayout = new QVBoxLayout;
363 mainLayout->addWidget(tabs);
364 mainLayout->addWidget(_log);
365
366 _canvas->setLayout(mainLayout);
367}
368
369// Destructor
370////////////////////////////////////////////////////////////////////////////
371bnsWindow::~bnsWindow() {
372}
373
374// Close Application gracefully
375////////////////////////////////////////////////////////////////////////////
376void bnsWindow::closeEvent(QCloseEvent* event) {
377
378int iRet = QMessageBox::question(this, "Close", "Save Options?",
379 QMessageBox::Yes, QMessageBox::No,
380 QMessageBox::Cancel);
381
382 if (iRet == QMessageBox::Cancel) {
383 event->ignore();
384 return;
385 }
386 else if (iRet == QMessageBox::Yes) {
387 slotSaveOptions();
388 }
389
390 QMainWindow::closeEvent(event);
391}
392
393// About Message
394////////////////////////////////////////////////////////////////////////////
395void bnsWindow::slotAbout() {
396 new bnsAboutDlg(0);
397}
398
399//Flowchart
400////////////////////////////////////////////////////////////////////////////
401void bnsWindow::slotFlowchart() {
402 new bnsFlowchartDlg(0);
403}
404
405// Help Window
406////////////////////////////////////////////////////////////////////////////
407void bnsWindow::slotHelp() {
408 QUrl url;
409 url.setPath(":bnshelp.html");
410 new bnsHlpDlg(0, url);
411}
412
413// Select Fonts
414////////////////////////////////////////////////////////////////////////////
415void bnsWindow::slotFontSel() {
416 bool ok;
417 QFont newFont = QFontDialog::getFont(&ok, this->font(), this);
418 if (ok) {
419 QSettings settings;
420 settings.setValue("font", newFont.toString());
421 QApplication::setFont(newFont);
422 int ww = QFontMetrics(newFont).width('w');
423 setMinimumSize(77*ww, 65*ww);
424 }
425}
426
427// Whats This Help
428////////////////////////////////////////////////////////////////////////////
429void bnsWindow::slotWhatsThis() {
430QWhatsThis::enterWhatsThisMode();
431}
432
433// Create Menus
434////////////////////////////////////////////////////////////////////////////
435void bnsWindow::CreateMenu() {
436 _menuFile = menuBar()->addMenu(tr("&File"));
437 _menuFile->addAction(_actFontSel);
438 _menuFile->addSeparator();
439 _menuFile->addAction(_actSaveOpt);
440 _menuFile->addSeparator();
441 _menuFile->addAction(_actQuit);
442
443 _menuHlp = menuBar()->addMenu(tr("&Help"));
444 _menuHlp->addAction(_actHelp);
445 _menuHlp->addAction(_actFlowchart);
446 _menuHlp->addAction(_actAbout);
447}
448
449// Tool (Command) Bar
450////////////////////////////////////////////////////////////////////////////
451void bnsWindow::AddToolbar() {
452 QToolBar* toolBar = new QToolBar;
453 addToolBar(Qt::BottomToolBarArea, toolBar);
454 toolBar->setMovable(false);
455 toolBar->addAction(_actStart);
456 toolBar->addAction(_actStop);
457 toolBar->addWidget(new QLabel(" "));
458 toolBar->addAction(_actWhatsThis);
459}
460
461// Save Options
462////////////////////////////////////////////////////////////////////////////
463void bnsWindow::slotSaveOptions() {
464 QSettings settings;
465 settings.setValue("proxyHost", _proxyHostLineEdit->text());
466 settings.setValue("proxyPort", _proxyPortLineEdit->text());
467 settings.setValue("logFile", _logFileLineEdit->text());
468 settings.setValue("fileAppend", _fileAppendCheckBox->checkState());
469 settings.setValue("refSys", _refSysComboBox->currentText());
470 settings.setValue("ephHost", _ephHostLineEdit->text());
471 settings.setValue("ephPort", _ephPortLineEdit->text());
472 settings.setValue("clkPort", _clkPortLineEdit->text());
473 settings.setValue("outHost", _outHostLineEdit->text());
474 settings.setValue("outPort", _outPortLineEdit->text());
475 settings.setValue("mountpoint", _mountpointLineEdit->text());
476 settings.setValue("outFile", _outFileLineEdit->text());
477 settings.setValue("password", _passwordLineEdit->text());
478 settings.setValue("rnxPath", _rnxPathLineEdit->text());
479 settings.setValue("rnxIntr", _rnxIntrComboBox->currentText());
480 settings.setValue("rnxSampl", _rnxSamplSpinBox->value());
481 settings.setValue("sp3Path", _sp3PathLineEdit->text());
482 settings.setValue("sp3Intr", _sp3IntrComboBox->currentText());
483 settings.setValue("sp3Sampl", _sp3SamplSpinBox->value());
484}
485
486// Display Program Messages
487////////////////////////////////////////////////////////////////////////////
488void bnsWindow::slotMessage(const QByteArray msg) {
489
490 const int maxBufferSize = 10000;
491
492 QString txt = _log->toPlainText() + "\n" +
493 QDateTime::currentDateTime().toUTC().toString("yy-MM-dd hh:mm:ss ") + msg;
494 _log->clear();
495 _log->append(txt.right(maxBufferSize));
496}
497
498// Delete bns
499////////////////////////////////////////////////////////////////////////////
500void bnsWindow::deleteBns() {
501 _actStart->setEnabled(true);
502 _actStop->setEnabled(false);
503 _bns->terminate();
504 _bns->wait(100);
505 delete _bns;
506 _bns = 0;
507}
508
509// Error in bns
510////////////////////////////////////////////////////////////////////////////
511void bnsWindow::slotError(const QByteArray msg) {
512 slotMessage(msg);
513 deleteBns();
514}
515
516// Stop
517////////////////////////////////////////////////////////////////////////////
518void bnsWindow::slotStop() {
519 int iRet = QMessageBox::question(this, "Stop", "Do you want to stop?",
520 QMessageBox::Yes, QMessageBox::No,
521 QMessageBox::NoButton);
522 if (iRet == QMessageBox::Yes) {
523 deleteBns();
524 }
525}
526
527// Start
528////////////////////////////////////////////////////////////////////////////
529void bnsWindow::slotStart() {
530 slotSaveOptions();
531
532 _actStart->setEnabled(false);
533 _actStop->setEnabled(true);
534
535 _bns = new t_bns(0);
536
537 connect(_bns, SIGNAL(newMessage(QByteArray)),
538 this, SLOT(slotMessage(const QByteArray)));
539
540 connect(_bns, SIGNAL(error(QByteArray)),
541 this, SLOT(slotError(const QByteArray)));
542
543 _bns->start();
544}
Note: See TracBrowser for help on using the repository browser.