source: ntrip/trunk/BNC/bnctabledlg.cpp@ 1504

Last change on this file since 1504 was 1504, checked in by weber, 15 years ago

* empty log message *

File size: 21.0 KB
RevLine 
[280]1// Part of BNC, a utility for retrieving decoding and
[464]2// converting GNSS data streams from NTRIP broadcasters.
[280]3//
[464]4// Copyright (C) 2007
[280]5// German Federal Agency for Cartography and Geodesy (BKG)
6// http://www.bkg.bund.de
[464]7// Czech Technical University Prague, Department of Geodesy
[280]8// http://www.fsv.cvut.cz
9//
10// Email: euref-ip@bkg.bund.de
11//
12// This program is free software; you can redistribute it and/or
13// modify it under the terms of the GNU General Public License
14// as published by the Free Software Foundation, version 2.
15//
16// This program is distributed in the hope that it will be useful,
17// but WITHOUT ANY WARRANTY; without even the implied warranty of
18// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19// GNU General Public License for more details.
20//
21// You should have received a copy of the GNU General Public License
22// along with this program; if not, write to the Free Software
23// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
[35]24
25/* -------------------------------------------------------------------------
[93]26 * BKG NTRIP Client
[35]27 * -------------------------------------------------------------------------
28 *
29 * Class: bncTableDlg
30 *
31 * Purpose: Displays the source table, allows mountpoints selection
32 *
33 * Author: L. Mervart
34 *
35 * Created: 24-Dec-2005
36 *
37 * Changes:
38 *
39 * -----------------------------------------------------------------------*/
40
[1493]41#include <iostream>
42
[35]43#include "bnctabledlg.h"
44#include "bncgetthread.h"
[1387]45#include "bncnetqueryv2.h"
[35]46
[1373]47using namespace std;
48
[35]49// Constructor
50////////////////////////////////////////////////////////////////////////////
[90]51bncTableDlg::bncTableDlg(QWidget* parent) : QDialog(parent) {
[35]52
53 setMinimumSize(600,400);
[1409]54 setWindowTitle(tr("Add Streams"));
[35]55
56 QVBoxLayout* mainLayout = new QVBoxLayout(this);
57
[1474]58 int ww = QFontMetrics(font()).width('w');
59
60 _casterPortLineEdit = new QLineEdit();
61 _casterPortLineEdit->setMaximumWidth(9*ww);
62
63 _casterUserLineEdit = new QLineEdit();
64 _casterUserLineEdit->setMaximumWidth(9*ww);
65
66 _casterPasswordLineEdit = new QLineEdit();
67 _casterPasswordLineEdit->setMaximumWidth(9*ww);
[1497]68 //// _casterPasswordLineEdit->setEchoMode(QLineEdit::Password);
[1474]69
70 _casterHostComboBox = new QComboBox();
[1482]71 _casterHostComboBox->setMaxCount(10);
[1474]72 _casterHostComboBox->setDuplicatesEnabled(false);
73 _casterHostComboBox->setEditable(true);
[1477]74 _casterHostComboBox->setMinimumWidth(20*ww);
[1474]75 _casterHostComboBox->setMaximumWidth(20*ww);
76 connect(_casterHostComboBox, SIGNAL(currentIndexChanged(const QString&)),
77 this, SLOT(slotCasterHostChanged(const QString&)));
[1476]78 QSettings settings;
[1481]79 settings.remove("casterHostList");
80 settings.remove("casterHost");
81 settings.remove("casterPort");
82 settings.remove("casterUser");
83 settings.remove("casterPassword");
[1476]84 QStringList casterUrlList = settings.value("casterUrlList").toStringList();
85 for (int ii = 0; ii < casterUrlList.count(); ii++) {
86 QUrl url(casterUrlList[ii]);
[1474]87 _casterHostComboBox->addItem(url.host());
[1274]88 }
[683]89
[1350]90 _ntripVersionComboBox = new QComboBox();
[1410]91 _ntripVersionComboBox->addItems(QString("1,2,R").split(","));
[1350]92 int kk = _ntripVersionComboBox->findText(settings.value("ntripVersion").toString());
93 if (kk != -1) {
94 _ntripVersionComboBox->setCurrentIndex(kk);
95 }
[1459]96 _ntripVersionComboBox->setMaximumWidth(5*ww);
[1350]97
[1459]98 _buttonCasterTable = new QPushButton(tr("Show"), this);
99 connect(_buttonCasterTable, SIGNAL(clicked()), this, SLOT(slotCasterTable()));
100 _buttonCasterTable->setMaximumWidth(5*ww);
101
[683]102 // WhatsThis
103 // ---------
[1459]104 _casterUserLineEdit->setWhatsThis(tr("<p>Access to some streams on NTRIP broadcasters may be restricted. You'll need to enter a valid 'User ID' and 'Password' for access to these protected streams.</p><p>Accounts are usually provided per NTRIP broadcaster through a registration process. Register through <u>http://igs.bkg.bund.de/index_ntrip_reg.htm</u> for access to protected streams on <u>www.euref-ip.net</u> and <u>www.igs-ip.net</u>.</p>"));
[1474]105 _casterHostComboBox->setWhatsThis(tr("<p>Enter the NTRIP broadcaster hostname or IP number.</p><p>Note that EUREF and IGS operate NTRIP broadcasters at <u>http://www.euref-ip.net/home</u> and <u>http://www.igs-ip.net/home</u>.</p>"));
[1459]106 _casterPortLineEdit->setWhatsThis(tr("Enter the NTRIP broadcaster port number."));
107 _casterPasswordLineEdit->setWhatsThis(tr("Access to some streams on NTRIP broadcasters may be restricted. You'll need to enter a valid 'Password' for access to these protected streams."));
[35]108
[88]109 QGridLayout* editLayout = new QGridLayout;
[1459]110 editLayout->addWidget(new QLabel(tr("Caster host")), 0, 0);
[1474]111 editLayout->addWidget(_casterHostComboBox, 0, 1);
[1459]112 editLayout->addWidget(new QLabel(tr(" Caster port")), 0, 2, Qt::AlignRight);
113 editLayout->addWidget(_casterPortLineEdit, 0, 3);
114 editLayout->addWidget(new QLabel(tr("Caster table")), 0, 4, Qt::AlignRight);
115 editLayout->addWidget(_buttonCasterTable, 0, 5);
116 editLayout->addWidget(new QLabel(tr("User")), 1, 0, Qt::AlignRight);
117 editLayout->addWidget(_casterUserLineEdit, 1, 1);
118 editLayout->addWidget(new QLabel(tr("Password")), 1, 2, Qt::AlignRight);
119 editLayout->addWidget(_casterPasswordLineEdit, 1, 3);
120 editLayout->addWidget(new QLabel(tr(" NTRIP Version")),1, 4, Qt::AlignRight);
121 editLayout->addWidget(_ntripVersionComboBox, 1, 5);
[88]122
[35]123 mainLayout->addLayout(editLayout);
124
[1471]125 _buttonCasterTable->setWhatsThis(tr("<p>Hit 'Show' for a table of known NTRIP broadcaster installations as maintained at <u>www.rtcm-ntrip.org/home.</u></p><p>A window opens which allows to select a broadcaster for stream retrieval.</p>"));
[1466]126 _ntripVersionComboBox->setWhatsThis(tr("<p>Select the NTRIP transport protocol version you want to use. Implemented options are:<br>&nbsp; 1:&nbsp; NTRIP version 1, TCP/IP<br>&nbsp; 2:&nbsp; NTRIP version 2, TCP/IP mode<br>&nbsp; R:&nbsp; NTRIP Version 2, RTSP/RTP mode<br>Select option '1' if you are not sure whether the NTRIP broadcaster supports NTRIP version 2.</p><p>Note that RTSP/RTP (option 'R') is sometimes not supported by mobile Internet Service Providers.</p>"));
[1409]127
[35]128 _table = new QTableWidget(this);
[1459]129 _table->setWhatsThis(tr("<p>Use the 'Get Table' button to download the sourcetable from the selected NTRIP broadcaster. Select the desired streams line by line, using +Shift and +Ctrl when necessary. Hit 'OK' to return to the main window.</p><p>Pay attention to data field 'format'. Keep in mind that BNC can only decode and convert streams that come in RTCM Version 2.x, RTCM Version 3.x, or RTIGS format. See data field 'format-details' for available message types and their repetition rates in brackets.</p><p>The content of data field 'nmea' tells you whether a stream comes from a virtual reference station (VRS).</p>"));
[195]130 connect(_table, SIGNAL(itemSelectionChanged()),
131 this, SLOT(slotSelectionChanged()));
[35]132 mainLayout->addWidget(_table);
133
[402]134 _buttonWhatsThis = new QPushButton(tr("Help=Shift+F1"), this);
[399]135 connect(_buttonWhatsThis, SIGNAL(clicked()), this, SLOT(slotWhatsThis()));
136
[195]137 _buttonGet = new QPushButton(tr("Get table"), this);
[399]138 _buttonGet->setDefault(true);
[35]139 connect(_buttonGet, SIGNAL(clicked()), this, SLOT(slotGetTable()));
[366]140
[35]141 _buttonCancel = new QPushButton(tr("Cancel"), this);
142 connect(_buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
143
144 _buttonOK = new QPushButton(tr("OK"), this);
145 connect(_buttonOK, SIGNAL(clicked()), this, SLOT(accept()));
146
147 QHBoxLayout* buttonLayout = new QHBoxLayout;
[399]148 buttonLayout->addWidget(_buttonWhatsThis);
[35]149 buttonLayout->addStretch(1);
150 buttonLayout->addWidget(_buttonGet);
151 buttonLayout->addWidget(_buttonCancel);
152 buttonLayout->addWidget(_buttonOK);
153
154 mainLayout->addLayout(buttonLayout);
155}
156
157// Destructor
158////////////////////////////////////////////////////////////////////////////
159bncTableDlg::~bncTableDlg() {
[1490]160 delete _casterHostComboBox;
161 delete _casterPortLineEdit;
162 delete _casterUserLineEdit;
163 delete _casterPasswordLineEdit;
164 delete _ntripVersionComboBox;
165 delete _buttonGet;
166 delete _buttonCancel;
167 delete _buttonOK;
168 delete _buttonWhatsThis;
169 delete _buttonCasterTable;
170 delete _table;
[35]171}
172
[1493]173// Read full caster table (static)
[35]174////////////////////////////////////////////////////////////////////////////
[191]175t_irc bncTableDlg::getFullTable(const QString& casterHost,
[1376]176 int casterPort, QStringList& allLines,
177 bool alwaysRead) {
[35]178
[299]179 static QMutex mutex;
[298]180 static QMap<QString, QStringList> allTables;
181
[299]182 QMutexLocker locker(&mutex);
183
[298]184 if (!alwaysRead && allTables.find(casterHost) != allTables.end()) {
185 allLines = allTables.find(casterHost).value();
186 return success;
187 }
188
[191]189 allLines.clear();
190
[88]191 QUrl url;
[191]192 url.setHost(casterHost);
193 url.setPort(casterPort);
[1375]194 url.setScheme("http");
195 url.setPath("/");
[35]196
[1387]197 bncNetQueryV2 query;
[1373]198 QByteArray outData;
[1375]199 query.waitForRequestResult(url, outData);
200 if (query.status() == bncNetQuery::finished) {
201 QTextStream in(outData);
202 QString line = in.readLine();
203 while ( !line.isNull() ) {
204 allLines.append(line);
205 line = in.readLine();
206 }
207 allTables.insert(casterHost, allLines);
208 return success;
209 }
210 else {
[191]211 return failure;
[35]212 }
[191]213}
214
215// Read Table from Caster
216////////////////////////////////////////////////////////////////////////////
217void bncTableDlg::slotGetTable() {
218
[555]219 _buttonGet->setEnabled(false);
[1459]220 _buttonCasterTable->setEnabled(false);
[555]221
[1474]222 if ( getFullTable(_casterHostComboBox->currentText(),
[191]223 _casterPortLineEdit->text().toInt(),
[1493]224 _allLines, true) != success ) {
[191]225 QMessageBox::warning(0, "BNC", "Cannot retrieve table of data");
[645]226 _buttonGet->setEnabled(true);
[191]227 return;
228 }
229
[1493]230 static const QStringList labels = QString("mountpoint,identifier,format,"
231 "format-details,carrier,system,network,country,lat,long,"
232 "nmea,solution,generator,compress.,auth.,fee,bitrate,"
233 "misc").split(",");
234
[191]235 QStringList lines;
[196]236 QStringListIterator it(_allLines);
[191]237 while (it.hasNext()) {
238 QString line = it.next();
239 if (line.indexOf("STR") == 0) {
[1493]240 QStringList hlp = line.split(";");
241 if (hlp.size() > labels.size()) {
242 lines.push_back(line);
243 }
[191]244 }
245 }
246
247 if (lines.size() > 0) {
[35]248 _table->setSelectionMode(QAbstractItemView::ExtendedSelection);
249 _table->setSelectionBehavior(QAbstractItemView::SelectRows);
[1493]250 _table->setColumnCount(labels.size());
251 _table->setRowCount(lines.size());
252 for (int nRow = 0; nRow < lines.size(); nRow++) {
253 QStringList columns = lines[nRow].split(";");
254 for (int ic = 1; ic < columns.size(); ic++) {
255 if (ic == 11) {
256 if (columns[ic] == "0") {
257 columns[ic] = "no";
258 } else {
259 columns[ic] = "yes";
260 }
261 }
262 QTableWidgetItem* item = new QTableWidgetItem(columns[ic]);
263 item->setFlags(item->flags() & ~Qt::ItemIsEditable);
264 _table->setItem(nRow, ic-1, item);
[35]265 }
266 }
[103]267 _table->setHorizontalHeaderLabels(labels);
[104]268 _table->setSortingEnabled(true);
[371]269 int ww = QFontMetrics(this->font()).width('w');
[1493]270 _table->horizontalHeader()->resizeSection( 0,10*ww);
271 _table->horizontalHeader()->resizeSection( 1,10*ww);
272 _table->horizontalHeader()->resizeSection( 2, 8*ww);
273 _table->horizontalHeader()->resizeSection( 3,22*ww);
274 _table->horizontalHeader()->resizeSection( 4, 5*ww);
275 _table->horizontalHeader()->resizeSection( 5, 8*ww);
276 _table->horizontalHeader()->resizeSection( 6, 8*ww);
277 _table->horizontalHeader()->resizeSection( 7, 7*ww);
278 _table->horizontalHeader()->resizeSection( 8, 6*ww);
279 _table->horizontalHeader()->resizeSection( 9, 6*ww);
280 _table->horizontalHeader()->resizeSection(10, 6*ww);
281 _table->horizontalHeader()->resizeSection(11, 6*ww);
[371]282 _table->horizontalHeader()->resizeSection(12,15*ww);
[1493]283 _table->horizontalHeader()->resizeSection(13, 8*ww);
284 _table->horizontalHeader()->resizeSection(14, 5*ww);
285 _table->horizontalHeader()->resizeSection(15, 5*ww);
286 _table->horizontalHeader()->resizeSection(16, 7*ww);
[371]287 _table->horizontalHeader()->resizeSection(17,15*ww);
[1493]288 _table->sortItems(0);
[35]289 }
290}
291
292// Accept slot
293////////////////////////////////////////////////////////////////////////////
294void bncTableDlg::accept() {
295
[1477]296 QSettings settings;
297 settings.setValue("ntripVersion", _ntripVersionComboBox->currentText());
[1476]298 QUrl url;
[1478]299 url.setScheme("http");
[1476]300 url.setHost(_casterHostComboBox->currentText());
301 url.setPort(_casterPortLineEdit->text().toInt());
302 url.setUserName(_casterUserLineEdit->text());
303 url.setPassword(_casterPasswordLineEdit->text());
[1477]304 addUrl(url);
[1476]305
[35]306 QStringList* mountPoints = new QStringList;
307
308 if (_table) {
309 for (int ir = 0; ir < _table->rowCount(); ir++) {
[59]310 QTableWidgetItem* item = _table->item(ir,0);
311 QString format = _table->item(ir,2)->text();
[366]312 QString latitude = _table->item(ir,8)->text();
313 QString longitude = _table->item(ir,9)->text();
314 QString nmea = _table->item(ir,10)->text();
[1351]315 QString ntripVersion = _ntripVersionComboBox->currentText();
[59]316 format.replace(" ", "_");
[35]317 if (_table->isItemSelected(item)) {
318 url.setPath(item->text());
[1351]319 mountPoints->push_back(url.toString() + " " + format + " " + latitude
320 + " " + longitude + " " + nmea + " " + ntripVersion);
[35]321 }
322 }
323 }
324 emit newMountPoints(mountPoints);
325
326 QDialog::accept();
327}
[195]328
329// User changed the selection of mountPoints
330////////////////////////////////////////////////////////////////////////////
331void bncTableDlg::slotSelectionChanged() {
332 if (_table->selectedItems().isEmpty()) {
333 }
334}
335
[399]336// Whats This Help
337void bncTableDlg::slotWhatsThis() {
338QWhatsThis::enterWhatsThisMode();
339}
340
[1459]341// Slot caster table
342////////////////////////////////////////////////////////////////////////////
343void bncTableDlg::slotCasterTable() {
344
345 _buttonCasterTable->setEnabled(false);
[1474]346 _casterHostComboBox->setEnabled(false);
[1461]347 _casterPortLineEdit->setEnabled(false);
348 _casterUserLineEdit->setEnabled(false);
349 _casterPasswordLineEdit->setEnabled(false);
350 _ntripVersionComboBox->setEnabled(false);
351 _buttonWhatsThis->setEnabled(false);
352 _buttonGet->setEnabled(false);
353 _buttonCancel->setEnabled(false);
354 _buttonOK->setEnabled(false);
355
[1459]356 bncCasterTableDlg* dlg = new bncCasterTableDlg(this);
357 dlg->move(this->pos().x()+50, this->pos().y()+50);
[1474]358 connect(dlg, SIGNAL(newCaster(QString, QString)),
359 this, SLOT(slotNewCaster(QString, QString)));
[1459]360 dlg->exec();
361 delete dlg;
[1461]362
[1459]363 _buttonCasterTable->setEnabled(true);
[1474]364 _casterHostComboBox->setEnabled(true);
[1461]365 _casterPortLineEdit->setEnabled(true);
366 _casterUserLineEdit->setEnabled(true);
367 _casterPasswordLineEdit->setEnabled(true);
368 _ntripVersionComboBox->setEnabled(true);
369 _buttonWhatsThis->setEnabled(true);
370 _buttonGet->setEnabled(true);
371 _buttonCancel->setEnabled(true);
372 _buttonOK->setEnabled(true);
[399]373
[1459]374}
375
[1492]376// New caster selected
377////////////////////////////////////////////////////////////////////////////
378void bncTableDlg::slotNewCaster(QString newCasterHost, QString newCasterPort) {
379
380 _casterHostComboBox->insertItem(0, newCasterHost);
381 _casterHostComboBox->setCurrentIndex(0);
382 _casterUserLineEdit->setText("");
[1497]383 _casterPasswordLineEdit->setText("");
[1492]384 _casterPortLineEdit->setText(newCasterPort);
385
386 QUrl url;
387 url.setScheme("http");
388 url.setHost(newCasterHost);
389 url.setPort(newCasterPort.toInt());
390 addUrl(url);
391
392 _casterHostComboBox->setCurrentIndex(0);
393}
394
395// New caster selected
396////////////////////////////////////////////////////////////////////////////
397void bncTableDlg::addUrl(const QUrl& url) {
398 QSettings settings;
399 QStringList oldUrlList = settings.value("casterUrlList").toStringList();
400 QStringList newUrlList;
401 newUrlList << url.toString();
402 for (int ii = 0; ii < oldUrlList.count(); ii++) {
403 QUrl oldUrl(oldUrlList[ii]);
404 if (url.host() != oldUrl.host()) {
405 newUrlList << oldUrl.toString();
406 }
407 }
408 settings.setValue("casterUrlList", newUrlList);
409 settings.sync();
410}
411
412// New caster selected in combobox
413////////////////////////////////////////////////////////////////////////////
414void bncTableDlg::slotCasterHostChanged(const QString& newHost) {
415 QSettings settings;
416 QStringList casterUrlList = settings.value("casterUrlList").toStringList();
417 for (int ii = 0; ii < casterUrlList.count(); ii++) {
418 QUrl url(casterUrlList[ii]);
419 if (url.host() == newHost) {
420 _casterUserLineEdit->setText(url.userName());
421 _casterPasswordLineEdit->setText(url.password());
422 if (url.port() > 0) {
423 _casterPortLineEdit->setText(QString("%1").arg(url.port()));
424 }
425 else {
426 _casterPortLineEdit->setText("");
427 }
428 }
429 }
430}
431
[1459]432// Caster table
433////////////////////////////////////////////////////////////////////////////
434bncCasterTableDlg::bncCasterTableDlg(QWidget* parent) :
435 QDialog(parent) {
436
[1461]437 static const QStringList labels = QString("host,port,identifier,operator,nmea,country,lat,long,link").split(",");
[1459]438
439 _casterTable = new QTableWidget(this);
440
441 QUrl url;
442 url.setHost("www.rtcm-ntrip.org");
443 url.setPort(2101);
444 url.setScheme("http");
445 url.setPath("/");
446
447 bncNetQueryV2 query;
448 QByteArray outData;
449 query.waitForRequestResult(url, outData);
[1494]450
451 QStringList lines;
[1459]452 if (query.status() == bncNetQuery::finished) {
453 QTextStream in(outData);
454 QString line = in.readLine();
455 while ( !line.isNull() ) {
456 line = in.readLine();
457 if (line.indexOf("CAS") == 0) {
[1494]458 QStringList hlp = line.split(";");
459 if (hlp.size() > labels.size()) {
460 lines.push_back(line);
461 }
[1459]462 }
463 }
464 }
[1494]465
[1459]466 if (lines.size() > 0) {
467 _casterTable->setSelectionMode(QAbstractItemView::ExtendedSelection);
468 _casterTable->setSelectionBehavior(QAbstractItemView::SelectRows);
469
470 QStringList hlp = lines[0].split(";");
[1494]471 _casterTable->setColumnCount(labels.size());
472 _casterTable->setRowCount(lines.size());
[1459]473
[1494]474 for (int nRow = 0; nRow < lines.size(); nRow++) {
475 QStringList columns = lines[nRow].split(";");
476 for (int ic = 1; ic < columns.size(); ic++) {
477 if (ic == 5) {
478 if (columns[ic] == "0") {
479 columns[ic] = "no";
480 } else {
481 columns[ic] = "yes";
482 }
483 }
484 QTableWidgetItem* item = new QTableWidgetItem(columns[ic]);
485 item->setFlags(item->flags() & ~Qt::ItemIsEditable);
486 _casterTable->setItem(nRow, ic-1, item);
[1459]487 }
488 }
489 }
490 _casterTable->setHorizontalHeaderLabels(labels);
491 _casterTable->setSortingEnabled(true);
[1494]492 _casterTable->sortItems(0);
[1459]493 int ww = QFontMetrics(this->font()).width('w');
494 _casterTable->horizontalHeader()->resizeSection(0,15*ww);
[1494]495 _casterTable->horizontalHeader()->resizeSection(1, 5*ww);
[1459]496 _casterTable->horizontalHeader()->resizeSection(2,15*ww);
497 _casterTable->horizontalHeader()->resizeSection(3,15*ww);
[1494]498 _casterTable->horizontalHeader()->resizeSection(4, 5*ww);
499 _casterTable->horizontalHeader()->resizeSection(5, 7*ww);
500 _casterTable->horizontalHeader()->resizeSection(6, 7*ww);
501 _casterTable->horizontalHeader()->resizeSection(7, 7*ww);
[1459]502 _casterTable->horizontalHeader()->resizeSection(8,15*ww);
503
[1488]504 _closeButton = new QPushButton("Cancel");
[1459]505 connect(_closeButton, SIGNAL(clicked()), this, SLOT(close()));
506 _closeButton->setMinimumWidth(8*ww);
507 _closeButton->setMaximumWidth(8*ww);
508
[1488]509 _okButton = new QPushButton(tr("OK"), this);
[1459]510 connect(_okButton, SIGNAL(clicked()), this, SLOT(slotAcceptCasterTable()));
511 _okButton->setMinimumWidth(8*ww);
512 _okButton->setMaximumWidth(8*ww);
513
[1488]514 _whatsThisButton = new QPushButton(tr("Help=Shift+F1"), this);
515 connect(_whatsThisButton, SIGNAL(clicked()), this, SLOT(slotWhatsThis()));
516 _whatsThisButton->setMinimumWidth(12*ww);
517 _whatsThisButton->setMaximumWidth(12*ww);
[1459]518
[1471]519 _casterTable->setWhatsThis(tr("<p>Select an NTRIP broadcaster and hit 'OK'.</p><p>See <u>http://www.rtcm-ntrip.org/home</u> for further details on known NTRIP broadcaster installations.</u>."));
[1459]520
521 QGridLayout* dlgLayout = new QGridLayout();
522 dlgLayout->addWidget(new QLabel(" List of NTRIP Broadcasters from www.rtcm-ntrip.org"), 0,0,1,3,Qt::AlignLeft);
[1488]523 dlgLayout->addWidget(_casterTable, 1, 0, 1, 3);
524 dlgLayout->addWidget(_whatsThisButton, 2, 0);
525 dlgLayout->addWidget(_closeButton, 2, 1, Qt::AlignRight);
526 dlgLayout->addWidget(_okButton, 2, 2);
[1459]527
528 setMinimumSize(600,400);
529 setWindowTitle(tr("Select Broadcaster"));
530 setLayout(dlgLayout);
[1504]531 resize(68*ww, 50*ww);
[1459]532 show();
533}
534
[1488]535// Caster table destructor
[1459]536////////////////////////////////////////////////////////////////////////////
[1488]537bncCasterTableDlg::~bncCasterTableDlg() {
538 delete _casterTable;
539 delete _okButton;
540 delete _closeButton;
541 delete _whatsThisButton;
[1459]542}
543
[1488]544// Caster table what's this
[1459]545////////////////////////////////////////////////////////////////////////////
[1488]546void bncCasterTableDlg:: slotWhatsThis() {
547 QWhatsThis::enterWhatsThisMode();
[1459]548}
549
550// Accept caster table
551////////////////////////////////////////////////////////////////////////////
552void bncCasterTableDlg::slotAcceptCasterTable() {
553 if (_casterTable) {
[1489]554 for (int ir = _casterTable->rowCount() - 1; ir >= 0 ; ir--) {
[1474]555 if (_casterTable->isItemSelected(_casterTable->item(ir,0))) {
556 emit newCaster(_casterTable->item(ir,0)->text(),
557 _casterTable->item(ir,1)->text());
[1459]558 }
559 }
560 }
[1474]561 QDialog::accept();
[1459]562}
563
Note: See TracBrowser for help on using the repository browser.