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

Last change on this file since 372 was 372, checked in by weber, 18 years ago

* empty log message *

File size: 21.3 KB
Line 
1// Part of BNC, a utility for retrieving decoding and
2// converting GNSS data streams from NTRIP broadcasters,
3// written by Leos Mervart.
4//
5// Copyright (C) 2006
6// German Federal Agency for Cartography and Geodesy (BKG)
7// http://www.bkg.bund.de
8// Czech Technical University Prague, Department of Advanced Geodesy
9// http://www.fsv.cvut.cz
10//
11// Email: euref-ip@bkg.bund.de
12//
13// This program is free software; you can redistribute it and/or
14// modify it under the terms of the GNU General Public License
15// as published by the Free Software Foundation, version 2.
16//
17// This program is distributed in the hope that it will be useful,
18// but WITHOUT ANY WARRANTY; without even the implied warranty of
19// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20// GNU General Public License for more details.
21//
22// You should have received a copy of the GNU General Public License
23// along with this program; if not, write to the Free Software
24// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25
26/* -------------------------------------------------------------------------
27 * BKG NTRIP Client
28 * -------------------------------------------------------------------------
29 *
30 * Class: bncWindow
31 *
32 * Purpose: This class implements the main application window.
33 *
34 * Author: L. Mervart
35 *
36 * Created: 24-Dec-2005
37 *
38 * Changes:
39 *
40 * -----------------------------------------------------------------------*/
41
42#include <unistd.h>
43#include "bncwindow.h"
44#include "bncapp.h"
45#include "bncgetthread.h"
46#include "bnctabledlg.h"
47#include "bnchlpdlg.h"
48#include "bnchtml.h"
49#include "bnctableitem.h"
50
51using namespace std;
52
53// Constructor
54////////////////////////////////////////////////////////////////////////////
55bncWindow::bncWindow() {
56
57 int ww = QFontMetrics(this->font()).width('w');
58
59 static const QStringList labels = QString("account,mountpoint,decoder,lat,long,type,bytes").split(",");
60
61 setMinimumSize(77*ww, 65*ww);
62 setWindowTitle(tr("BKG Ntrip Client (BNC), Version 1.1b"));
63
64 // Create Actions
65 // --------------
66 _actHelp = new QAction(tr("&Help Contents"),this);
67 connect(_actHelp, SIGNAL(triggered()), SLOT(slotHelp()));
68
69 _actAbout = new QAction(tr("&About BNC"),this);
70 connect(_actAbout, SIGNAL(triggered()), SLOT(slotAbout()));
71
72 _actFontSel = new QAction(tr("Select &Font"),this);
73 connect(_actFontSel, SIGNAL(triggered()), SLOT(slotFontSel()));
74
75 _actSaveOpt = new QAction(tr("&Save Options"),this);
76 connect(_actSaveOpt, SIGNAL(triggered()), SLOT(slotSaveOptions()));
77
78 _actQuit = new QAction(tr("&Quit"),this);
79 connect(_actQuit, SIGNAL(triggered()), SLOT(close()));
80
81 _actAddMountPoints = new QAction(tr("Add &Mountpoints"),this);
82 connect(_actAddMountPoints, SIGNAL(triggered()), SLOT(slotAddMountPoints()));
83
84 _actDeleteMountPoints = new QAction(tr("&Delete Mountpoints"),this);
85 connect(_actDeleteMountPoints, SIGNAL(triggered()), SLOT(slotDeleteMountPoints()));
86 _actDeleteMountPoints->setEnabled(false);
87
88 _actGetData = new QAction(tr("Sta&rt"),this);
89 connect(_actGetData, SIGNAL(triggered()), SLOT(slotGetData()));
90
91 _actStop = new QAction(tr("Sto&p"),this);
92 connect(_actStop, SIGNAL(triggered()), SLOT(slotStop()));
93 _actStop->setEnabled(false);
94
95 // Create Menus
96 // ------------
97 _menuFile = menuBar()->addMenu(tr("&File"));
98 _menuFile->addAction(_actFontSel);
99 _menuFile->addSeparator();
100 _menuFile->addAction(_actSaveOpt);
101 _menuFile->addSeparator();
102 _menuFile->addAction(_actQuit);
103
104 _menuHlp = menuBar()->addMenu(tr("&Help"));
105 _menuHlp->addAction(_actHelp);
106 _menuHlp->addAction(_actAbout);
107
108 // Tool (Command) Bar
109 // ------------------
110 QToolBar* toolBar = new QToolBar;
111 addToolBar(Qt::BottomToolBarArea, toolBar);
112 toolBar->setMovable(false);
113 toolBar->addAction(_actAddMountPoints);
114 toolBar->addAction(_actDeleteMountPoints);
115 toolBar->addAction(_actGetData);
116 toolBar->addAction(_actStop);
117
118 // Canvas with Editable Fields
119 // ---------------------------
120 _canvas = new QWidget;
121 setCentralWidget(_canvas);
122
123 QGridLayout* layout = new QGridLayout;
124 _canvas->setLayout(layout);
125
126 QSettings settings;
127 _proxyHostLineEdit = new QLineEdit(settings.value("proxyHost").toString());
128 _proxyHostLineEdit->setMaximumWidth(12*ww);
129 _proxyPortLineEdit = new QLineEdit(settings.value("proxyPort").toString());
130 _proxyPortLineEdit->setMaximumWidth(9*ww);
131 _waitTimeSpinBox = new QSpinBox();
132 _waitTimeSpinBox->setMinimum(1);
133 _waitTimeSpinBox->setMaximum(30);
134 _waitTimeSpinBox->setSingleStep(1);
135 _waitTimeSpinBox->setSuffix(" sec");
136 _waitTimeSpinBox->setMaximumWidth(9*ww);
137 _waitTimeSpinBox->setValue(settings.value("waitTime").toInt());
138 _outFileLineEdit = new QLineEdit(settings.value("outFile").toString());
139 _outPortLineEdit = new QLineEdit(settings.value("outPort").toString());
140 _outPortLineEdit->setMaximumWidth(9*ww);
141 _rnxPathLineEdit = new QLineEdit(settings.value("rnxPath").toString());
142 _rnxScrpLineEdit = new QLineEdit(settings.value("rnxScript").toString());
143 _rnxSkelLineEdit = new QLineEdit(settings.value("rnxSkel").toString());
144 _rnxSkelLineEdit->setMaximumWidth(5*ww);
145 _rnxAppendCheckBox = new QCheckBox();
146 _rnxAppendCheckBox->setCheckState(Qt::CheckState(
147 settings.value("rnxAppend").toInt()));
148 _rnxIntrComboBox = new QComboBox();
149 _rnxIntrComboBox->setMaximumWidth(9*ww);
150 _rnxIntrComboBox->setEditable(false);
151 _rnxIntrComboBox->addItems(QString("5 min,10 min,15 min,30 min,1 hour,1 day").split(","));
152 int ii = _rnxIntrComboBox->findText(settings.value("rnxIntr").toString());
153 if (ii != -1) {
154 _rnxIntrComboBox->setCurrentIndex(ii);
155 }
156 _rnxSamplSpinBox = new QSpinBox();
157 _rnxSamplSpinBox->setMinimum(0);
158 _rnxSamplSpinBox->setMaximum(60);
159 _rnxSamplSpinBox->setSingleStep(5);
160 _rnxSamplSpinBox->setMaximumWidth(9*ww);
161 _rnxSamplSpinBox->setValue(settings.value("rnxSampl").toInt());
162 _rnxSamplSpinBox->setSuffix(" sec");
163 _logFileLineEdit = new QLineEdit(settings.value("logFile").toString());
164 _mountPointsTable = new QTableWidget(0,7);
165 _mountPointsTable->horizontalHeader()->resizeSection(1,25*ww);
166 _mountPointsTable->horizontalHeader()->resizeSection(2,9*ww);
167 _mountPointsTable->horizontalHeader()->resizeSection(3,7*ww);
168 _mountPointsTable->horizontalHeader()->resizeSection(4,7*ww);
169 _mountPointsTable->horizontalHeader()->resizeSection(5,5*ww);
170 _mountPointsTable->horizontalHeader()->setResizeMode(QHeaderView::Interactive);
171 _mountPointsTable->horizontalHeader()->setStretchLastSection(true);
172 _mountPointsTable->setHorizontalHeaderLabels(labels);
173// _mountPointsTable->horizontalHeader()->hide();
174// _mountPointsTable->verticalHeader()->hide();
175 _mountPointsTable->setGridStyle(Qt::NoPen);
176 _mountPointsTable->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
177 _mountPointsTable->setSelectionMode(QAbstractItemView::ExtendedSelection);
178 _mountPointsTable->setSelectionBehavior(QAbstractItemView::SelectRows);
179 QListIterator<QString> it(settings.value("mountPoints").toStringList());
180 if (!it.hasNext()) {
181 _actGetData->setEnabled(false);
182 }
183 int iRow = 0;
184 while (it.hasNext()) {
185 QStringList hlp = it.next().split(" ");
186 if (hlp.size() < 5) continue; // Check number of parameters saved per mountpoint
187 _mountPointsTable->insertRow(iRow);
188
189 QUrl url(hlp[0]);
190
191 QString fullPath = url.host() + QString(":%1").arg(url.port()) + url.path();
192 QString format(hlp[1]); QString latitude(hlp[2]); QString longitude(hlp[3]);
193 QString nmea(hlp[4]);
194
195 QTableWidgetItem* it;
196 it = new QTableWidgetItem(url.userInfo());
197 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
198 _mountPointsTable->setItem(iRow, 0, it);
199
200 it = new QTableWidgetItem(fullPath);
201 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
202 _mountPointsTable->setItem(iRow, 1, it);
203
204 it = new QTableWidgetItem(format);
205 _mountPointsTable->setItem(iRow, 2, it);
206
207 if (nmea == "VRS") {
208 it = new QTableWidgetItem(latitude);
209 _mountPointsTable->setItem(iRow, 3, it);
210 it = new QTableWidgetItem(longitude);
211 _mountPointsTable->setItem(iRow, 4, it);
212 } else {
213 it = new QTableWidgetItem(latitude);
214 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
215 _mountPointsTable->setItem(iRow, 3, it);
216 it = new QTableWidgetItem(longitude);
217 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
218 _mountPointsTable->setItem(iRow, 4, it);
219 }
220
221 it = new QTableWidgetItem(nmea);
222 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
223 _mountPointsTable->setItem(iRow, 5, it);
224
225 bncTableItem* bncIt = new bncTableItem();
226 bncIt->setFlags(bncIt->flags() & ~Qt::ItemIsEditable);
227 _mountPointsTable->setItem(iRow, 6, bncIt);
228
229 iRow++;
230 }
231 _mountPointsTable->hideColumn(0);
232 _mountPointsTable->sortItems(1);
233
234 connect(_mountPointsTable, SIGNAL(itemSelectionChanged()),
235 SLOT(slotSelectionChanged()));
236
237 _log = new QTextEdit();
238 _log->setReadOnly(true);
239
240 layout->addWidget(new QLabel("Proxy host"), 0, 0, 1, 2);
241 layout->addWidget(_proxyHostLineEdit, 0, 2);
242 layout->addWidget(new QLabel("Proxy port"), 0, 3);
243 layout->addWidget(_proxyPortLineEdit, 0, 4);
244
245 layout->addWidget(new QLabel("Wait for full epoch"), 1, 0, 1, 2);
246 layout->addWidget(_waitTimeSpinBox, 1, 2);
247
248 layout->addWidget(new QLabel("ASCII output file (full path)"), 2, 0, 1, 2);
249 layout->addWidget(_outFileLineEdit, 2, 2, 1, 3);
250
251 layout->addWidget(new QLabel("Port for binary output"), 3, 0, 1, 2);
252 layout->addWidget(_outPortLineEdit, 3, 2);
253
254 layout->addWidget(new QLabel("RINEX directory"), 4, 0, 1, 2);
255 layout->addWidget(_rnxPathLineEdit, 4, 2, 1, 3);
256
257 layout->addWidget(new QLabel("RINEX script (full path)"), 5, 0, 1, 2);
258 layout->addWidget(_rnxScrpLineEdit, 5, 2, 1, 3);
259
260 layout->addWidget(new QLabel("RINEX file interval"), 6, 0, 1, 2);
261 layout->addWidget(_rnxIntrComboBox, 6, 2);
262 layout->addWidget(new QLabel("Sampling"), 6, 3);
263 layout->addWidget(_rnxSamplSpinBox, 6, 4);
264
265 layout->addWidget(new QLabel("RINEX skeleton extension"), 7, 0, 1, 2);
266 layout->addWidget(_rnxSkelLineEdit, 7, 2);
267
268 layout->addWidget(new QLabel("Append files"), 7, 3);
269 layout->addWidget(_rnxAppendCheckBox, 7, 4);
270
271 layout->addWidget(new QLabel("Mountpoints"), 8, 0, 1, 2);
272
273 layout->addWidget(_mountPointsTable, 9, 0, 1, 5);
274
275 layout->addWidget(new QLabel("Log (full path)"), 10, 0, 1, 2);
276 layout->addWidget(_logFileLineEdit, 10, 2, 1, 3);
277 layout->addWidget(_log, 11, 0, 1, 5);
278}
279
280// Destructor
281////////////////////////////////////////////////////////////////////////////
282bncWindow::~bncWindow() {
283}
284
285// Retrieve Table
286////////////////////////////////////////////////////////////////////////////
287void bncWindow::slotAddMountPoints() {
288
289 QSettings settings;
290 QString proxyHost = settings.value("proxyHost").toString();
291 int proxyPort = settings.value("proxyPort").toInt();
292 if (proxyHost != _proxyHostLineEdit->text() ||
293 proxyPort != _proxyPortLineEdit->text().toInt()) {
294 int iRet = QMessageBox::question(this, "Question", "Proxy options "
295 "changed. Use the new ones?",
296 QMessageBox::Yes, QMessageBox::No,
297 QMessageBox::NoButton);
298 if (iRet == QMessageBox::Yes) {
299 settings.setValue("proxyHost", _proxyHostLineEdit->text());
300 settings.setValue("proxyPort", _proxyPortLineEdit->text());
301 }
302 }
303
304 bncTableDlg* dlg = new bncTableDlg(this);
305 dlg->move(this->pos().x()+50, this->pos().y()+50);
306 connect(dlg, SIGNAL(newMountPoints(QStringList*)),
307 this, SLOT(slotNewMountPoints(QStringList*)));
308 dlg->exec();
309 delete dlg;
310
311}
312
313// Delete Selected Mount Points
314////////////////////////////////////////////////////////////////////////////
315void bncWindow::slotDeleteMountPoints() {
316
317 int nRows = _mountPointsTable->rowCount();
318 bool flg[nRows];
319 for (int iRow = 0; iRow < nRows; iRow++) {
320 if (_mountPointsTable->isItemSelected(_mountPointsTable->item(iRow,1))) {
321 flg[iRow] = true;
322 }
323 else {
324 flg[iRow] = false;
325 }
326 }
327 for (int iRow = nRows-1; iRow >= 0; iRow--) {
328 if (flg[iRow]) {
329 _mountPointsTable->removeRow(iRow);
330 }
331 }
332 _actDeleteMountPoints->setEnabled(false);
333
334 if (_mountPointsTable->rowCount() == 0) {
335 _actGetData->setEnabled(false);
336 }
337}
338
339// New Mount Points Selected
340////////////////////////////////////////////////////////////////////////////
341void bncWindow::slotNewMountPoints(QStringList* mountPoints) {
342 int iRow = 0;
343 QListIterator<QString> it(*mountPoints);
344 while (it.hasNext()) {
345 QStringList hlp = it.next().split(" ");
346 QUrl url(hlp[0]);
347 QString fullPath = url.host() + QString(":%1").arg(url.port()) + url.path();
348 QString format(hlp[1]); QString latitude(hlp[2]); QString longitude(hlp[3]);
349 QString nmea(hlp[4]);
350
351 _mountPointsTable->insertRow(iRow);
352
353 QTableWidgetItem* it;
354 it = new QTableWidgetItem(url.userInfo());
355 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
356 _mountPointsTable->setItem(iRow, 0, it);
357
358 it = new QTableWidgetItem(fullPath);
359 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
360 _mountPointsTable->setItem(iRow, 1, it);
361
362 it = new QTableWidgetItem(format);
363 _mountPointsTable->setItem(iRow, 2, it);
364
365 if (nmea == "VRS") {
366 it = new QTableWidgetItem(latitude);
367 _mountPointsTable->setItem(iRow, 3, it);
368 it = new QTableWidgetItem(longitude);
369 _mountPointsTable->setItem(iRow, 4, it);
370 } else {
371 it = new QTableWidgetItem(latitude);
372 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
373 _mountPointsTable->setItem(iRow, 3, it);
374 it = new QTableWidgetItem(longitude);
375 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
376 _mountPointsTable->setItem(iRow, 4, it);
377 }
378
379 it = new QTableWidgetItem(nmea);
380 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
381 _mountPointsTable->setItem(iRow, 5, it);
382
383 bncTableItem* bncIt = new bncTableItem();
384 _mountPointsTable->setItem(iRow, 6, bncIt);
385
386 iRow++;
387 }
388 _mountPointsTable->hideColumn(0);
389 _mountPointsTable->sortItems(1);
390 if (mountPoints->count() > 0) {
391 _actGetData->setEnabled(true);
392 }
393 delete mountPoints;
394}
395
396// Save Options
397////////////////////////////////////////////////////////////////////////////
398void bncWindow::slotSaveOptions() {
399 QSettings settings;
400 settings.setValue("proxyHost", _proxyHostLineEdit->text());
401 settings.setValue("proxyPort", _proxyPortLineEdit->text());
402 settings.setValue("waitTime", _waitTimeSpinBox->value());
403 settings.setValue("outFile", _outFileLineEdit->text());
404 settings.setValue("outPort", _outPortLineEdit->text());
405 settings.setValue("rnxPath", _rnxPathLineEdit->text());
406 settings.setValue("rnxScript", _rnxScrpLineEdit->text());
407 settings.setValue("rnxIntr", _rnxIntrComboBox->currentText());
408 settings.setValue("rnxSampl", _rnxSamplSpinBox->value());
409 settings.setValue("rnxSkel", _rnxSkelLineEdit->text());
410 settings.setValue("rnxAppend", _rnxAppendCheckBox->checkState());
411 settings.setValue("logFile", _logFileLineEdit->text());
412
413QStringList mountPoints;
414
415 for (int iRow = 0; iRow < _mountPointsTable->rowCount(); iRow++) {
416 QUrl url( "//" + _mountPointsTable->item(iRow, 0)->text() +
417 "@" + _mountPointsTable->item(iRow, 1)->text() );
418
419 mountPoints.append(url.toString() + " " +
420 _mountPointsTable->item(iRow, 2)->text()
421 + " " + _mountPointsTable->item(iRow, 3)->text()
422 + " " + _mountPointsTable->item(iRow, 4)->text()
423 + " " + _mountPointsTable->item(iRow, 5)->text());
424 }
425 settings.setValue("mountPoints", mountPoints);
426}
427
428// All get slots terminated
429////////////////////////////////////////////////////////////////////////////
430void bncWindow::slotGetThreadErrors() {
431 slotMessage("All Get Threads Terminated");
432 ((bncApp*)qApp)->slotMessage("All Get Threads Terminated");
433 _actAddMountPoints->setEnabled(true);
434 _actGetData->setEnabled(true);
435}
436
437// Retrieve Data
438////////////////////////////////////////////////////////////////////////////
439void bncWindow::slotGetData() {
440 slotSaveOptions();
441
442 _actAddMountPoints->setEnabled(false);
443 _actDeleteMountPoints->setEnabled(false);
444 _actGetData->setEnabled(false);
445 _actStop->setEnabled(true);
446
447 _global_caster = new bncCaster(_outFileLineEdit->text(),
448 _outPortLineEdit->text().toInt());
449
450 connect(_global_caster, SIGNAL(getThreadErrors()),
451 this, SLOT(slotGetThreadErrors()));
452
453 connect(_global_caster, SIGNAL(newMessage(const QByteArray&)),
454 this, SLOT(slotMessage(const QByteArray&)));
455 connect(_global_caster, SIGNAL(newMessage(const QByteArray&)),
456 (bncApp*)qApp, SLOT(slotMessage(const QByteArray&)));
457
458 slotMessage("============ Start BNC ============");
459 ((bncApp*)qApp)->slotMessage("============ Start BNC ============");
460
461 for (int iRow = 0; iRow < _mountPointsTable->rowCount(); iRow++) {
462 QUrl url( "//" + _mountPointsTable->item(iRow, 0)->text() +
463 "@" + _mountPointsTable->item(iRow, 1)->text() );
464
465 QByteArray format = _mountPointsTable->item(iRow, 2)->text().toAscii();
466
467 QByteArray latitude = _mountPointsTable->item(iRow, 3)->text().toAscii();
468 QByteArray longitude = _mountPointsTable->item(iRow, 4)->text().toAscii();
469 QByteArray nmea = _mountPointsTable->item(iRow, 5)->text().toAscii();
470
471 bncGetThread* getThread = new bncGetThread(url, format, latitude, longitude, nmea, iRow);
472
473 connect(getThread, SIGNAL(newMessage(const QByteArray&)),
474 this, SLOT(slotMessage(const QByteArray&)));
475 connect(getThread, SIGNAL(newMessage(const QByteArray&)),
476 (bncApp*)qApp, SLOT(slotMessage(const QByteArray&)));
477
478 connect(getThread, SIGNAL(newObs(const QByteArray&, Observation*)),
479 (bncTableItem*) _mountPointsTable->item(iRow, 6),
480 SLOT(slotNewObs(const QByteArray&, Observation*)));
481
482 _global_caster->addGetThread(getThread);
483
484 getThread->start();
485 }
486}
487
488// Retrieve Data
489////////////////////////////////////////////////////////////////////////////
490void bncWindow::slotStop() {
491 int iRet = QMessageBox::question(this, "Stop", "Stop retrieving data?",
492 QMessageBox::Yes, QMessageBox::No,
493 QMessageBox::NoButton);
494 if (iRet == QMessageBox::Yes) {
495 delete _global_caster; _global_caster = 0;
496 _actGetData->setEnabled(true);
497 _actStop->setEnabled(false);
498 _actAddMountPoints->setEnabled(true);
499 }
500}
501
502// Close Application gracefully
503////////////////////////////////////////////////////////////////////////////
504void bncWindow::closeEvent(QCloseEvent* event) {
505
506 int iRet = QMessageBox::question(this, "Close", "Save Options?",
507 QMessageBox::Yes, QMessageBox::No,
508 QMessageBox::Cancel);
509
510 if (iRet == QMessageBox::Cancel) {
511 event->ignore();
512 return;
513 }
514 else if (iRet == QMessageBox::Yes) {
515 slotSaveOptions();
516 }
517
518 return QMainWindow::closeEvent(event);
519}
520
521// User changed the selection of mountPoints
522////////////////////////////////////////////////////////////////////////////
523void bncWindow::slotSelectionChanged() {
524 if (_mountPointsTable->selectedItems().isEmpty()) {
525 _actDeleteMountPoints->setEnabled(false);
526 }
527 else {
528 _actDeleteMountPoints->setEnabled(true);
529 }
530}
531
532// Display Program Messages
533////////////////////////////////////////////////////////////////////////////
534void bncWindow::slotMessage(const QByteArray& msg) {
535
536 const int maxBufferSize = 10000;
537
538 QString txt = _log->toPlainText() + "\n" +
539 QDate::currentDate().toString("yy-MM-dd ") +
540 QTime::currentTime().toString("hh:mm:ss ") + msg;
541 _log->clear();
542 _log->append(txt.right(maxBufferSize));
543}
544
545// About Message
546////////////////////////////////////////////////////////////////////////////
547void bncWindow::slotAbout() {
548
549 QTextBrowser* tb = new QTextBrowser;
550 QUrl url; url.setPath(":bncabout.html");
551 tb->setSource(url);
552 tb->setReadOnly(true);
553
554 QDialog dlg(this);
555
556 QGridLayout* dlgLayout = new QGridLayout();
557 QLabel* img = new QLabel();
558 img->setPixmap(QPixmap(":ntrip-logo.png"));
559 dlgLayout->addWidget(img, 0,0);
560 dlgLayout->addWidget(new QLabel("BKG NTRIP Client (BNC), Version 1.1b"), 0,1);
561 dlgLayout->addWidget(tb,1,0,1,2);
562
563 dlg.setLayout(dlgLayout);
564 int ww = QFontMetrics(font()).width('w');
565 dlg.resize(60*ww, 60*ww);
566 dlg.exec();
567}
568
569// Help Window
570////////////////////////////////////////////////////////////////////////////
571void bncWindow::slotHelp() {
572 QUrl url;
573 url.setPath(":bnchelp.html");
574 new bncHlpDlg(this, url);
575}
576
577// Select Fonts
578////////////////////////////////////////////////////////////////////////////
579void bncWindow::slotFontSel() {
580 bool ok;
581 QFont newFont = QFontDialog::getFont(&ok, this->font(), this);
582 if (ok) {
583 QSettings settings;
584 settings.setValue("font", newFont.toString());
585 QApplication::setFont(newFont);
586 int ww = QFontMetrics(newFont).width('w');
587 setMinimumSize(60*ww, 80*ww);
588 resize(60*ww, 80*ww);
589 }
590}
Note: See TracBrowser for help on using the repository browser.