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

Last change on this file since 2417 was 1848, checked in by mervart, 15 years ago

* empty log message *

File size: 21.3 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"
[1848]45#include "bncnetqueryv1.h"
[1535]46#include "bncsettings.h"
[35]47
[1373]48using namespace std;
49
[35]50// Constructor
51////////////////////////////////////////////////////////////////////////////
[90]52bncTableDlg::bncTableDlg(QWidget* parent) : QDialog(parent) {
[35]53
54 setMinimumSize(600,400);
[1611]55 setWindowTitle(tr("Add Streams from Caster"));
[35]56
57 QVBoxLayout* mainLayout = new QVBoxLayout(this);
58
[1474]59 int ww = QFontMetrics(font()).width('w');
60
61 _casterPortLineEdit = new QLineEdit();
62 _casterPortLineEdit->setMaximumWidth(9*ww);
63
64 _casterUserLineEdit = new QLineEdit();
65 _casterUserLineEdit->setMaximumWidth(9*ww);
66
67 _casterPasswordLineEdit = new QLineEdit();
68 _casterPasswordLineEdit->setMaximumWidth(9*ww);
[1821]69 _casterPasswordLineEdit->setEchoMode(QLineEdit::Password);
[1474]70
71 _casterHostComboBox = new QComboBox();
[1482]72 _casterHostComboBox->setMaxCount(10);
[1474]73 _casterHostComboBox->setDuplicatesEnabled(false);
74 _casterHostComboBox->setEditable(true);
[1477]75 _casterHostComboBox->setMinimumWidth(20*ww);
[1474]76 _casterHostComboBox->setMaximumWidth(20*ww);
77 connect(_casterHostComboBox, SIGNAL(currentIndexChanged(const QString&)),
78 this, SLOT(slotCasterHostChanged(const QString&)));
[1535]79 bncSettings settings;
[1481]80 settings.remove("casterHostList");
81 settings.remove("casterHost");
82 settings.remove("casterPort");
83 settings.remove("casterUser");
84 settings.remove("casterPassword");
[1476]85 QStringList casterUrlList = settings.value("casterUrlList").toStringList();
86 for (int ii = 0; ii < casterUrlList.count(); ii++) {
87 QUrl url(casterUrlList[ii]);
[1474]88 _casterHostComboBox->addItem(url.host());
[1274]89 }
[683]90
[1350]91 _ntripVersionComboBox = new QComboBox();
[1721]92 _ntripVersionComboBox->addItems(QString("1,2,R,U").split(","));
[1350]93 int kk = _ntripVersionComboBox->findText(settings.value("ntripVersion").toString());
94 if (kk != -1) {
95 _ntripVersionComboBox->setCurrentIndex(kk);
96 }
[1459]97 _ntripVersionComboBox->setMaximumWidth(5*ww);
[1350]98
[1459]99 _buttonCasterTable = new QPushButton(tr("Show"), this);
100 connect(_buttonCasterTable, SIGNAL(clicked()), this, SLOT(slotCasterTable()));
101 _buttonCasterTable->setMaximumWidth(5*ww);
102
[683]103 // WhatsThis
104 // ---------
[1459]105 _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]106 _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]107 _casterPortLineEdit->setWhatsThis(tr("Enter the NTRIP broadcaster port number."));
108 _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]109
[88]110 QGridLayout* editLayout = new QGridLayout;
[1459]111 editLayout->addWidget(new QLabel(tr("Caster host")), 0, 0);
[1474]112 editLayout->addWidget(_casterHostComboBox, 0, 1);
[1459]113 editLayout->addWidget(new QLabel(tr(" Caster port")), 0, 2, Qt::AlignRight);
114 editLayout->addWidget(_casterPortLineEdit, 0, 3);
[1598]115 editLayout->addWidget(new QLabel(tr("Casters table")), 0, 4, Qt::AlignRight);
[1459]116 editLayout->addWidget(_buttonCasterTable, 0, 5);
117 editLayout->addWidget(new QLabel(tr("User")), 1, 0, Qt::AlignRight);
118 editLayout->addWidget(_casterUserLineEdit, 1, 1);
119 editLayout->addWidget(new QLabel(tr("Password")), 1, 2, Qt::AlignRight);
120 editLayout->addWidget(_casterPasswordLineEdit, 1, 3);
121 editLayout->addWidget(new QLabel(tr(" NTRIP Version")),1, 4, Qt::AlignRight);
122 editLayout->addWidget(_ntripVersionComboBox, 1, 5);
[88]123
[35]124 mainLayout->addLayout(editLayout);
125
[1471]126 _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>"));
[1766]127 _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>&nbsp; U:&nbsp; NTRIP Version 2, UDP 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') and UDP (option 'U') are not accepted by proxies and sometimes not supported by mobile Internet Service Providers.</p>"));
[1409]128
[35]129 _table = new QTableWidget(this);
[1459]130 _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]131 connect(_table, SIGNAL(itemSelectionChanged()),
132 this, SLOT(slotSelectionChanged()));
[35]133 mainLayout->addWidget(_table);
134
[402]135 _buttonWhatsThis = new QPushButton(tr("Help=Shift+F1"), this);
[399]136 connect(_buttonWhatsThis, SIGNAL(clicked()), this, SLOT(slotWhatsThis()));
137
[195]138 _buttonGet = new QPushButton(tr("Get table"), this);
[399]139 _buttonGet->setDefault(true);
[35]140 connect(_buttonGet, SIGNAL(clicked()), this, SLOT(slotGetTable()));
[366]141
[35]142 _buttonCancel = new QPushButton(tr("Cancel"), this);
143 connect(_buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
144
145 _buttonOK = new QPushButton(tr("OK"), this);
146 connect(_buttonOK, SIGNAL(clicked()), this, SLOT(accept()));
147
148 QHBoxLayout* buttonLayout = new QHBoxLayout;
[399]149 buttonLayout->addWidget(_buttonWhatsThis);
[35]150 buttonLayout->addStretch(1);
151 buttonLayout->addWidget(_buttonGet);
152 buttonLayout->addWidget(_buttonCancel);
153 buttonLayout->addWidget(_buttonOK);
154
155 mainLayout->addLayout(buttonLayout);
156}
157
158// Destructor
159////////////////////////////////////////////////////////////////////////////
160bncTableDlg::~bncTableDlg() {
[1490]161 delete _casterHostComboBox;
162 delete _casterPortLineEdit;
163 delete _casterUserLineEdit;
164 delete _casterPasswordLineEdit;
165 delete _ntripVersionComboBox;
166 delete _buttonGet;
167 delete _buttonCancel;
168 delete _buttonOK;
169 delete _buttonWhatsThis;
170 delete _buttonCasterTable;
171 delete _table;
[35]172}
173
[1493]174// Read full caster table (static)
[35]175////////////////////////////////////////////////////////////////////////////
[191]176t_irc bncTableDlg::getFullTable(const QString& casterHost,
[1376]177 int casterPort, QStringList& allLines,
178 bool alwaysRead) {
[35]179
[299]180 static QMutex mutex;
[298]181 static QMap<QString, QStringList> allTables;
182
[299]183 QMutexLocker locker(&mutex);
184
[298]185 if (!alwaysRead && allTables.find(casterHost) != allTables.end()) {
186 allLines = allTables.find(casterHost).value();
187 return success;
188 }
189
[191]190 allLines.clear();
191
[88]192 QUrl url;
[191]193 url.setHost(casterHost);
194 url.setPort(casterPort);
[1375]195 url.setScheme("http");
196 url.setPath("/");
[35]197
[1848]198 bncNetQueryV1 query;
[1373]199 QByteArray outData;
[1375]200 query.waitForRequestResult(url, outData);
201 if (query.status() == bncNetQuery::finished) {
202 QTextStream in(outData);
203 QString line = in.readLine();
204 while ( !line.isNull() ) {
205 allLines.append(line);
206 line = in.readLine();
207 }
208 allTables.insert(casterHost, allLines);
209 return success;
210 }
211 else {
[191]212 return failure;
[35]213 }
[191]214}
215
216// Read Table from Caster
217////////////////////////////////////////////////////////////////////////////
218void bncTableDlg::slotGetTable() {
219
[555]220 _buttonGet->setEnabled(false);
[1459]221 _buttonCasterTable->setEnabled(false);
[555]222
[1474]223 if ( getFullTable(_casterHostComboBox->currentText(),
[191]224 _casterPortLineEdit->text().toInt(),
[1493]225 _allLines, true) != success ) {
[191]226 QMessageBox::warning(0, "BNC", "Cannot retrieve table of data");
[645]227 _buttonGet->setEnabled(true);
[191]228 return;
229 }
230
[1493]231 static const QStringList labels = QString("mountpoint,identifier,format,"
232 "format-details,carrier,system,network,country,lat,long,"
233 "nmea,solution,generator,compress.,auth.,fee,bitrate,"
234 "misc").split(",");
235
[191]236 QStringList lines;
[196]237 QStringListIterator it(_allLines);
[191]238 while (it.hasNext()) {
239 QString line = it.next();
240 if (line.indexOf("STR") == 0) {
[1493]241 QStringList hlp = line.split(";");
242 if (hlp.size() > labels.size()) {
243 lines.push_back(line);
244 }
[191]245 }
246 }
247
248 if (lines.size() > 0) {
[35]249 _table->setSelectionMode(QAbstractItemView::ExtendedSelection);
250 _table->setSelectionBehavior(QAbstractItemView::SelectRows);
[1493]251 _table->setColumnCount(labels.size());
252 _table->setRowCount(lines.size());
253 for (int nRow = 0; nRow < lines.size(); nRow++) {
254 QStringList columns = lines[nRow].split(";");
255 for (int ic = 1; ic < columns.size(); ic++) {
256 if (ic == 11) {
257 if (columns[ic] == "0") {
258 columns[ic] = "no";
259 } else {
260 columns[ic] = "yes";
261 }
262 }
263 QTableWidgetItem* item = new QTableWidgetItem(columns[ic]);
264 item->setFlags(item->flags() & ~Qt::ItemIsEditable);
265 _table->setItem(nRow, ic-1, item);
[35]266 }
267 }
[103]268 _table->setHorizontalHeaderLabels(labels);
[104]269 _table->setSortingEnabled(true);
[371]270 int ww = QFontMetrics(this->font()).width('w');
[1493]271 _table->horizontalHeader()->resizeSection( 0,10*ww);
272 _table->horizontalHeader()->resizeSection( 1,10*ww);
273 _table->horizontalHeader()->resizeSection( 2, 8*ww);
274 _table->horizontalHeader()->resizeSection( 3,22*ww);
275 _table->horizontalHeader()->resizeSection( 4, 5*ww);
276 _table->horizontalHeader()->resizeSection( 5, 8*ww);
277 _table->horizontalHeader()->resizeSection( 6, 8*ww);
278 _table->horizontalHeader()->resizeSection( 7, 7*ww);
279 _table->horizontalHeader()->resizeSection( 8, 6*ww);
280 _table->horizontalHeader()->resizeSection( 9, 6*ww);
281 _table->horizontalHeader()->resizeSection(10, 6*ww);
282 _table->horizontalHeader()->resizeSection(11, 6*ww);
[371]283 _table->horizontalHeader()->resizeSection(12,15*ww);
[1493]284 _table->horizontalHeader()->resizeSection(13, 8*ww);
285 _table->horizontalHeader()->resizeSection(14, 5*ww);
286 _table->horizontalHeader()->resizeSection(15, 5*ww);
287 _table->horizontalHeader()->resizeSection(16, 7*ww);
[371]288 _table->horizontalHeader()->resizeSection(17,15*ww);
[1493]289 _table->sortItems(0);
[35]290 }
291}
292
293// Accept slot
294////////////////////////////////////////////////////////////////////////////
295void bncTableDlg::accept() {
296
[1535]297 bncSettings settings;
[1477]298 settings.setValue("ntripVersion", _ntripVersionComboBox->currentText());
[1476]299 QUrl url;
[1478]300 url.setScheme("http");
[1476]301 url.setHost(_casterHostComboBox->currentText());
302 url.setPort(_casterPortLineEdit->text().toInt());
[1508]303 url.setUserName(QUrl::toPercentEncoding(_casterUserLineEdit->text()));
304 url.setPassword(QUrl::toPercentEncoding(_casterPasswordLineEdit->text()));
[1477]305 addUrl(url);
[1476]306
[35]307 QStringList* mountPoints = new QStringList;
308
309 if (_table) {
310 for (int ir = 0; ir < _table->rowCount(); ir++) {
[59]311 QTableWidgetItem* item = _table->item(ir,0);
312 QString format = _table->item(ir,2)->text();
[366]313 QString latitude = _table->item(ir,8)->text();
314 QString longitude = _table->item(ir,9)->text();
315 QString nmea = _table->item(ir,10)->text();
[1351]316 QString ntripVersion = _ntripVersionComboBox->currentText();
[59]317 format.replace(" ", "_");
[35]318 if (_table->isItemSelected(item)) {
319 url.setPath(item->text());
[1351]320 mountPoints->push_back(url.toString() + " " + format + " " + latitude
321 + " " + longitude + " " + nmea + " " + ntripVersion);
[35]322 }
323 }
324 }
325 emit newMountPoints(mountPoints);
326
327 QDialog::accept();
328}
[195]329
330// User changed the selection of mountPoints
331////////////////////////////////////////////////////////////////////////////
332void bncTableDlg::slotSelectionChanged() {
333 if (_table->selectedItems().isEmpty()) {
334 }
335}
336
[399]337// Whats This Help
338void bncTableDlg::slotWhatsThis() {
339QWhatsThis::enterWhatsThisMode();
340}
341
[1459]342// Slot caster table
343////////////////////////////////////////////////////////////////////////////
344void bncTableDlg::slotCasterTable() {
345
346 _buttonCasterTable->setEnabled(false);
[1474]347 _casterHostComboBox->setEnabled(false);
[1461]348 _casterPortLineEdit->setEnabled(false);
349 _casterUserLineEdit->setEnabled(false);
350 _casterPasswordLineEdit->setEnabled(false);
351 _ntripVersionComboBox->setEnabled(false);
352 _buttonWhatsThis->setEnabled(false);
353 _buttonGet->setEnabled(false);
354 _buttonCancel->setEnabled(false);
355 _buttonOK->setEnabled(false);
356
[1459]357 bncCasterTableDlg* dlg = new bncCasterTableDlg(this);
358 dlg->move(this->pos().x()+50, this->pos().y()+50);
[1474]359 connect(dlg, SIGNAL(newCaster(QString, QString)),
360 this, SLOT(slotNewCaster(QString, QString)));
[1459]361 dlg->exec();
362 delete dlg;
[1461]363
[1459]364 _buttonCasterTable->setEnabled(true);
[1474]365 _casterHostComboBox->setEnabled(true);
[1461]366 _casterPortLineEdit->setEnabled(true);
367 _casterUserLineEdit->setEnabled(true);
368 _casterPasswordLineEdit->setEnabled(true);
369 _ntripVersionComboBox->setEnabled(true);
370 _buttonWhatsThis->setEnabled(true);
371 _buttonGet->setEnabled(true);
372 _buttonCancel->setEnabled(true);
373 _buttonOK->setEnabled(true);
[399]374
[1459]375}
376
[1492]377// New caster selected
378////////////////////////////////////////////////////////////////////////////
379void bncTableDlg::slotNewCaster(QString newCasterHost, QString newCasterPort) {
380
381 _casterHostComboBox->insertItem(0, newCasterHost);
382 _casterHostComboBox->setCurrentIndex(0);
383 _casterUserLineEdit->setText("");
[1497]384 _casterPasswordLineEdit->setText("");
[1492]385 _casterPortLineEdit->setText(newCasterPort);
386
387 QUrl url;
388 url.setScheme("http");
389 url.setHost(newCasterHost);
390 url.setPort(newCasterPort.toInt());
391 addUrl(url);
392
393 _casterHostComboBox->setCurrentIndex(0);
394}
395
396// New caster selected
397////////////////////////////////////////////////////////////////////////////
398void bncTableDlg::addUrl(const QUrl& url) {
[1535]399 bncSettings settings;
[1492]400 QStringList oldUrlList = settings.value("casterUrlList").toStringList();
401 QStringList newUrlList;
402 newUrlList << url.toString();
403 for (int ii = 0; ii < oldUrlList.count(); ii++) {
404 QUrl oldUrl(oldUrlList[ii]);
405 if (url.host() != oldUrl.host()) {
406 newUrlList << oldUrl.toString();
407 }
408 }
409 settings.setValue("casterUrlList", newUrlList);
410 settings.sync();
411}
412
413// New caster selected in combobox
414////////////////////////////////////////////////////////////////////////////
415void bncTableDlg::slotCasterHostChanged(const QString& newHost) {
[1535]416 bncSettings settings;
[1492]417 QStringList casterUrlList = settings.value("casterUrlList").toStringList();
418 for (int ii = 0; ii < casterUrlList.count(); ii++) {
419 QUrl url(casterUrlList[ii]);
420 if (url.host() == newHost) {
[1508]421 _casterUserLineEdit->setText(
422 QUrl::fromPercentEncoding(url.userName().toAscii()));
423 _casterPasswordLineEdit->setText(
424 QUrl::fromPercentEncoding(url.password().toAscii()));
[1492]425 if (url.port() > 0) {
426 _casterPortLineEdit->setText(QString("%1").arg(url.port()));
427 }
428 else {
429 _casterPortLineEdit->setText("");
430 }
431 }
432 }
433}
434
[1459]435// Caster table
436////////////////////////////////////////////////////////////////////////////
437bncCasterTableDlg::bncCasterTableDlg(QWidget* parent) :
438 QDialog(parent) {
439
[1461]440 static const QStringList labels = QString("host,port,identifier,operator,nmea,country,lat,long,link").split(",");
[1459]441
442 _casterTable = new QTableWidget(this);
443
444 QUrl url;
445 url.setHost("www.rtcm-ntrip.org");
446 url.setPort(2101);
447 url.setScheme("http");
448 url.setPath("/");
449
[1848]450 bncNetQueryV1 query;
[1459]451 QByteArray outData;
452 query.waitForRequestResult(url, outData);
[1494]453
454 QStringList lines;
[1459]455 if (query.status() == bncNetQuery::finished) {
456 QTextStream in(outData);
457 QString line = in.readLine();
458 while ( !line.isNull() ) {
459 line = in.readLine();
460 if (line.indexOf("CAS") == 0) {
[1494]461 QStringList hlp = line.split(";");
462 if (hlp.size() > labels.size()) {
463 lines.push_back(line);
464 }
[1459]465 }
466 }
467 }
[1494]468
[1459]469 if (lines.size() > 0) {
470 _casterTable->setSelectionMode(QAbstractItemView::ExtendedSelection);
471 _casterTable->setSelectionBehavior(QAbstractItemView::SelectRows);
472
473 QStringList hlp = lines[0].split(";");
[1494]474 _casterTable->setColumnCount(labels.size());
475 _casterTable->setRowCount(lines.size());
[1459]476
[1494]477 for (int nRow = 0; nRow < lines.size(); nRow++) {
478 QStringList columns = lines[nRow].split(";");
479 for (int ic = 1; ic < columns.size(); ic++) {
480 if (ic == 5) {
481 if (columns[ic] == "0") {
482 columns[ic] = "no";
483 } else {
484 columns[ic] = "yes";
485 }
486 }
487 QTableWidgetItem* item = new QTableWidgetItem(columns[ic]);
488 item->setFlags(item->flags() & ~Qt::ItemIsEditable);
489 _casterTable->setItem(nRow, ic-1, item);
[1459]490 }
491 }
492 }
493 _casterTable->setHorizontalHeaderLabels(labels);
494 _casterTable->setSortingEnabled(true);
[1494]495 _casterTable->sortItems(0);
[1459]496 int ww = QFontMetrics(this->font()).width('w');
497 _casterTable->horizontalHeader()->resizeSection(0,15*ww);
[1494]498 _casterTable->horizontalHeader()->resizeSection(1, 5*ww);
[1459]499 _casterTable->horizontalHeader()->resizeSection(2,15*ww);
500 _casterTable->horizontalHeader()->resizeSection(3,15*ww);
[1494]501 _casterTable->horizontalHeader()->resizeSection(4, 5*ww);
502 _casterTable->horizontalHeader()->resizeSection(5, 7*ww);
503 _casterTable->horizontalHeader()->resizeSection(6, 7*ww);
504 _casterTable->horizontalHeader()->resizeSection(7, 7*ww);
[1459]505 _casterTable->horizontalHeader()->resizeSection(8,15*ww);
506
[1488]507 _closeButton = new QPushButton("Cancel");
[1459]508 connect(_closeButton, SIGNAL(clicked()), this, SLOT(close()));
509 _closeButton->setMinimumWidth(8*ww);
510 _closeButton->setMaximumWidth(8*ww);
511
[1488]512 _okButton = new QPushButton(tr("OK"), this);
[1459]513 connect(_okButton, SIGNAL(clicked()), this, SLOT(slotAcceptCasterTable()));
514 _okButton->setMinimumWidth(8*ww);
515 _okButton->setMaximumWidth(8*ww);
516
[1488]517 _whatsThisButton = new QPushButton(tr("Help=Shift+F1"), this);
518 connect(_whatsThisButton, SIGNAL(clicked()), this, SLOT(slotWhatsThis()));
519 _whatsThisButton->setMinimumWidth(12*ww);
520 _whatsThisButton->setMaximumWidth(12*ww);
[1459]521
[1471]522 _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]523
524 QGridLayout* dlgLayout = new QGridLayout();
525 dlgLayout->addWidget(new QLabel(" List of NTRIP Broadcasters from www.rtcm-ntrip.org"), 0,0,1,3,Qt::AlignLeft);
[1488]526 dlgLayout->addWidget(_casterTable, 1, 0, 1, 3);
527 dlgLayout->addWidget(_whatsThisButton, 2, 0);
528 dlgLayout->addWidget(_closeButton, 2, 1, Qt::AlignRight);
529 dlgLayout->addWidget(_okButton, 2, 2);
[1459]530
531 setMinimumSize(600,400);
532 setWindowTitle(tr("Select Broadcaster"));
533 setLayout(dlgLayout);
[1504]534 resize(68*ww, 50*ww);
[1459]535 show();
536}
537
[1488]538// Caster table destructor
[1459]539////////////////////////////////////////////////////////////////////////////
[1488]540bncCasterTableDlg::~bncCasterTableDlg() {
541 delete _casterTable;
542 delete _okButton;
543 delete _closeButton;
544 delete _whatsThisButton;
[1459]545}
546
[1488]547// Caster table what's this
[1459]548////////////////////////////////////////////////////////////////////////////
[1488]549void bncCasterTableDlg:: slotWhatsThis() {
550 QWhatsThis::enterWhatsThisMode();
[1459]551}
552
553// Accept caster table
554////////////////////////////////////////////////////////////////////////////
555void bncCasterTableDlg::slotAcceptCasterTable() {
556 if (_casterTable) {
[1489]557 for (int ir = _casterTable->rowCount() - 1; ir >= 0 ; ir--) {
[1474]558 if (_casterTable->isItemSelected(_casterTable->item(ir,0))) {
559 emit newCaster(_casterTable->item(ir,0)->text(),
560 _casterTable->item(ir,1)->text());
[1459]561 }
562 }
563 }
[1474]564 QDialog::accept();
[1459]565}
566
Note: See TracBrowser for help on using the repository browser.