Changeset 1459 in ntrip
- Timestamp:
- Jan 12, 2009, 8:32:03 PM (16 years ago)
- Location:
- trunk/BNC
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/bnctabledlg.cpp
r1420 r1459 84 84 _ntripVersionComboBox->setCurrentIndex(kk); 85 85 } 86 _ntripVersionComboBox->setMaximumWidth(5*ww); 87 88 _buttonCasterTable = new QPushButton(tr("Show"), this); 89 connect(_buttonCasterTable, SIGNAL(clicked()), this, SLOT(slotCasterTable())); 90 _buttonCasterTable->setMaximumWidth(5*ww); 86 91 87 92 // WhatsThis 88 93 // --------- 89 _casterUserLineEdit->setWhatsThis(tr(" 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. 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>."));90 _caster PortLineEdit->setWhatsThis(tr("Enter the NTRIP broadcaster hostname or IP number and port number. <u>http://www.rtcm-ntrip.org/home</u> provides information about known NTRIP broadcaster installations. 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>."));91 _caster HostLineEdit->setWhatsThis(tr("Enter the NTRIP broadcaster hostname or IP number and port number. <u>http://www.rtcm-ntrip.org/home</u> provides information about known NTRIP broadcaster installations. 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>."));92 _casterPasswordLineEdit->setWhatsThis(tr("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. Accounts are usually provided per NTRIP broadcaster through a registration procedure. 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>."));94 _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>")); 95 _casterHostLineEdit->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>")); 96 _casterPortLineEdit->setWhatsThis(tr("Enter the NTRIP broadcaster port number.")); 97 _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.")); 93 98 94 99 QGridLayout* editLayout = new QGridLayout; 95 editLayout->addWidget(new QLabel(tr("Caster host")), 0, 0); 96 editLayout->addWidget(_casterHostLineEdit, 0, 1); 97 editLayout->addWidget(new QLabel(tr("Caster port")), 0, 2); 98 editLayout->addWidget(_casterPortLineEdit, 0, 3); 99 editLayout->addWidget(new QLabel(tr("NTRIP Version")), 0, 4); 100 editLayout->addWidget(_ntripVersionComboBox, 0, 5); 101 editLayout->addWidget(new QLabel(tr("User")), 1, 0); 102 editLayout->addWidget(_casterUserLineEdit, 1, 1); 103 editLayout->addWidget(new QLabel(tr("Password")), 1, 2); 104 editLayout->addWidget(_casterPasswordLineEdit, 1, 3); 100 editLayout->addWidget(new QLabel(tr("Caster host")), 0, 0); 101 editLayout->addWidget(_casterHostLineEdit, 0, 1); 102 editLayout->addWidget(new QLabel(tr(" Caster port")), 0, 2, Qt::AlignRight); 103 editLayout->addWidget(_casterPortLineEdit, 0, 3); 104 editLayout->addWidget(new QLabel(tr("Caster table")), 0, 4, Qt::AlignRight); 105 editLayout->addWidget(_buttonCasterTable, 0, 5); 106 editLayout->addWidget(new QLabel(tr("User")), 1, 0, Qt::AlignRight); 107 editLayout->addWidget(_casterUserLineEdit, 1, 1); 108 editLayout->addWidget(new QLabel(tr("Password")), 1, 2, Qt::AlignRight); 109 editLayout->addWidget(_casterPasswordLineEdit, 1, 3); 110 editLayout->addWidget(new QLabel(tr(" NTRIP Version")),1, 4, Qt::AlignRight); 111 editLayout->addWidget(_ntripVersionComboBox, 1, 5); 105 112 106 113 mainLayout->addLayout(editLayout); 107 114 115 _buttonCasterTable->setWhatsThis(tr("<p>Hit 'Show' for a table of known NTRIP broadcaster installations as maintained at www.rtcm-ntrip.org/home.</p><p>A window opens which allows to select a broadcaster for stream retrieval.</p>")); 108 116 _ntripVersionComboBox->setWhatsThis(tr("<p>Select the NTRIP transport protocol version you want to use. Implemented options are:<br> 1: NTRIP version 1, TCP/IP<br> 2: NTRIP version 2, TCP/IP<br> R: NTRIP Version 2, RTSP/RTP<br>Select option '1' if you are not sure whether the NTRIP broadcaster supports NTRIP version 2.</p>")); 109 117 110 118 _table = new QTableWidget(this); 111 _table->setWhatsThis(tr("<p>Use the 'Get Table' button to download the sourcetable from the 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>"));119 _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>")); 112 120 connect(_table, SIGNAL(itemSelectionChanged()), 113 121 this, SLOT(slotSelectionChanged())); … … 196 204 197 205 _buttonGet->setEnabled(false); 206 _buttonCasterTable->setEnabled(false); 198 207 199 208 _allLines.clear(); … … 357 366 } 358 367 359 368 // Slot caster table 369 //////////////////////////////////////////////////////////////////////////// 370 void bncTableDlg::slotCasterTable() { 371 372 _buttonCasterTable->setEnabled(false); 373 bncCasterTableDlg* dlg = new bncCasterTableDlg(this); 374 dlg->move(this->pos().x()+50, this->pos().y()+50); 375 connect(dlg, SIGNAL(newCaster(QString*, QString*)), 376 this, SLOT(slotNewCaster(QString*, QString*))); 377 dlg->exec(); 378 delete dlg; 379 _buttonCasterTable->setEnabled(true); 380 381 } 382 383 // Caster table 384 //////////////////////////////////////////////////////////////////////////// 385 bncCasterTableDlg::bncCasterTableDlg(QWidget* parent) : 386 QDialog(parent) { 387 388 static const QStringList labels = QString("url,port,caster,operator,nmea,country,lat,long,link").split(","); 389 390 QStringList lines; 391 lines.clear(); 392 _casterTable = new QTableWidget(this); 393 394 QUrl url; 395 url.setHost("www.rtcm-ntrip.org"); 396 url.setPort(2101); 397 url.setScheme("http"); 398 url.setPath("/"); 399 400 bncNetQueryV2 query; 401 QByteArray outData; 402 query.waitForRequestResult(url, outData); 403 if (query.status() == bncNetQuery::finished) { 404 QTextStream in(outData); 405 QString line = in.readLine(); 406 while ( !line.isNull() ) { 407 line = in.readLine(); 408 if (line.indexOf("CAS") == 0) { 409 lines.append(line); 410 } 411 } 412 } 413 if (lines.size() > 0) { 414 _casterTable->setSelectionMode(QAbstractItemView::ExtendedSelection); 415 _casterTable->setSelectionBehavior(QAbstractItemView::SelectRows); 416 417 QStringList hlp = lines[0].split(";"); 418 _casterTable->setColumnCount(hlp.size()-1); 419 _casterTable->setRowCount(lines.size()); 420 421 QListIterator<QString> it(lines); 422 int nRow = -1; 423 while (it.hasNext()) { 424 QStringList columns = it.next().split(";"); 425 ++nRow; 426 for (int ic = 0; ic < columns.size()-1; ic++) { 427 if (ic+1 == 5) { if (columns[ic+1] == "0") { columns[ic+1] = "no"; } else { columns[ic+1] = "yes"; }} 428 QTableWidgetItem* it = new QTableWidgetItem(columns[ic+1]); 429 it->setFlags(it->flags() & ~Qt::ItemIsEditable); 430 _casterTable->setItem(nRow, ic, it); 431 } 432 } 433 } 434 _casterTable->sortItems(0); 435 _casterTable->setHorizontalHeaderLabels(labels); 436 _casterTable->setSortingEnabled(true); 437 438 int ww = QFontMetrics(this->font()).width('w'); 439 _casterTable->horizontalHeader()->resizeSection(0,15*ww); 440 _casterTable->horizontalHeader()->resizeSection(1,5*ww); 441 _casterTable->horizontalHeader()->resizeSection(2,15*ww); 442 _casterTable->horizontalHeader()->resizeSection(3,15*ww); 443 _casterTable->horizontalHeader()->resizeSection(4,5*ww); 444 _casterTable->horizontalHeader()->resizeSection(5,7*ww); 445 _casterTable->horizontalHeader()->resizeSection(6,7*ww); 446 _casterTable->horizontalHeader()->resizeSection(7,7*ww); 447 _casterTable->horizontalHeader()->resizeSection(8,15*ww); 448 449 ww = QFontMetrics(font()).width('w'); 450 451 QPushButton* _closeButton = new QPushButton("Cancel"); 452 connect(_closeButton, SIGNAL(clicked()), this, SLOT(close())); 453 _closeButton->setMinimumWidth(8*ww); 454 _closeButton->setMaximumWidth(8*ww); 455 456 QPushButton* _okButton = new QPushButton(tr("OK"), this); 457 connect(_okButton, SIGNAL(clicked()), this, SLOT(slotAcceptCasterTable())); 458 _okButton->setMinimumWidth(8*ww); 459 _okButton->setMaximumWidth(8*ww); 460 461 QPushButton* _whatsThisCasterTableButton = new QPushButton(tr("Help=Shift+F1"), this); 462 connect(_whatsThisCasterTableButton, SIGNAL(clicked()), this, SLOT(slotWhatsThisCasterTable())); 463 _whatsThisCasterTableButton->setMinimumWidth(12*ww); 464 _whatsThisCasterTableButton->setMaximumWidth(12*ww); 465 466 _casterTable->setWhatsThis(tr("<p>Select an NTRIP broadcaster and hit 'OK'.</p><p>See http://www.rtcm-ntrip.org/home for further details on known NTRIP broadcaster installations.</u>.")); 467 468 QGridLayout* dlgLayout = new QGridLayout(); 469 dlgLayout->addWidget(new QLabel(" List of NTRIP Broadcasters from www.rtcm-ntrip.org"), 0,0,1,3,Qt::AlignLeft); 470 dlgLayout->addWidget(_casterTable, 1, 0, 1, 3); 471 dlgLayout->addWidget(_whatsThisCasterTableButton, 2, 0); 472 dlgLayout->addWidget(_closeButton, 2, 1, Qt::AlignRight); 473 dlgLayout->addWidget(_okButton, 2, 2); 474 475 setMinimumSize(600,400); 476 setWindowTitle(tr("Select Broadcaster")); 477 setLayout(dlgLayout); 478 resize(68*ww, 60*ww); 479 show(); 480 } 481 482 // Caster table what's this 483 //////////////////////////////////////////////////////////////////////////// 484 void bncCasterTableDlg:: slotWhatsThisCasterTable() { 485 QWhatsThis::enterWhatsThisMode(); 486 } 487 488 // Caster table destructor 489 //////////////////////////////////////////////////////////////////////////// 490 bncCasterTableDlg::~bncCasterTableDlg() { 491 if (_casterTable) { 492 for (int ir = 0; ir < _casterTable->rowCount(); ir++) { 493 for (int ic = 0; ic < _casterTable->columnCount(); ic++) { 494 delete _casterTable->item(ir,ic); 495 } 496 } 497 } 498 } 499 500 // Accept caster table 501 //////////////////////////////////////////////////////////////////////////// 502 void bncCasterTableDlg::slotAcceptCasterTable() { 503 504 QSettings settings; 505 QString* newCasterHost = new QString; 506 QString* newCasterPort = new QString; 507 508 if (_casterTable) { 509 for (int ir = 0; ir < _casterTable->rowCount(); ir++) { 510 QTableWidgetItem* item = _casterTable->item(ir,0); 511 for (int ic = 0; ic < _casterTable->columnCount(); ic++) { 512 if (_casterTable->isItemSelected(item)) { 513 if (ic == 0) { 514 newCasterHost->push_back(_casterTable->item(ir,0)->text()); 515 } 516 if (ic == 1) { 517 newCasterPort->push_back(_casterTable->item(ir,1)->text()); 518 } 519 } 520 } 521 } 522 } 523 emit newCaster(newCasterHost, newCasterPort); 524 QDialog::accept(); 525 } 526 527 // New caster selected 528 //////////////////////////////////////////////////////////////////////////// 529 void bncTableDlg::slotNewCaster(QString* newCasterHost, QString* newCasterPort) { 530 531 const QString* newHost = new QString(*newCasterHost); 532 const QString* newPort = new QString(*newCasterPort); 533 534 _casterHostLineEdit->setItemText(0,newHost->toAscii().data()); 535 _casterPortLineEdit->clear(); 536 _casterPortLineEdit->insert(newPort->toAscii().data()); 537 } 538 -
trunk/BNC/bnctabledlg.h
r1376 r1459 32 32 #include "bncconst.h" 33 33 34 class bncCasterTableDlg : public QDialog { 35 Q_OBJECT 36 37 public: 38 bncCasterTableDlg(QWidget* parent); 39 ~bncCasterTableDlg(); 40 41 signals: 42 void newCaster(QString* newCasterHost, QString* newCasterPort); 43 44 private slots: 45 virtual void slotAcceptCasterTable(); 46 virtual void slotWhatsThisCasterTable(); 47 48 private: 49 QTableWidget* _casterTable; 50 }; 51 34 52 class bncTableDlg : public QDialog { 35 53 Q_OBJECT … … 50 68 void slotSelectionChanged(); 51 69 void slotWhatsThis(); 70 void slotCasterTable(); 71 void slotNewCaster(QString* newCasterHost, QString* newCasterPort); 52 72 53 73 private: … … 63 83 QPushButton* _buttonOK; 64 84 QPushButton* _buttonWhatsThis; 85 QPushButton* _buttonCasterTable; 65 86 66 87 QTableWidget* _table;
Note:
See TracChangeset
for help on using the changeset viewer.