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

Last change on this file since 981 was 981, checked in by mervart, 16 years ago

* empty log message *

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