[1609] | 1 | // Part of BNC, a utility for retrieving decoding and
|
---|
| 2 | // converting GNSS data streams from NTRIP broadcasters.
|
---|
| 3 | //
|
---|
| 4 | // Copyright (C) 2009
|
---|
| 5 | // German Federal Agency for Cartography and Geodesy (BKG)
|
---|
| 6 | // http://www.bkg.bund.de
|
---|
| 7 | // Czech Technical University Prague, Department of Geodesy
|
---|
| 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.
|
---|
| 24 |
|
---|
| 25 | /* -------------------------------------------------------------------------
|
---|
| 26 | * BKG NTRIP Client
|
---|
| 27 | * -------------------------------------------------------------------------
|
---|
| 28 | *
|
---|
| 29 | * Class: bncIpPort
|
---|
| 30 | *
|
---|
| 31 | * Purpose: Select host for stream retrieval without NTRIP
|
---|
| 32 | *
|
---|
| 33 | * Author: G. Weber
|
---|
| 34 | *
|
---|
| 35 | * Created: 18-Feb-2009
|
---|
| 36 | *
|
---|
| 37 | * Changes:
|
---|
| 38 | *
|
---|
| 39 | * -----------------------------------------------------------------------*/
|
---|
| 40 |
|
---|
| 41 | #include <iostream>
|
---|
| 42 |
|
---|
| 43 | #include "bncipport.h"
|
---|
| 44 |
|
---|
| 45 | using namespace std;
|
---|
| 46 |
|
---|
| 47 | // Constructor
|
---|
| 48 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 49 | bncIpPort::bncIpPort(QWidget* parent) : QDialog(parent) {
|
---|
| 50 |
|
---|
[1615] | 51 | setMinimumSize(400,150);
|
---|
[1609] | 52 | QVBoxLayout* mainLayout = new QVBoxLayout(this);
|
---|
| 53 | QGridLayout* editLayout = new QGridLayout;
|
---|
| 54 |
|
---|
[1615] | 55 | setWindowTitle(tr("Add Stream from TCP/IP Port"));
|
---|
[1609] | 56 |
|
---|
| 57 | _ipHostLineEdit = new QLineEdit();
|
---|
| 58 | _ipPortLineEdit = new QLineEdit();
|
---|
| 59 | _ipMountLineEdit = new QLineEdit();
|
---|
| 60 | _ipFormatLineEdit = new QLineEdit();
|
---|
| 61 | _ipLatLineEdit = new QLineEdit();
|
---|
| 62 | _ipLonLineEdit = new QLineEdit();
|
---|
| 63 |
|
---|
| 64 | int ww = QFontMetrics(font()).width('w');
|
---|
| 65 | _ipPortLineEdit->setMaximumWidth(9*ww);
|
---|
| 66 | _ipMountLineEdit->setMaximumWidth(9*ww);
|
---|
| 67 | _ipFormatLineEdit->setMaximumWidth(9*ww);
|
---|
| 68 | _ipLatLineEdit->setMaximumWidth(9*ww);
|
---|
| 69 | _ipLonLineEdit->setMaximumWidth(9*ww);
|
---|
| 70 |
|
---|
| 71 | // WhatsThis
|
---|
| 72 | // ---------
|
---|
[1620] | 73 | _ipHostLineEdit->setWhatsThis(tr("<p>If no proxy server is involed in the communication, BNC allows to retrieve streams via TCP directly from an IP address without using the NTRIP transport protocol.</p><p>Enter the IP address of the stream providing host.</p>"));
|
---|
| 74 | _ipPortLineEdit->setWhatsThis(tr("<p>Enter the IP port number of the stream providing host.</p>"));
|
---|
[1736] | 75 | _ipMountLineEdit->setWhatsThis(tr("<p>Specify a mountpoint.</p><p>Recommended is a 4-character station ID.<br>Example: FFMJ</p>"));
|
---|
[3345] | 76 | _ipFormatLineEdit->setWhatsThis(tr("<p>Specify the stream format.</p><p>Available options are 'RTCM_2', 'RTCM_3', and 'ZERO'.</p>"));
|
---|
[1735] | 77 | _ipLatLineEdit->setWhatsThis(tr("<p>Enter the approximate latitude of the stream providing receiver in degrees.<p></p>Example: 45.32</p>"));
|
---|
| 78 | _ipLonLineEdit->setWhatsThis(tr("<p>Enter the approximate longitude of the stream providing receiver in degrees.<p></p>Example: -15.20</p>"));
|
---|
[1609] | 79 |
|
---|
| 80 | editLayout->addWidget(new QLabel(tr("Host")), 0, 0, Qt::AlignRight);
|
---|
| 81 | editLayout->addWidget(_ipHostLineEdit, 0, 1);
|
---|
| 82 | editLayout->addWidget(new QLabel(tr("Port")), 0, 2, Qt::AlignRight);
|
---|
| 83 | editLayout->addWidget(_ipPortLineEdit, 0, 3);
|
---|
| 84 | editLayout->addWidget(new QLabel(tr("Mountpoint")),1, 0, Qt::AlignRight);
|
---|
| 85 | editLayout->addWidget(_ipMountLineEdit, 1, 1);
|
---|
| 86 | editLayout->addWidget(new QLabel(tr("Format")), 1, 2, Qt::AlignRight);
|
---|
| 87 | editLayout->addWidget(_ipFormatLineEdit, 1, 3);
|
---|
| 88 | editLayout->addWidget(new QLabel(tr("Latitude")), 2, 0, Qt::AlignRight);
|
---|
| 89 | editLayout->addWidget(_ipLatLineEdit, 2, 1);
|
---|
| 90 | editLayout->addWidget(new QLabel(tr("Longitude")), 2, 2, Qt::AlignRight);
|
---|
| 91 | editLayout->addWidget(_ipLonLineEdit, 2, 3);
|
---|
| 92 |
|
---|
| 93 | mainLayout->addLayout(editLayout);
|
---|
| 94 |
|
---|
| 95 | _buttonWhatsThis = new QPushButton(tr("Help=Shift+F1"), this);
|
---|
| 96 | connect(_buttonWhatsThis, SIGNAL(clicked()), this, SLOT(slotWhatsThis()));
|
---|
| 97 |
|
---|
| 98 | _buttonCancel = new QPushButton(tr("Cancel"), this);
|
---|
| 99 | connect(_buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
|
---|
| 100 |
|
---|
| 101 | _buttonOK = new QPushButton(tr("OK"), this);
|
---|
| 102 | connect(_buttonOK, SIGNAL(clicked()), this, SLOT(accept()));
|
---|
| 103 |
|
---|
| 104 | _buttonOK->setDefault(true);
|
---|
| 105 |
|
---|
| 106 | QHBoxLayout* buttonLayout = new QHBoxLayout;
|
---|
| 107 |
|
---|
| 108 | buttonLayout->addWidget(_buttonWhatsThis);
|
---|
| 109 | buttonLayout->addStretch(1);
|
---|
| 110 | buttonLayout->addWidget(_buttonCancel);
|
---|
| 111 | buttonLayout->addWidget(_buttonOK);
|
---|
| 112 |
|
---|
| 113 | mainLayout->addLayout(buttonLayout);
|
---|
| 114 | }
|
---|
| 115 |
|
---|
| 116 | // Destructor
|
---|
| 117 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 118 | bncIpPort::~bncIpPort() {
|
---|
| 119 | delete _buttonCancel;
|
---|
| 120 | delete _buttonOK;
|
---|
| 121 | delete _buttonWhatsThis;
|
---|
| 122 | }
|
---|
| 123 |
|
---|
| 124 | // Accept slot
|
---|
| 125 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 126 | void bncIpPort::accept() {
|
---|
| 127 |
|
---|
| 128 | QStringList* mountPoints = new QStringList;
|
---|
| 129 |
|
---|
| 130 | if ( !_ipHostLineEdit->text().isEmpty() &&
|
---|
| 131 | !_ipPortLineEdit->text().isEmpty() &&
|
---|
| 132 | !_ipMountLineEdit->text().isEmpty() &&
|
---|
| 133 | !_ipFormatLineEdit->text().isEmpty() &&
|
---|
| 134 | !_ipLatLineEdit->text().isEmpty() &&
|
---|
| 135 | !_ipLonLineEdit->text().isEmpty() ) {
|
---|
| 136 |
|
---|
[1614] | 137 | mountPoints->push_back("//" + _ipHostLineEdit->text() + ":"
|
---|
| 138 | + _ipPortLineEdit->text() + "/"
|
---|
| 139 | + _ipMountLineEdit->text() + " "
|
---|
| 140 | + _ipFormatLineEdit->text() + " "
|
---|
| 141 | + _ipLatLineEdit->text() + " "
|
---|
| 142 | + _ipLonLineEdit->text() + " "
|
---|
[1782] | 143 | + "no N");
|
---|
[1609] | 144 | } else {
|
---|
| 145 | QMessageBox::warning(this, tr("Warning"),
|
---|
[1644] | 146 | tr("Incomplete settings"),
|
---|
[1609] | 147 | QMessageBox::Ok);
|
---|
| 148 | }
|
---|
| 149 |
|
---|
| 150 | emit newMountPoints(mountPoints);
|
---|
| 151 |
|
---|
| 152 | QDialog::accept();
|
---|
| 153 | }
|
---|
| 154 |
|
---|
| 155 | // Whats This Help
|
---|
| 156 | void bncIpPort::slotWhatsThis() {
|
---|
| 157 | QWhatsThis::enterWhatsThisMode();
|
---|
| 158 | }
|
---|
| 159 |
|
---|