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

Last change on this file since 977 was 977, checked in by mervart, 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// Constructor
59////////////////////////////////////////////////////////////////////////////
60bnsWindow::bnsWindow() {
61
62 _bns = 0;
63
64 QSettings settings;
65
66 QString fontString = settings.value("font").toString();
67 if ( !fontString.isEmpty() ) {
68 QFont newFont;
69 if (newFont.fromString(fontString)) {
70 this->setFont(newFont);
71 }
72 }
73
74 int ww = QFontMetrics(this->font()).width('w');
75 setMinimumSize(77*ww, 65*ww);
76 setWindowTitle(tr("BKG Ntrip Server (BNS) Version 1.0"));
77 setWindowIcon(QPixmap(":ntrip-logo.png"));
78
79 // Create Actions
80 // --------------
81 _actHelp = new QAction(tr("&Help Contents"),this);
82 connect(_actHelp, SIGNAL(triggered()), SLOT(slotHelp()));
83
84 _actAbout = new QAction(tr("&About BNS"),this);
85 connect(_actAbout, SIGNAL(triggered()), SLOT(slotAbout()));
86
87 _actFontSel = new QAction(tr("Select &Font"),this);
88 connect(_actFontSel, SIGNAL(triggered()), SLOT(slotFontSel()));
89
90 _actSaveOpt = new QAction(tr("&Save Options"),this);
91 connect(_actSaveOpt, SIGNAL(triggered()), SLOT(slotSaveOptions()));
92
93 _actQuit = new QAction(tr("&Quit"),this);
94 connect(_actQuit, SIGNAL(triggered()), SLOT(close()));
95
96 _actWhatsThis= new QAction(tr("Help=Shift+F1"),this);
97 connect(_actWhatsThis, SIGNAL(triggered()), SLOT(slotWhatsThis()));
98
99 _actStart = new QAction(tr("Sta&rt"),this);
100 connect(_actStart, SIGNAL(triggered()), SLOT(slotStart()));
101
102 _actStop = new QAction(tr("Sto&p"),this);
103 connect(_actStop, SIGNAL(triggered()), SLOT(slotStop()));
104 _actStop->setEnabled(false);
105
106 CreateMenu();
107 AddToolbar();
108
109 // Canvas with Editable Fields
110 // ---------------------------
111 _canvas = new QWidget;
112 setCentralWidget(_canvas);
113
114 _proxyHostLineEdit = new QLineEdit(settings.value("proxyHost").toString());
115 _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>"));
116 _proxyPortLineEdit = new QLineEdit(settings.value("proxyPort").toString());
117 _proxyPortLineEdit->setWhatsThis(tr("<p>Enter your proxy server port number in case one is operated in front of BNS.</p>"));
118 _proxyPortLineEdit->setMaximumWidth(9*ww);
119
120 _logFileLineEdit = new QLineEdit(settings.value("logFile").toString());
121 _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>"));
122 _fileAppendCheckBox = new QCheckBox();
123 _fileAppendCheckBox->setCheckState(Qt::CheckState(settings.value("fileAppend").toInt()));
124 _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>"));
125
126 _refSysComboBox = new QComboBox;
127 _refSysComboBox->setMaximumWidth(9*ww);
128 _refSysComboBox->setEditable(false);
129 _refSysComboBox->addItems(QString("IGS05,ETRS89").split(","));
130 int ii = _refSysComboBox->findText(settings.value("refSys").toString());
131 if (ii != -1) {
132 _refSysComboBox->setCurrentIndex(ii);
133 }
134 _refSysComboBox->setWhatsThis(tr("Select the target reference system for outgoing clock and orbit corrections."));
135
136 _ephHostLineEdit = new QLineEdit(settings.value("ephHost").toString());
137 _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."));
138 _ephPortLineEdit = new QLineEdit(settings.value("ephPort").toString());
139 _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."));
140 _ephPortLineEdit->setMaximumWidth(9*ww);
141
142 _clkHostLineEdit = new QLineEdit(settings.value("clkHost").toString());
143 _clkHostLineEdit->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 host IP e.g. of an RTNet installation providing this information."));
144 _clkPortLineEdit = new QLineEdit(settings.value("clkPort").toString());
145 _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."));
146 _clkFileLineEdit = new QLineEdit(settings.value("clkFile").toString());
147 _clkFileLineEdit->setWhatsThis(tr("Specify the full path to a file where incoming IGS Clocks & Orbits are saved. Beware that the size of this file can rapidly increase. Default is an empty option field meaning that incoming Clocks & Orbits corrections are not saved."));
148 _clkPortLineEdit->setMaximumWidth(9*ww);
149
150 _outHostLineEdit = new QLineEdit(settings.value("outHost").toString());
151 _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."));
152 _outPortLineEdit = new QLineEdit(settings.value("outPort").toString());
153 _outPortLineEdit->setWhatsThis(tr("Specify the IP port of an NTRIP Broadcaster to upload the stream. Default is port 80."));
154 _outPortLineEdit->setMaximumWidth(9*ww);
155 _mountpointLineEdit = new QLineEdit(settings.value("mountpoint").toString());
156 _mountpointLineEdit->setWhatsThis(tr("Specify the mounpoint for stream upload to an NTRIP Broadcaster."));
157 _mountpointLineEdit->setMaximumWidth(9*ww);
158 _passwordLineEdit = new QLineEdit(settings.value("password").toString());
159 _passwordLineEdit->setWhatsThis(tr("Specify the stream upload password protecting the mounpoint on an NTRIP Broadcaster."));
160 _passwordLineEdit->setMaximumWidth(9*ww);
161 _passwordLineEdit->setEchoMode(QLineEdit::Password);
162 _outFileLineEdit = new QLineEdit(settings.value("outFile").toString());
163 _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."));
164
165 _rnxPathLineEdit = new QLineEdit(settings.value("rnxPath").toString());
166 _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."));
167 _rnxIntrComboBox = new QComboBox;
168 _rnxIntrComboBox->setMaximumWidth(9*ww);
169 _rnxIntrComboBox->setEditable(false);
170 _rnxIntrComboBox->addItems(QString("1 min,2 min,5 min,10 min,15 min,30 min,1 hour,1 day").split(","));
171 ii = _rnxIntrComboBox->findText(settings.value("rnxIntr").toString());
172 if (ii != -1) {
173 _rnxIntrComboBox->setCurrentIndex(ii);
174 }
175 _rnxIntrComboBox->setWhatsThis(tr("Select the length of the Clock RINEX file."));
176 _rnxSamplSpinBox = new QSpinBox;
177 _rnxSamplSpinBox->setMinimum(0);
178 _rnxSamplSpinBox->setMaximum(60);
179 _rnxSamplSpinBox->setSingleStep(5);
180 _rnxSamplSpinBox->setMaximumWidth(9*ww);
181 _rnxSamplSpinBox->setValue(settings.value("rnxSampl").toInt());
182 _rnxSamplSpinBox->setSuffix(" sec");
183 _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."));
184
185 _sp3PathLineEdit = new QLineEdit(settings.value("sp3Path").toString());
186 _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."));
187 _sp3IntrComboBox = new QComboBox;
188 _sp3IntrComboBox->setMaximumWidth(9*ww);
189 _sp3IntrComboBox->setEditable(false);
190 _sp3IntrComboBox->addItems(QString("1 min,2 min,5 min,10 min,15 min,30 min,1 hour,1 day").split(","));
191 ii = _sp3IntrComboBox->findText(settings.value("sp3Intr").toString());
192 if (ii != -1) {
193 _sp3IntrComboBox->setCurrentIndex(ii);
194 }
195 _sp3IntrComboBox->setWhatsThis(tr("Select the length of the SP3 orbit file."));
196 _sp3SamplSpinBox = new QSpinBox;
197 _sp3SamplSpinBox->setMinimum(0);
198 _sp3SamplSpinBox->setMaximum(900);
199 _sp3SamplSpinBox->setSingleStep(60);
200 _sp3SamplSpinBox->setMaximumWidth(9*ww);
201 _sp3SamplSpinBox->setValue(settings.value("sp3Sampl").toInt());
202 _sp3SamplSpinBox->setSuffix(" sec");
203 _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."));
204
205 // TabWidget
206 // ---------
207 QTabWidget* tabs = new QTabWidget();
208
209 // Proxy Tab
210 // ---------
211 QWidget* tab_prx = new QWidget();
212 tabs->setMaximumHeight(20*ww);
213 tabs->addTab(tab_prx, "Proxy");
214
215 QGridLayout* layout_prx = new QGridLayout;
216 layout_prx->setColumnMinimumWidth(0,9*ww);
217
218 layout_prx->addWidget(new QLabel("Proxy host"), 0, 0, Qt::AlignLeft);
219 layout_prx->addWidget(_proxyHostLineEdit, 0, 1);
220 layout_prx->addWidget(new QLabel("Proxy port"), 1, 0, Qt::AlignLeft);
221 layout_prx->addWidget(_proxyPortLineEdit, 1, 1);
222 layout_prx->addWidget(new QLabel("Settings for the proxy in protected networks, leave boxes blank if none."),2, 0, 1, 2, Qt::AlignLeft);
223 layout_prx->addWidget(new QLabel(" "), 3, 0);
224 layout_prx->addWidget(new QLabel(" "), 4, 0);
225
226 tab_prx->setLayout(layout_prx);
227
228 // General Tab
229 // -----------
230 QWidget* tab_gen = new QWidget();
231 tabs->addTab(tab_gen, "General");
232
233 QGridLayout* layout_gen = new QGridLayout;
234 layout_gen->setColumnMinimumWidth(0,9*ww);
235
236 layout_gen->addWidget(new QLabel("Logfile (full path)"), 0, 0);
237 layout_gen->addWidget(_logFileLineEdit, 0, 1);
238 layout_gen->addWidget(new QLabel("Append files"), 1, 0);
239 layout_gen->addWidget(_fileAppendCheckBox, 1, 1);
240 layout_gen->addWidget(new QLabel("Reference System"), 2, 0);
241 layout_gen->addWidget(_refSysComboBox, 2, 1);
242 layout_gen->addWidget(new QLabel("General settings for logfile, file handling and target reference system."),3, 0, 1, 2, Qt::AlignLeft);
243 layout_gen->addWidget(new QLabel(" "), 4, 0);
244
245 tab_gen->setLayout(layout_gen);
246
247 // Input Tab
248 // ---------
249 QWidget* tab_inp = new QWidget();
250 tabs->addTab(tab_inp, "Input");
251
252 QGridLayout* layout_inp = new QGridLayout;
253 layout_inp->setColumnMinimumWidth(0, 9*ww);
254
255 layout_inp->addWidget(new QLabel("Ephemeris"), 0, 0, Qt::AlignLeft);
256 layout_inp->addWidget(new QLabel("Host"), 0, 1, Qt::AlignRight);
257 layout_inp->addWidget(_ephHostLineEdit, 0, 2);
258 layout_inp->addWidget(new QLabel("Port"), 0, 3, Qt::AlignLeft);
259 layout_inp->addWidget(_ephPortLineEdit, 0, 4);
260 layout_inp->addWidget(new QLabel("Clocks & Orbits"), 1, 0, Qt::AlignLeft);
261 layout_inp->addWidget(new QLabel("Host"), 1, 1, Qt::AlignRight);
262 layout_inp->addWidget(_clkHostLineEdit, 1, 2);
263 layout_inp->addWidget(new QLabel("Port"), 1, 3, Qt::AlignLeft);
264 layout_inp->addWidget(_clkPortLineEdit, 1, 4);
265 layout_inp->addWidget(new QLabel("Save Clocks & Orbits"), 2, 0, Qt::AlignLeft);
266 layout_inp->addWidget(new QLabel("(full path)"), 2, 1, Qt::AlignRight);
267 layout_inp->addWidget(_clkFileLineEdit, 2, 2);
268 layout_inp->addWidget(new QLabel("Read broadcast ephemeris and IGS clocks and orbits."), 3, 0, 1, 6, Qt::AlignLeft);
269 layout_inp->addWidget(new QLabel(""), 4, 0);
270
271 tab_inp->setLayout(layout_inp);
272
273 // NTRIP Caster Tab
274 // ----------------
275 QWidget* tab_cas = new QWidget();
276 tabs->addTab(tab_cas, "NTRIP Caster");
277
278 QGridLayout* layout_cas = new QGridLayout;
279 layout_cas->setColumnMinimumWidth(0, 9*ww);
280
281 layout_cas->addWidget(new QLabel("Host"), 0, 0, Qt::AlignLeft);
282 layout_cas->addWidget(_outHostLineEdit, 0, 1);
283 layout_cas->addWidget(new QLabel("Port"), 0, 3, Qt::AlignLeft);
284 layout_cas->addWidget(_outPortLineEdit, 0, 4);
285 layout_cas->addWidget(new QLabel("Mountpoint"), 1, 0, Qt::AlignLeft);
286 layout_cas->addWidget(_mountpointLineEdit, 1, 1);
287 layout_cas->addWidget(new QLabel("Password"), 1, 3, Qt::AlignLeft);
288 layout_cas->addWidget(_passwordLineEdit, 1, 4);
289 layout_cas->addWidget(new QLabel("Save stream (full path)"), 2, 0, Qt::AlignLeft);
290 layout_cas->addWidget(_outFileLineEdit, 2, 1);
291 layout_cas->addWidget(new QLabel("Stream upload of clock and orbit corrections to NTRIP broadcaster."),4, 0, 1, 2, Qt::AlignLeft);
292
293 tab_cas->setLayout(layout_cas);
294
295 // RINEX Tab
296 // ---------
297 QWidget* tab_rin = new QWidget();
298 tabs->addTab(tab_rin, "RINEX Clocks ");
299
300 QGridLayout* layout_rin = new QGridLayout;
301 layout_rin->setColumnMinimumWidth(0, 9*ww);
302
303 layout_rin->addWidget(new QLabel("Directory"), 0, 0);
304 layout_rin->addWidget(_rnxPathLineEdit, 0, 1);
305 layout_rin->addWidget(new QLabel("Interval"), 1, 0);
306 layout_rin->addWidget(_rnxIntrComboBox, 1, 1);
307 layout_rin->addWidget(new QLabel("Sampling"), 2, 0);
308 layout_rin->addWidget(_rnxSamplSpinBox, 2, 1);
309 layout_rin->addWidget(new QLabel("Save clock corrections in Clock RINEX file format."), 3, 0, 1, 2, Qt::AlignLeft);
310 layout_rin->addWidget(new QLabel(""), 4, 0);
311
312 tab_rin->setLayout(layout_rin);
313
314 // SP3 Tab
315 // -------
316 QWidget* tab_sp3 = new QWidget();
317 tabs->addTab(tab_sp3, "SP3 Orbits");
318
319 QGridLayout* layout_sp3 = new QGridLayout;
320 layout_sp3->setColumnMinimumWidth(0, 9*ww);
321
322 layout_sp3->addWidget(new QLabel("Directory"), 0, 0);
323 layout_sp3->addWidget(_sp3PathLineEdit, 0, 1);
324 layout_sp3->addWidget(new QLabel("Interval"), 1, 0);
325 layout_sp3->addWidget(_sp3IntrComboBox, 1, 1);
326 layout_sp3->addWidget(new QLabel("Sampling"), 2, 0);
327 layout_sp3->addWidget(_sp3SamplSpinBox, 2, 1);
328 layout_sp3->addWidget(new QLabel("Save orbit corrections in SP3 file format."), 3, 0, 1, 2, Qt::AlignLeft);
329 layout_sp3->addWidget(new QLabel(""), 4, 0);
330
331 tab_sp3->setLayout(layout_sp3);
332
333 // Log
334 // ---
335 _log = new QTextBrowser();
336 _log->setReadOnly(true);
337 _log->setWhatsThis(tr("Records of BNS's activities are shown in the Log section."));
338
339 // Main Layout
340 // -----------
341 QVBoxLayout* mainLayout = new QVBoxLayout;
342 mainLayout->addWidget(tabs);
343 mainLayout->addWidget(_log);
344
345 _canvas->setLayout(mainLayout);
346}
347
348// Destructor
349////////////////////////////////////////////////////////////////////////////
350bnsWindow::~bnsWindow() {
351}
352
353// Close Application gracefully
354////////////////////////////////////////////////////////////////////////////
355void bnsWindow::closeEvent(QCloseEvent* event) {
356
357int iRet = QMessageBox::question(this, "Close", "Save Options?",
358 QMessageBox::Yes, QMessageBox::No,
359 QMessageBox::Cancel);
360
361 if (iRet == QMessageBox::Cancel) {
362 event->ignore();
363 return;
364 }
365 else if (iRet == QMessageBox::Yes) {
366 slotSaveOptions();
367 }
368
369 QMainWindow::closeEvent(event);
370}
371
372// About Message
373////////////////////////////////////////////////////////////////////////////
374void bnsWindow::slotAbout() {
375 new bnsAboutDlg(0);
376}
377
378// Help Window
379////////////////////////////////////////////////////////////////////////////
380void bnsWindow::slotHelp() {
381 QUrl url;
382 url.setPath(":bnshelp.html");
383 new bnsHlpDlg(0, url);
384}
385
386// Select Fonts
387////////////////////////////////////////////////////////////////////////////
388void bnsWindow::slotFontSel() {
389 bool ok;
390 QFont newFont = QFontDialog::getFont(&ok, this->font(), this);
391 if (ok) {
392 QSettings settings;
393 settings.setValue("font", newFont.toString());
394 QApplication::setFont(newFont);
395 int ww = QFontMetrics(newFont).width('w');
396 setMinimumSize(77*ww, 65*ww);
397 }
398}
399
400// Whats This Help
401////////////////////////////////////////////////////////////////////////////
402void bnsWindow::slotWhatsThis() {
403QWhatsThis::enterWhatsThisMode();
404}
405
406// Create Menus
407////////////////////////////////////////////////////////////////////////////
408void bnsWindow::CreateMenu() {
409 _menuFile = menuBar()->addMenu(tr("&File"));
410 _menuFile->addAction(_actFontSel);
411 _menuFile->addSeparator();
412 _menuFile->addAction(_actSaveOpt);
413 _menuFile->addSeparator();
414 _menuFile->addAction(_actQuit);
415
416 _menuHlp = menuBar()->addMenu(tr("&Help"));
417 _menuHlp->addAction(_actHelp);
418 _menuHlp->addAction(_actAbout);
419}
420
421// Tool (Command) Bar
422////////////////////////////////////////////////////////////////////////////
423void bnsWindow::AddToolbar() {
424 QToolBar* toolBar = new QToolBar;
425 addToolBar(Qt::BottomToolBarArea, toolBar);
426 toolBar->setMovable(false);
427 toolBar->addAction(_actStart);
428 toolBar->addAction(_actStop);
429 toolBar->addWidget(new QLabel(" "));
430 toolBar->addAction(_actWhatsThis);
431}
432
433// Save Options
434////////////////////////////////////////////////////////////////////////////
435void bnsWindow::slotSaveOptions() {
436 QSettings settings;
437 settings.setValue("proxyHost", _proxyHostLineEdit->text());
438 settings.setValue("proxyPort", _proxyPortLineEdit->text());
439 settings.setValue("logFile", _logFileLineEdit->text());
440 settings.setValue("fileAppend", _fileAppendCheckBox->checkState());
441 settings.setValue("refSys", _refSysComboBox->currentText());
442 settings.setValue("ephHost", _ephHostLineEdit->text());
443 settings.setValue("ephPort", _ephPortLineEdit->text());
444 settings.setValue("clkHost", _clkHostLineEdit->text());
445 settings.setValue("clkPort", _clkPortLineEdit->text());
446 settings.setValue("clkFile", _clkFileLineEdit->text());
447 settings.setValue("outHost", _outHostLineEdit->text());
448 settings.setValue("outPort", _outPortLineEdit->text());
449 settings.setValue("mountpoint", _mountpointLineEdit->text());
450 settings.setValue("outFile", _outFileLineEdit->text());
451 settings.setValue("password", _passwordLineEdit->text());
452 settings.setValue("rnxPath", _rnxPathLineEdit->text());
453 settings.setValue("rnxIntr", _rnxIntrComboBox->currentText());
454 settings.setValue("rnxSampl", _rnxSamplSpinBox->value());
455 settings.setValue("sp3Path", _sp3PathLineEdit->text());
456 settings.setValue("sp3Intr", _sp3IntrComboBox->currentText());
457 settings.setValue("sp3Sampl", _sp3SamplSpinBox->value());
458}
459
460// Display Program Messages
461////////////////////////////////////////////////////////////////////////////
462void bnsWindow::slotMessage(const QByteArray msg) {
463
464 const int maxBufferSize = 10000;
465
466 QString txt = _log->toPlainText() + "\n" +
467 QDateTime::currentDateTime().toUTC().toString("yy-MM-dd hh:mm:ss ") + msg;
468 _log->clear();
469 _log->append(txt.right(maxBufferSize));
470}
471
472// Delete bns
473////////////////////////////////////////////////////////////////////////////
474void bnsWindow::deleteBns() {
475 _actStart->setEnabled(true);
476 _actStop->setEnabled(false);
477 _bns->terminate();
478 _bns->wait(100);
479 delete _bns;
480 _bns = 0;
481}
482
483// Error in bns
484////////////////////////////////////////////////////////////////////////////
485void bnsWindow::slotError(const QByteArray msg) {
486 slotMessage(msg);
487 deleteBns();
488}
489
490// Stop
491////////////////////////////////////////////////////////////////////////////
492void bnsWindow::slotStop() {
493 int iRet = QMessageBox::question(this, "Stop", "Do you want to stop?",
494 QMessageBox::Yes, QMessageBox::No,
495 QMessageBox::NoButton);
496 if (iRet == QMessageBox::Yes) {
497 deleteBns();
498 }
499}
500
501// Start
502////////////////////////////////////////////////////////////////////////////
503void bnsWindow::slotStart() {
504 slotSaveOptions();
505
506 _actStart->setEnabled(false);
507 _actStop->setEnabled(true);
508
509 _bns = new t_bns(0);
510
511 connect(_bns, SIGNAL(newMessage(QByteArray)),
512 this, SLOT(slotMessage(const QByteArray)));
513
514 connect(_bns, SIGNAL(error(QByteArray)),
515 this, SLOT(slotError(const QByteArray)));
516
517 _bns->start();
518}
Note: See TracBrowser for help on using the repository browser.